diff --git a/PCCS b/PCCS index e86f89a..e522436 160000 --- a/PCCS +++ b/PCCS @@ -1 +1 @@ -Subproject commit e86f89aa6a48bb4b5be2a114c910e27055c54b3f +Subproject commit e522436d72539fdae063ed2a7eb4b3846b6e87a1 diff --git a/include/global_frame_controller.h b/include/global_frame_controller.h index d92514f..afcdde2 100644 --- a/include/global_frame_controller.h +++ b/include/global_frame_controller.h @@ -3,9 +3,13 @@ #include -#define STATE_CONNECTION 1 -#define STATE_TRANSFER 2 -#define STATE_NO_ANIM 3 +enum LinkAnimationState +{ + state_off, + state_connection, + state_transfer, + state_no_animation, +}; // TODO: This is kinda a silly spot for this // make sure outBuffer is large enough! Should be at least hex_len + 1 @@ -23,7 +27,7 @@ void global_next_frame(); int get_frame_count(); void set_menu_sprite_pal(int frame); void run_link_cable_animation(int frame); -void link_animation_state(int state); +void link_animation_state(LinkAnimationState state); void determine_fennel_blink(); void set_missingno(bool val); bool get_missingno_enabled(); diff --git a/include/link_handler.h b/include/link_handler.h index bf9534c..ccc1d43 100644 --- a/include/link_handler.h +++ b/include/link_handler.h @@ -396,7 +396,8 @@ public: byte payloadBuffer[0x2A0]; int curr_payload_size = 0; - byte dataOutBuffer[16]; + #define DATA_OUT_BUFFER_SIZE 16 + byte dataOutBuffer[DATA_OUT_BUFFER_SIZE]; int dataOutBufferCurrIndex = 0; // This MUST be a power of 2! diff --git a/source/box_menu.cpp b/source/box_menu.cpp index a2a1c24..82c25a9 100644 --- a/source/box_menu.cpp +++ b/source/box_menu.cpp @@ -154,7 +154,11 @@ int Box_Menu::box_main(PokeBox* box, Version vers) u32 nameEntryIndex = curr_pkmn->getSpeciesIndexNumber(); tte_set_pos(6, 88); - if (!(curr_GBA_rom.language == LANG_JPN) != (PTGB_BUILD_LANGUAGE == JPN_ID)) + if ( + // Only the name if the language is either both Japanese or neither is Japanese + ((curr_pkmn->getLanguage() == JAPANESE) && (PTGB_BUILD_LANGUAGE == JPN_ID)) || + ((curr_pkmn->getLanguage() != JAPANESE) && (PTGB_BUILD_LANGUAGE != JPN_ID)) + ) { curr_pkmn->externalConvertNickname(&pkmnTables, val); ptgb_write_simple(val, true); diff --git a/source/global_frame_controller.cpp b/source/global_frame_controller.cpp index b5bc448..5d0b221 100644 --- a/source/global_frame_controller.cpp +++ b/source/global_frame_controller.cpp @@ -15,7 +15,7 @@ int global_frame_count = 0; bool rand_enabled = true; int cable_frame = 0; -int curr_link_animation_state = 0; +LinkAnimationState curr_link_animation_state = state_off; int fennel_blink_timer = 0; int fennel_blink_state = 0; bool missingno_enabled = false; @@ -74,10 +74,11 @@ void global_next_frame() set_menu_sprite_pal(1); } - if (curr_link_animation_state != 0 && global_frame_count % (40 / curr_link_animation_state) == 0) + // This way of determining the animation speed is stupid and will be changed, but leaving it for now since the whole animation will be changing. + if (curr_link_animation_state != state_off && global_frame_count % (40 / curr_link_animation_state) == 0) { cable_frame = (cable_frame + 1) % 12; - if (curr_link_animation_state > 0) + if (curr_link_animation_state != state_off) { run_link_cable_animation(cable_frame); } @@ -142,12 +143,12 @@ void run_link_cable_animation(int frame) { switch (curr_link_animation_state) { - case STATE_CONNECTION: + case state_connection: frame %= 4; obj_hide_multi(link_frame1, 4); obj_unhide_multi(link_frame1, 0, frame); break; - case STATE_TRANSFER: + case state_transfer: obj_set_pos(link_blob1, path[frame][0] * 8, path[frame][1] * 8); obj_set_pos(link_blob2, path[frame][0] * 8, path[frame][1] * 8); obj_set_pos(link_blob3, path[frame][0] * 8, path[frame][1] * 8); @@ -169,12 +170,12 @@ void run_link_cable_animation(int frame) } } -void link_animation_state(int state) +void link_animation_state(LinkAnimationState state) { cable_frame = 0; switch (state) { - case STATE_CONNECTION: + case state_connection: obj_unhide(gba_cart, 0); obj_set_pos(gba_cart, 17 * 8, 14 * 8); @@ -187,9 +188,9 @@ void link_animation_state(int state) obj_set_pos(link_frame2, 13 * 8, 19 * 8); obj_set_pos(link_frame3, 9 * 8, 18 * 8); break; - case STATE_TRANSFER: + case state_transfer: obj_unhide_multi(link_blob1, 0, 3); - case STATE_NO_ANIM: + case state_no_animation: obj_unhide(gba_cart, 0); obj_set_pos(gba_cart, 17 * 8, 14 * 8); diff --git a/source/link_handler.cpp b/source/link_handler.cpp index f153b09..9b5c62d 100644 --- a/source/link_handler.cpp +++ b/source/link_handler.cpp @@ -621,7 +621,7 @@ void LinkConnection::handleStateLogic() case GET_CHECKSUM: if (inData != 0xFD) { - dataOutBuffer[dataOutBufferCurrIndex % 16] = inData; + dataOutBuffer[dataOutBufferCurrIndex % DATA_OUT_BUFFER_SIZE] = inData; dataOutBufferCurrIndex++; nextOutData = 0x01; } @@ -1250,7 +1250,7 @@ void LinkConnection::resetLinkPackets() // And set the incoming packet to nullptr since we don't know what that is yet. currIncomingPacket = nullptr; - for (int i = 0; i < 16; i++) + for (int i = 0; i < DATA_OUT_BUFFER_SIZE; i++) { dataOutBuffer[i] = 0; } diff --git a/source/main.cpp b/source/main.cpp index 76ce459..2b08cf3 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -454,12 +454,15 @@ int main(void) } } + /* + // This isn't needed anymore if ((curr_GBA_rom.language == LANG_JPN) != (PTGB_BUILD_LANGUAGE == JPN_ID)) { obj_hide_multi(ptgb_logo_l, 2); VBlankIntrWait(); lang_mismatch_error(); } + */ // Initialize memory and save data after loading the game BG_TEXTBOX = BG_TEXTBOX | BG_PRIO(3); diff --git a/source/pokedex.cpp b/source/pokedex.cpp index d5b82a7..bc0739d 100644 --- a/source/pokedex.cpp +++ b/source/pokedex.cpp @@ -94,14 +94,14 @@ int __attribute__((noinline)) pokedex_loop() u8 kanto_name[12]; u8 johto_name[12]; u8 decompression_buffer[2048]; - u16 charset[512]; + //u16 charset[512]; u8 name_buffer[16]; const u8 **namesChunkList; u32 namesNumChunks; u32 namesChunkSize; LZ77UnCompWram(TYPES_lz10_bin, (u8*)TYPES); - LZ77UnCompWram(gen_3_charsets_lz10_bin, (u8*)charset); + //LZ77UnCompWram(gen_3_charsets_lz10_bin, (u8*)charset); load_general_table_text_entries(decompression_buffer, sizeof(decompression_buffer), kanto_name, johto_name); diff --git a/source/script_array.cpp b/source/script_array.cpp index d6eb779..74bb12e 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -603,7 +603,7 @@ bool run_conditional(int index) case CMD_START_LINK: load_flex_background(FBG_Fennel, 3); - link_animation_state(STATE_CONNECTION); + link_animation_state(state_connection); box.reset(); if (g_debug_options.ignore_link_cable) { @@ -706,7 +706,7 @@ bool run_conditional(int index) } reload_textbox_background(); load_flex_background(FBG_Fennel, 2); - link_animation_state(0); + link_animation_state(state_off); return true; diff --git a/tools/gba-payload-generator/src/mystery_gift_builder.cpp b/tools/gba-payload-generator/src/mystery_gift_builder.cpp index a7d555e..fdc796f 100644 --- a/tools/gba-payload-generator/src/mystery_gift_builder.cpp +++ b/tools/gba-payload-generator/src/mystery_gift_builder.cpp @@ -865,7 +865,7 @@ void mystery_gift_script::build_script(UncompressedFileContainerReader &text_tab exit(1); } - if(section30_size > 4086) // A little shorter than 0x1000 since the checksum starts at 0xFF6 + if(section30_size > 0xFF6) // A little shorter than 0x1000 since the checksum starts at 0xFF6 { fprintf(stderr, "[gba-payload-generator]: Error: Section30 is too large for %s, lang %c, revision %d!\n", getGameName(curr_GBA_rom.gamecode), curr_GBA_rom.language, curr_GBA_rom.version); fprintf(stderr, "\tSection30 size: %d bytes, max size: %d bytes\n", section30_size, 4086);