fork/training-mode-ce
git clone https://git.julia.blue/fork/training-mode-ce
6e6f1de
nix
1#include "../MexTK/mex.h" 2#include "events.h" 3 4// unfortunately there are static in this header that only used in labCSS or lab 5#pragma GCC diagnostic push 6#pragma GCC diagnostic ignored "-Wunused-variable" 7 8// Labbing event 9// Custom TDI definitions 10#define TDI_HITNUM 10 11#define TDI_DISPNUM 4 12// menu model 13#define TDIMENU_SCALE 1 14#define TDIMENU_X 0 15#define TDIMENU_Y 0 16#define TDIMENU_Z 0 17#define TDIMENU_WIDTH 55 / TDIMENU_SCALE 18#define TDIMENU_HEIGHT 40 / TDIMENU_SCALE 19// menu text object 20#define TDITEXT_CANVASSCALE 0.05 21#define TDITEXT_TEXTSCALE 1 22#define TDITEXT_TEXTZ 0 23 24// recording 25#define REC_VERS 1 26 27//Recording Version History: 28//v0 = 3.0 Alpha 1-3. 29//v1 = 3.0 Alpha 4. 30// First version with importing UI. 31// Added filename and match settings to metadata, menu settings and adjusted the playerblock and grab struct for the fighters. 32//v2 = not released 33 34#define GXPRI_RECJOINT 80 35#define REC_GXLINK 18 36#define GXPRI_RECTEXT GXPRI_RECJOINT + 1 37// cobj 38#define RECCAM_COBJGXLINK (1 << REC_GXLINK) 39#define RECCAM_GXPRI 8 40// params 41#define REC_LENGTH (1 * 60 * 60) 42#define REC_SLOTS 6 43#define REC_SEEKJOINT 7 44#define REC_LEFTBOUNDJOINT 5 45#define REC_RIGHTBOUNDJOINT 6 46#define REC_LEFTTEXTJOINT 2 47#define REC_RIGHTTEXTJOINT 3 48#define REC_TEXTSCALE 0.04 49 50// export 51enum export_status 52{ 53EXSTAT_NONE , 54EXSTAT_REQSAVE , 55EXSTAT_SAVEWAIT , 56EXSTAT_DONE , 57}; 58enum export_menuindex 59{ 60EXMENU_SELCARD , 61EXMENU_NAME , 62EXMENU_CONFIRM , 63}; 64enum export_popup 65{ 66EXPOP_CONFIRM , 67EXPOP_SAVE , 68}; 69#define EXP_MEMCARDAJOBJ 9 70#define EXP_MEMCARDBJOBJ 11 71#define EXP_TEXTBOXJOBJ 12 72#define EXP_SCREENSHOTJOBJ 18 73 74#define EXP_KEYBOARD_X 0 75#define EXP_KEYBOARD_Y 3.5 76#define EXP_KEYBOARD_SIZE 1 77 78#define EXP_FILEDETAILS_X -8 79#define EXP_FILEDETAILS_Y -11.7 80#define EXP_FILEDETAILS_SIZE 0.7 81 82#define EXP_FILENAME_X -7 83#define EXP_FILENAME_Y -4.8 84#define EXP_FILENAME_ASPECTX 560 85#define EXP_FILENAME_ASPECTY 100 86#define EXP_FILENAME_SIZE 1 87 88#define EXP_SCREENSHOT_WIDTH (640) 89#define EXP_SCREENSHOT_HEIGHT (480) 90 91#define RESIZE_MULT (0.15) 92#define RESIZE_WIDTH (EXP_SCREENSHOT_WIDTH * RESIZE_MULT) 93#define RESIZE_HEIGHT (EXP_SCREENSHOT_HEIGHT * RESIZE_MULT) 94 95// input display 96typedef struct ButtonLookup 97{ 98u8 jobj ; 99u8 dobj ; 100}ButtonLookup ; 101enum buttons_enum 102{ 103BTN_A , 104BTN_B , 105BTN_X , 106BTN_Y , 107BTN_START , 108BTN_DPADUP , 109BTN_DPADRIGHT , 110BTN_DPADLEFT , 111BTN_DPADDOWN , 112BTN_L , 113BTN_R , 114BTN_Z , 115BTN_NUM , 116}; 117static ButtonLookup button_lookup []= { 118 {1 ,0 },// A 119 {2 ,0 },// B 120 {3 ,0 },// X 121 {4 ,0 },// Y 122 {5 ,0 },// Start 123 {6 ,1 },// Dpad Up 124 {6 ,2 },// Dpad Right 125 {6 ,3 },// Dpad Left 126 {6 ,4 },// Dpad Down 127 {11 ,0 },// L 128 {12 ,0 },// R 129 {13 ,0 },// Z 130}; 131static GXColor button_colors []= { 132 {50 ,180 ,50 ,255 },// A 133 {255 ,50 ,50 ,255 },// B 134 {127 ,127 ,127 ,255 },// X 135 {127 ,127 ,127 ,255 },// Y 136 {192 ,192 ,192 ,255 },// Start 137 {192 ,192 ,192 ,255 },// Dpad Up 138 {192 ,192 ,192 ,255 },// Dpad Right 139 {192 ,192 ,192 ,255 },// Dpad Left 140 {192 ,192 ,192 ,255 },// Dpad Down 141 {127 ,127 ,127 ,255 },// L 142 {127 ,127 ,127 ,255 },// R 143 {0 ,0 ,255 ,255 },// Z 144}; 145static int button_bits []= { 146HSD_BUTTON_A ,// A 147HSD_BUTTON_B ,// B 148HSD_BUTTON_X ,// X 149HSD_BUTTON_Y ,// Y 150HSD_BUTTON_START ,// Start 151HSD_BUTTON_DPAD_UP ,// Dpad Up 152HSD_BUTTON_DPAD_RIGHT ,// Dpad Right 153HSD_BUTTON_DPAD_LEFT ,// Dpad Left 154HSD_BUTTON_DPAD_DOWN ,// Dpad Down 155HSD_TRIGGER_L ,// L 156HSD_TRIGGER_R ,// R 157HSD_TRIGGER_Z ,// Z 158 };// GX 159#define INPUT_GXLINK 12 160#define INPUT_GXPRI 80 161// params 162#define INPUT_SHELL_JOBJ 14 163#define INPUT_SHELL_DOBJ 0 164#define INPUT_COLOR_PRESSED \ 165 { \ 166 255, 255, 255, 255 \ 167 } 168 169typedef struct Arch_ImportData 170{ 171JOBJDesc * import_button ; 172JOBJDesc * import_menu ; 173COBJDesc * import_cam ; 174JOBJDesc * import_popup ; 175}Arch_ImportData ; 176typedef struct Arch_LabData 177{ 178JOBJDesc * stick ; 179JOBJDesc * cstick ; 180void * save_icon ; 181void * save_banner ; 182JOBJDesc * controller ; 183JOBJDesc * export_menu ; 184JOBJDesc * export_popup ; 185}Arch_LabData ; 186typedef struct LabData 187{ 188EventDesc * eventInfo ; 189u8 cpu_state ; 190u8 cpu_hitshield ; 191u8 cpu_hitnum ; 192u8 cpu_sdinum ; 193u8 cpu_sdidir ; 194 195// Delay timer for "Counter After Frames" Option 196u8 cpu_countertimer ; 197 198// Delay timer for "Miss Tech Wait Chance" Option 199u8 cpu_miss_tech_wait_timer ; 200 201// Aitch: We set this flag if the CPU performs a counter action on this frame. 202// Occasionally we need to determine if the CPU is countering (such as AUTORESTORE_COUNTER). 203// However, if the counter action immediately completes, the cpu state is never set to CPUSTATE_COUNTER. 204// And sometimes the CPU is in the CPUSTATE_COUNTER state but does not act. 205// This flag is only set if the CPU has counter acted this frame. 206u8 cpu_countering :1 ; 207 208// Aitch: This flag is set per action and prevents air-ground transitions from interrupting the counter action. 209u8 cpu_countering_no_interrupt :1 ; 210 211// Aitch: This counter needs to be manually set. We can't use the baked in ssbm timer, because 212// It'll mess with internal ssbm stuff probably. If the timer is not zero, then no tech.stuff 213// This is set when hit in tumble. 214int cpu_tech_lockout ; 215 216// We need a place to store the current playback frame when the cpu is set to use a slot as a counter action. 217u16 counter_slot_frame ; 218 219s16 cpu_lasthit ; 220s16 cpu_lastshieldstun ;// last move instance of the opponent in shield stun. used to tell how many times the shield was hit 221s8 cpu_hitkind ;// how the CPU was hit, damage or shield 222u8 cpu_hitshieldnum ;// times the CPUs shield was hit 223u8 cpu_isactionable ;// flag that indicates if a cpu has become actionable 224u8 cpu_groundstate ;// indicates if the player was touching ground upon being actionable 225s32 timer ; 226u8 cpu_isthrown ;// bool for if the cpu is being thrown 227GOBJ * rec_gobj ; 228u8 hmn_controller ; 229u8 cpu_controller ; 230}LabData ; 231typedef struct InfoDisplayData 232{ 233JOBJ * menuModel ; 234JOBJ * botLeftEdge ; 235JOBJ * botRightEdge ; 236Text * text ; 237}InfoDisplayData ; 238typedef struct DIDraw 239{ 240int num [2 ];// number of vertices 241Vec2 * vertices [2 ];// pointer to vertex to draw 242}DIDraw ; 243typedef struct SDIDraw 244{ 245int num [2 ];// number of vertices 246int cap [2 ];// capacity of vertices 247Vec2 * vertices [2 ];// pointer to vertex to draw 248}SDIDraw ; 249typedef struct DIDrawCalculate 250{ 251Vec2 pos ;// position of vertices 252int envFlags ;// environment flags 253float ECBTopY ;// used for determining middle of body 254float ECBLeftY ;// used for determining middle of body 255float kb_Y ;// used to determine ceiling KOs 256}DIDrawCalculate ; 257typedef struct TDIData 258{ 259JOBJ * stick_curr [2 ]; 260JOBJ * stick_prev [6 ][2 ]; 261Text * text_curr ; 262}TDIData ; 263typedef struct RecInputs 264{ 265unsigned char btn_dpadup :1 ; 266unsigned char btn_a :1 ; 267unsigned char btn_b :1 ; 268unsigned char btn_x :1 ; 269unsigned char btn_y :1 ; 270unsigned char btn_L :1 ; 271unsigned char btn_R :1 ; 272unsigned char btn_Z :1 ; 273s8 stickX ; 274s8 stickY ; 275s8 substickX ; 276s8 substickY ; 277u8 trigger ; 278}RecInputs ; 279typedef struct RecInputData 280{ 281int start_frame ;// the frame these inputs start on 282int num ; 283RecInputs inputs [REC_LENGTH ]; 284}RecInputData ; 285typedef struct RecData 286{ 287int hmn_rndm_slot ; 288RecInputData * hmn_inputs [REC_SLOTS ]; 289RecInputData * hmn_rerecord_inputs ; 290int cpu_rndm_slot ; 291RecInputData * cpu_inputs [REC_SLOTS ]; 292RecInputData * cpu_rerecord_inputs ; 293int restore_timer ; 294JOBJ * seek_jobj ; 295Text * text ; 296float seek_left ; 297float seek_right ; 298}RecData ; 299 300typedef struct RecordingSave 301{ 302MatchInit match_data ;// this will point to a struct containing match info 303Savestate_v1 savestate ; 304RecInputData hmn_inputs [REC_SLOTS ]; 305RecInputData cpu_inputs [REC_SLOTS ]; 306}RecordingSave ; 307 308typedef struct Controller 309{ 310JOBJ * jobj ; 311Vec2 ltrig_origin ; 312Vec2 rtrig_origin ; 313}Controller ; 314 315typedef struct ExportData 316{ 317u16 menu_index ; 318u16 menu_state ; 319JOBJ * memcard_jobj [2 ]; 320JOBJ * screenshot_jobj ; 321JOBJ * textbox_jobj ; 322RGB565 * scaled_image ; 323Text * text_title ; 324Text * text_desc ; 325Text * text_misc ; 326int slot ; 327u8 is_inserted [2 ]; 328int free_blocks [2 ]; 329int free_files [2 ]; 330Text * text_keyboard ; 331Text * text_filename ; 332Text * text_filedetails ; 333u8 key_cursor [2 ]; 334u8 filename_cursor ; 335u8 caps_lock ; 336char * filename_buffer ; 337GOBJ * confirm_gobj ; 338Text * confirm_text ; 339u8 confirm_cursor ; 340u8 confirm_state ; 341int hmn_id ; 342int cpu_id ; 343int stage_id ; 344}ExportData ; 345typedef struct ExportMenuSettings 346{ 347u8 hmn_mode ; 348u8 hmn_slot ; 349u8 cpu_mode ; 350u8 cpu_slot ; 351u8 loop_inputs ; 352u8 auto_restore ; 353}ExportMenuSettings ; 354typedef struct ExportHeader 355{ 356struct rec_metadata // metadata 357 { 358u16 version ; 359u16 image_width ; 360u16 image_height ; 361u16 image_fmt ; 362u8 hmn ; 363u8 hmn_costume ; 364u8 cpu ; 365u8 cpu_costume ; 366u16 stage_external ;// instance of the stage 367u16 stage_internal ;// unique stage 368u8 month ; 369u8 day ; 370u16 year ; 371u8 hour ; 372u8 minute ; 373u8 second ; 374char filename [32 ]; 375 }metadata ; 376struct // lookup 377 { 378int ofst_screenshot ; 379int ofst_recording ; 380int ofst_menusettings ; 381// to-do, add menu data offset 382 }lookup ; 383}ExportHeader ; 384 385// TODO move these to lab.h 386 387void Event_Init (GOBJ * gobj ); 388void Event_Update (); 389void Event_Think (GOBJ * event ); 390 391void Button_Think (GOBJ * button_gobj ); 392 393void Lab_CustomOSDsThink (void ); 394void Lab_RemoveCustomOSD (GOBJ * menu_gobj ); 395void Lab_AddCustomOSD (GOBJ * menu_gobj ); 396void Lab_ChangeOSDs (GOBJ * menu_gobj ,int value ); 397void Lab_ChangeStadiumTransformation (GOBJ * menu_gobj ,int value ); 398void Lab_ChangeInputDisplay (GOBJ * menu_gobj ,int value ); 399void Lab_ChangeOverlays (GOBJ * menu_gobj ,int value ); 400void Lab_StartMoveCPU (GOBJ * menu_gobj ); 401void Lab_FinishMoveCPU (GOBJ * menu_gobj ); 402void Lab_FreezeCPU (GOBJ * menu_gobj ); 403void Lab_ChangeTauntEnabled (GOBJ * menu_gobj ,int value ); 404void Lab_ChangePlayerPercent (GOBJ * menu_gobj ,int value ); 405void Lab_ChangePlayerLockPercent (GOBJ * menu_gobj ,int value ); 406void Lab_ChangeCharacterRng_Turnip (GOBJ * menu_gobj ,int value ); 407void Lab_ChangeCharacterRng_PeachFSmash (GOBJ * menu_gobj ,int value ); 408void Lab_ChangeCharacterRng_Hammer (GOBJ * menu_gobj ,int value ); 409void Lab_ChangeCharacterRng_Misfire (GOBJ * menu_gobj ,int value ); 410void Lab_ChangeCharacterRng_NanaThrow (GOBJ * menu_gobj ,int value ); 411void Lab_ChangeFrameAdvance (GOBJ * menu_gobj ,int value ); 412void Lab_ChangeFrameAdvanceButton (GOBJ * menu_gobj ,int value ); 413void Lab_ChangeCPUPercent (GOBJ * menu_gobj ,int value ); 414void Lab_ChangeCPULockPercent (GOBJ * menu_gobj ,int value ); 415void Lab_ChangeTech (GOBJ * menu_gobj ,int value ); 416void Lab_ChangeGetup (GOBJ * menu_gobj ,int value ); 417void Lab_ChangeTechInPlaceChance (GOBJ * menu_gobj ,int value ); 418void Lab_ChangeTechAwayChance (GOBJ * menu_gobj ,int value ); 419void Lab_ChangeTechTowardChance (GOBJ * menu_gobj ,int value ); 420void Lab_ChangeMissTechChance (GOBJ * menu_gobj ,int value ); 421void Lab_ChangeStandChance (GOBJ * menu_gobj ,int value ); 422void Lab_ChangeRollAwayChance (GOBJ * menu_gobj ,int value ); 423void Lab_ChangeRollTowardChance (GOBJ * menu_gobj ,int value ); 424void Lab_ChangeGetupAttackChance (GOBJ * menu_gobj ,int value ); 425void Lab_ChangeCPUIntang (GOBJ * menu_gobj ,int value ); 426void Lab_ChangeModelDisplay (GOBJ * menu_gobj ,int value ); 427void Lab_ChangeHitDisplay (GOBJ * menu_gobj ,int value ); 428void Lab_ChangeEnvCollDisplay (GOBJ * menu_gobj ,int value ); 429void Lab_ChangeItemGrabDisplay (GOBJ * menu_gobj ,int value ); 430void Lab_ChangeCamMode (GOBJ * menu_gobj ,int value ); 431void Lab_ChangeInfoPresetHMN (GOBJ * menu_gobj ,int preset_id ); 432void Lab_ChangeInfoPresetCPU (GOBJ * menu_gobj ,int preset_id ); 433void Lab_ChangeHUD (GOBJ * menu_gobj ,int value ); 434void Lab_SelectCustomTDI (GOBJ * menu_gobj ); 435void Lab_ChangeSlot1ChanceHMN (GOBJ * menu_gobj ,int _new_val ); 436void Lab_ChangeSlot2ChanceHMN (GOBJ * menu_gobj ,int _new_val ); 437void Lab_ChangeSlot3ChanceHMN (GOBJ * menu_gobj ,int _new_val ); 438void Lab_ChangeSlot4ChanceHMN (GOBJ * menu_gobj ,int _new_val ); 439void Lab_ChangeSlot5ChanceHMN (GOBJ * menu_gobj ,int _new_val ); 440void Lab_ChangeSlot6ChanceHMN (GOBJ * menu_gobj ,int _new_val ); 441void Lab_ChangeSlot1ChanceCPU (GOBJ * menu_gobj ,int _new_val ); 442void Lab_ChangeSlot2ChanceCPU (GOBJ * menu_gobj ,int _new_val ); 443void Lab_ChangeSlot3ChanceCPU (GOBJ * menu_gobj ,int _new_val ); 444void Lab_ChangeSlot4ChanceCPU (GOBJ * menu_gobj ,int _new_val ); 445void Lab_ChangeSlot5ChanceCPU (GOBJ * menu_gobj ,int _new_val ); 446void Lab_ChangeSlot6ChanceCPU (GOBJ * menu_gobj ,int _new_val ); 447int Record_GetEndFrame (void ); 448int Record_GetCurrFrame (void ); 449int Record_GetSlot (int ply ); 450bool Record_CPU_IsRecording (void ); 451bool Record_HMN_IsRecording (void ); 452bool Record_HMN_IsPlayback (void ); 453bool Record_CPU_IsPlayback (void ); 454bool Record_HMN_IsRandomSlot (void ); 455bool Record_CPU_IsRandomSlot (void ); 456void Record_CopySlot (GOBJ * menu_gobj ); 457void Record_DeleteSlot (GOBJ * menu_gobj ); 458void Record_ChangeHMNSlot (GOBJ * menu_gobj ,int value ); 459void Record_ChangeCPUSlot (GOBJ * menu_gobj ,int value ); 460void Record_ChangeHMNMode (GOBJ * menu_gobj ,int value ); 461void Record_ChangeCPUMode (GOBJ * menu_gobj ,int value ); 462void Record_ChangeMirroredPlayback (GOBJ * menu_gobj ,int value ); 463void Record_ChangeSlot (GOBJ * menu_gobj ,int value ); 464void Record_MemcardSave (GOBJ * menu_gobj ); 465void Record_MemcardLoad (int slot ,int file_no ); 466void Record_InitState (GOBJ * menu_gobj ); 467void Record_ResaveState (GOBJ * menu_gobj ); 468void Record_PruneState (GOBJ * menu_gobj ); 469void Record_DeleteState (GOBJ * menu_gobj ); 470void Record_RestoreState (GOBJ * menu_gobj ); 471void Record_CObjThink (GOBJ * gobj ); 472void Record_GX (GOBJ * gobj ,int pass ); 473void Record_Think (GOBJ * rec_gobj ); 474void Record_Update (int ply ,RecInputData * inputs ,RecInputData * rerecord_inputs ,int rec_mode ); 475void Record_SetInputs (GOBJ * fighter ,RecInputs * inputs ,bool mirror ); 476int Record_RearrangeButtons (RecInputs * inputs ); 477void Record_LoadSavestate (Savestate_v1 * savestate ); 478int Record_MenuThink (GOBJ * menu_gobj ); 479int Record_GetRandomSlot (RecInputData ** input_data ,EventOption slot_menu []); 480int Record_GOBJToID (GOBJ * gobj ); 481int Record_FtDataToID (FighterData * fighter_data ); 482int Record_BoneToID (FighterData * fighter_data ,JOBJ * bone ); 483GOBJ * Record_IDToGOBJ (int id ); 484FighterData * Record_IDToFtData (int id ); 485JOBJ * Record_IDToBone (FighterData * fighter_data ,int id ); 486void Snap_CObjThink (GOBJ * gobj ); 487void Record_StartExport (GOBJ * menu_gobj ); 488void Record_OnSuccessfulSave (int deleteRecordings ); 489void Export_Init (GOBJ * menu_gobj ); 490int Export_Think (GOBJ * export_gobj ); 491void Export_Destroy (GOBJ * export_gobj ); 492void Export_SelCardInit (GOBJ * export_gobj ); 493int Export_SelCardThink (GOBJ * export_gobj ); 494int Export_Compress (u8 * dest ,u8 * source ,u32 size ); 495void Export_EnterNameUpdateKeyboard (GOBJ * export_gobj ); 496void Export_ConfirmExit (GOBJ * export_gobj ); 497int Export_Process (GOBJ * export_gobj ); 498void Export_ConfirmInit (GOBJ * export_gobj ); 499void Export_EnterNameExit (GOBJ * export_gobj ); 500int Export_EnterNameThink (GOBJ * export_gobj ); 501void Export_EnterNameInit (GOBJ * export_gobj ); 502void Export_SelCardExit (GOBJ * export_gobj ); 503int Export_SelCardThink (GOBJ * export_gobj ); 504void Export_SelCardInit (GOBJ * export_gobj ); 505void Export_Destroy (GOBJ * export_gobj ); 506int Export_Think (GOBJ * export_gobj ); 507void Export_ConfirmInit (GOBJ * export_gobj ); 508int Export_ConfirmThink (GOBJ * export_gobj ); 509void Lab_Exit (GOBJ * menu ); 510void InfoDisplay_Update (GOBJ * menu_gobj ,EventOption menu [],GOBJ * fighter ,GOBJ * below ); 511 512// info display 513#define GXPRI_INFDISP GXPRI_MENUMODEL - 2 514#define GXLINK_INFDISP 12 515#define GXPRI_INFDISPTEXT GXPRI_INFDISP + 1 516#define GXLINK_INFDISPTEXT 12 517 518// info display jobj 519#define INFDISP_WIDTH 6 520#define INFDISP_SCALE 4 521#define INFDISP_X -26.5 522#define INFDISP_Y 21.5 523#define INFDISP_Z 0.01 524#define INFDISP_YOFFSET -2.5 525#define INFDISP_BOTY -0.5 526#define INFDISP_BOTYOFFSET -0.30 527// info display text 528#define INFDISPTEXT_SCALE 0.04 529#define INFDISPTEXT_X 1.0 530#define INFDISPTEXT_Y 1.0 531#define INFDISPTEXT_YOFFSET 30 532 533// DI Draw Constants 534#define DI_MaxColl 50 535 536static char * stage_names []= { 537"" , 538"" , 539"Princess Peach's Castle" , 540"Rainbow Cruise" , 541"Kongo Jungle" , 542"Jungle Japes" , 543"Great Bay" , 544"Hyrule Temple" , 545"Brinstar" , 546"Brinstar Depths" , 547"Yoshi's Story" , 548"Yoshi's Island" , 549"Fountain of Dreams" , 550"Green Greens" , 551"Corneria" , 552"Venom" , 553"Pokemon Stadium" , 554"Poke Floats" , 555"Mute City" , 556"Big Blue" , 557"Onett" , 558"Fourside" , 559"Icicle Mountain" , 560"" , 561"Mushroom Kingdom" , 562"Mushroom Kingdom II" , 563"" , 564"Flat Zone" , 565"Dream Land" , 566"Yoshi's Island (64)" , 567"Kongo Jungle (64)" , 568"" , 569"" , 570"" , 571"" , 572"" , 573"Battlefield" , 574"Final Destination" , 575}; 576 577// CSS Import 578s8 * onload_fileno = R13_OFFSET (-0x4670 ); 579s8 * onload_slot = R13_OFFSET (-0x466F ); 580#define IMPORT_FILESPERPAGE 10 581enum ImportMenuStates 582{ 583IMP_SELCARD , 584IMP_SELFILE , 585IMP_CONFIRM , 586}; 587enum ImportConfirmKind 588{ 589CFRM_LOAD , 590CFRM_OLD , 591CFRM_NEW , 592CFRM_NONE , 593CFRM_DEL , 594CFRM_ERR , 595}; 596typedef struct FileInfo 597{ 598char * file_name ;// pointer to file name array 599int file_size ;// number of files on card 600int file_no ;// index of this file on the card 601}FileInfo ; 602typedef struct ImportData 603{ 604GOBJ * menu_gobj ; 605u16 canvas ; 606u8 menu_state ; 607u8 cursor ; 608u8 memcard_inserted [2 ];// memcard inserted bools 609u16 memcard_slot ;// selected slot 610JOBJ * memcard_jobj [2 ]; 611JOBJ * screenshot_jobj ; 612JOBJ * scroll_jobj ; 613JOBJ * scroll_top ; 614JOBJ * scroll_bot ; 615Text * title_text ; 616Text * desc_text ; 617Text * option_text ; 618Text * filename_text ; 619Text * fileinfo_text ; 620int file_num ;// number of displayed files on card 621int hidden_file_num ;// number of hidden files on card 622FileInfo * file_info ;// pointer to file info array 623ExportHeader * header ;// pointer to header array for the files on the current page 624u8 page ;// file page 625struct 626 { 627GOBJ * gobj ;// confirm gobj 628u16 canvas ; 629u8 kind ;// which kind of confirm dialog this is 630u8 cursor ; 631Text * text ; 632 }confirm ; 633struct 634 { 635_HSD_ImageDesc * orig_image ;// pointer to jobj's original image desc 636RGB565 * image ;// pointer to 32 byte aligned image allocation (one being displayed) 637int loaded_num ;// number of completed snaps loaded 638u8 load_inprogress ;// bool for if a file is being loaded 639u8 file_loading ;// page local index of the file being loaded 640void * file_data [IMPORT_FILESPERPAGE ];// pointer to each files data 641u8 is_loaded [IMPORT_FILESPERPAGE ];// bools for which snap has been loaded 642 }snap ; 643}ImportData ; 644void Cam_Button_Create (); 645void Cam_Button_Think (GOBJ * button_gobj ); 646void Hazards_Button_Create (); 647void Hazards_Button_Think (GOBJ * button_gobj ); 648void Menu_Confirm_Init (GOBJ * menu_gobj ,int kind ); 649void Menu_Confirm_Think (GOBJ * menu_gobj ); 650void Menu_Confirm_Exit (GOBJ * menu_gobj ); 651GOBJ * Menu_Create (); 652void Menu_Think (GOBJ * menu_gobj ); 653#define MENUCAM_GXLINK 5 654#define SIS_ID 0 655 656#pragma GCC diagnostic pop