From a2d5c260ec97e5b19a652921b3bc9a2923562869 Mon Sep 17 00:00:00 2001 From: retro-wertz Date: Sat, 1 Dec 2018 07:13:14 +0800 Subject: [PATCH 01/10] libretro: Add turbo buttons --- src/libretro/libretro.cpp | 78 +++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/src/libretro/libretro.cpp b/src/libretro/libretro.cpp index eec4a3ac..99d3a258 100644 --- a/src/libretro/libretro.cpp +++ b/src/libretro/libretro.cpp @@ -409,6 +409,8 @@ void retro_set_environment(retro_environment_t cb) { "vbam_soundfiltering", "Sound Filtering; 5|6|7|8|9|10|0|1|2|3|4" }, { "vbam_gbHardware", "(GB) Emulated Hardware; Automatic|Game Boy Color|Super Game Boy|Game Boy|Game Boy Advance|Super Game Boy 2" }, { "vbam_showborders", "(GB) Show Borders; disabled|enabled|auto" }, + { "vbam_turboenable", "Enable Turbo Buttons; disabled|enabled" }, + { "vbam_turbodelay", "Turbo Delay (in frames); 3|4|5|6|7|8|9|10|11|12|13|14|15|1|2" }, { "vbam_layer_1", "Show layer 1; enabled|disabled" }, { "vbam_layer_2", "Show layer 2; enabled|disabled" }, { "vbam_layer_3", "Show layer 3; enabled|disabled" }, @@ -887,6 +889,27 @@ static const unsigned binds[4][MAX_BUTTONS] = { } }; +#define TURBO_BUTTONS 2 +static bool turbo_enable = false; +static int turbo_delay = 3; +static int turbo_delay_counter[TURBO_BUTTONS] = {0}; + +static const unsigned turbo_binds[4][TURBO_BUTTONS] = { + { 0, 0 }, // placeholder for no input + { + RETRO_DEVICE_ID_JOYPAD_X, + RETRO_DEVICE_ID_JOYPAD_Y + }, + { + RETRO_DEVICE_ID_JOYPAD_A, + RETRO_DEVICE_ID_JOYPAD_X + }, + { + RETRO_DEVICE_ID_JOYPAD_Y, + RETRO_DEVICE_ID_JOYPAD_X + } +}; + static void systemGbBorderOff(void); static void systemUpdateSolarSensor(int level); static uint8_t sensorDarkness = 0xE8; @@ -1015,6 +1038,21 @@ static void update_variables(void) else if (strcmp(var.value, "Super Game Boy 2") == 0) gbEmulatorType = 5; } + + var.key = "vbam_turboenable"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + bool val = !strcmp(var.value, "enabled"); + turbo_enable = val; + } + + var.key = "vbam_turbodelay"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + turbo_delay = atoi(var.value); + } } static unsigned has_frame; @@ -1079,8 +1117,8 @@ void retro_cheat_reset(void) { cheatsEnabled = 1; if (type == IMAGE_GBA) - cheatsDeleteAll(false); - else if (type == IMAGE_GB) + cheatsDeleteAll(false); + else if (type == IMAGE_GB) gbCheatRemoveAll(); } @@ -1193,6 +1231,8 @@ static void update_input_descriptors(void) { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" }, + { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Turbo B" }, + { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Turbo A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Solar Sensor (Darker)" }, @@ -1210,6 +1250,8 @@ static void update_input_descriptors(void) { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" }, + { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Turbo B" }, + { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Turbo A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Solar Sensor (Darker)" }, @@ -1227,6 +1269,8 @@ static void update_input_descriptors(void) { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" }, + { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Turbo B" }, + { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Turbo A" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" }, { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Solar Sensor (Darker)" }, @@ -1346,10 +1390,10 @@ bool retro_load_game(const struct retro_game_info *game) desc[5].len = 0x00a0; // http://gameboy.mongenel.com/dmg/asmmemmap.html - // $4000-$7FFF Cartridge ROM - Switchable Banks 1-xx - // $0150-$3FFF Cartridge ROM - Bank 0 (fixed) - // $0100-$014F Cartridge Header Area - // $0000-$00FF Restart and Interrupt Vectors + // $4000-$7FFF Cartridge ROM - Switchable Banks 1-xx + // $0150-$3FFF Cartridge ROM - Bank 0 (fixed) + // $0100-$014F Cartridge Header Area + // $0000-$00FF Restart and Interrupt Vectors desc[6].ptr = gbMemoryMap[0x00]; desc[6].start = 0x0000; desc[6].len = 0x4000; @@ -1498,10 +1542,28 @@ uint32_t systemReadJoypad(int which) uint32_t J = 0; - if (retropad_layout) - for (unsigned i = 0; i < MAX_BUTTONS; i++) + if (retropad_layout) { + int i; + for (i = 0; i < MAX_BUTTONS; i++) J |= input_cb(which, RETRO_DEVICE_JOYPAD, 0, binds[retropad_layout][i]) << i; + if (turbo_enable) { + /* Handle Turbo A & B buttons */ + for (i = 0; i < TURBO_BUTTONS; i++) { + if (input_cb(which, RETRO_DEVICE_JOYPAD, 0, turbo_binds[retropad_layout][i])) { + if (!turbo_delay_counter[i]) + J |= 1 << i; + turbo_delay_counter[i]++; + if (turbo_delay_counter[i] > turbo_delay) + /* Reset the toggle if delay value is reached */ + turbo_delay_counter[i] = 0; + } else + /* If the button is not pressed, just reset the toggle */ + turbo_delay_counter[i] = 0; + } + } + } + // Do not allow opposing directions if ((J & 0x30) == 0x30) J &= ~(0x30); From ca56ccffebff38a98da1388269e926ba525129e4 Mon Sep 17 00:00:00 2001 From: retro-wertz Date: Sat, 1 Dec 2018 07:24:54 +0800 Subject: [PATCH 02/10] libretro: Simplify cheats, add multiline support for GB/GBC --- src/libretro/libretro.cpp | 151 +++++++++++++++----------------------- 1 file changed, 61 insertions(+), 90 deletions(-) diff --git a/src/libretro/libretro.cpp b/src/libretro/libretro.cpp index 99d3a258..c979f527 100644 --- a/src/libretro/libretro.cpp +++ b/src/libretro/libretro.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -36,8 +35,6 @@ #define RETRO_DEVICE_GBA_ALT1 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1) #define RETRO_DEVICE_GBA_ALT2 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 2) -#define ISHEXDEC ((codeLine[cursor]>='0') && (codeLine[cursor]<='9')) || ((codeLine[cursor]>='a') && (codeLine[cursor]<='f')) || ((codeLine[cursor]>='A') && (codeLine[cursor]<='F')) - static retro_log_printf_t log_cb; static retro_video_refresh_t video_cb; static retro_input_poll_t poll_cb; @@ -1122,102 +1119,76 @@ void retro_cheat_reset(void) gbCheatRemoveAll(); } +#define ISHEXDEC \ + ((code[cursor] >= '0') && (code[cursor] <= '9')) || \ + ((code[cursor] >= 'a') && (code[cursor] <= 'f')) || \ + ((code[cursor] >= 'A') && (code[cursor] <= 'F')) || \ + (code[cursor] == '-') \ + void retro_cheat_set(unsigned index, bool enabled, const char* code) { - /* - const char *begin, *c; + // 2018-11-30 - retrowertz + // added support GB/GBC multiline 6/9 digit Game Genie codes and Game Shark - begin = c = code; + char name[128] = {0}; + unsigned cursor = 0; + char *codeLine = NULL; + int codeLineSize = strlen(code) + 5; + int codePos = 0; + int i = 0; - if (!code) - return; - - do { - if (*c != '+' && *c != '\0') - continue; - - char buf[32] = {0}; - int len = c - begin; - int i; - - // make sure it's using uppercase letters - for (i = 0; i < len; i++) - buf[i] = toupper(begin[i]); - buf[i] = 0; - - begin = ++c; - - if (len == 16) - cheatsAddGSACode(buf, "", false); - else { - char *space = strrchr(buf, ' '); - if (space != NULL) { - if ((buf + len - space - 1) == 4) - cheatsAddCBACode(buf, ""); - else { - memmove(space, space+1, strlen(space+1)+1); - cheatsAddGSACode(buf, "", true); - } - } else if (log_cb) - log_cb(RETRO_LOG_ERROR, "[VBA] Invalid cheat code '%s'\n", buf); - } - - } while (*c++); - */ - - std::string codeLine = code; - std::string name = "cheat_" + index; - int matchLength = 0; - std::vector codeParts; - int cursor; - - if (type == IMAGE_GBA) { - //Break the code into Parts - for (cursor = 0;; cursor++) { - if (ISHEXDEC) - matchLength++; - else { - if (matchLength) { - if (matchLength > 8) { - codeParts.push_back(codeLine.substr(cursor - matchLength, 8)); - codeParts.push_back(codeLine.substr(cursor - matchLength + 8, matchLength - 8)); - } else - codeParts.push_back(codeLine.substr(cursor - matchLength, matchLength)); - matchLength = 0; + codeLine = (char *)calloc(codeLineSize, sizeof(char)); + sprintf(name, "cheat_%d", index); + for (cursor = 0;; cursor++) { + if (ISHEXDEC) { + codeLine[codePos++] = toupper(code[cursor]); + } else { + switch (type) { + case IMAGE_GB: + if (codePos >= 7) { + if (codePos == 7 || codePos == 11) { + codeLine[codePos] = '\0'; + if (gbAddGgCheat(codeLine, name)) + log("Cheat code added: '%s'\n", codeLine); + } else if (codePos == 8) { + codeLine[codePos] = '\0'; + if (gbAddGsCheat(codeLine, name)) + log("Cheat code added: '%s'\n", codeLine); + } else { + codeLine[codePos] = '\0'; + log("Invalid cheat code '%s'\n", codeLine); + } + codePos = 0; + memset(codeLine, 0, codeLineSize); } + break; + case IMAGE_GBA: + if (codePos >= 12) { + if (codePos == 12 ) { + for (i = 0; i < 4 ; i++) + codeLine[codePos - i] = codeLine[(codePos - i) - 1]; + codeLine[8] = ' '; + codeLine[13] = '\0'; + cheatsAddCBACode(codeLine, name); + log("Cheat code added: '%s'\n", codeLine); + } else if (codePos == 16) { + codeLine[16] = '\0'; + cheatsAddGSACode(codeLine, name, true); + log("Cheat code added: '%s'\n", codeLine); + } else { + codeLine[codePos] = '\0'; + log("Invalid cheat code '%s'\n", codeLine); + } + codePos = 0; + memset(codeLine, 0, codeLineSize); + } + break; } - if (!codeLine[cursor]) + if (!code[cursor]) break; } - - //Add to core - for (cursor = 0; cursor < codeParts.size(); cursor += 2) { - std::string codeString; - codeString += codeParts[cursor]; - - if (codeParts[cursor + 1].length() == 8) { - codeString += codeParts[cursor + 1]; - cheatsAddGSACode(codeString.c_str(), name.c_str(), true); - } else if (codeParts[cursor + 1].length() == 4) { - codeString += " "; - codeString += codeParts[cursor + 1]; - cheatsAddCBACode(codeString.c_str(), name.c_str()); - } else { - codeString += " "; - codeString += codeParts[cursor + 1]; - log_cb(RETRO_LOG_ERROR, "Invalid cheat code '%s'\n", codeString.c_str()); - } - log_cb(RETRO_LOG_INFO, "Cheat code added: '%s'\n", codeString.c_str()); - } - } else if (type == IMAGE_GB) { - if (codeLine.find("-") != std::string::npos) { - if (gbAddGgCheat(code, "")) - log_cb(RETRO_LOG_INFO, "Cheat code added: '%s'\n", codeLine.c_str()); - } else { - if (gbAddGsCheat(code, "")) - log_cb(RETRO_LOG_INFO, "Cheat code added: '%s'\n", codeLine.c_str()); - } } + free(codeLine); } static void update_input_descriptors(void) From 727606420adeba2b3e017dc1940426b7010896d4 Mon Sep 17 00:00:00 2001 From: retro-wertz Date: Sat, 1 Dec 2018 07:33:19 +0800 Subject: [PATCH 03/10] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5d2a3474..ab9cbe3d 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -20,6 +20,8 @@ Which games are affected by the issue (please state if GBA or GB game): Which games, if any, are NOT affected by the issue (please state if GBA or GB game): +Include screenshots of ROM Information (File > ROM Information): + ### Option details Video driver (simple, opengl): From 5b0f2e8aa65fb021f3709f5278168a7394825bca Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sun, 2 Dec 2018 20:31:39 -0800 Subject: [PATCH 04/10] builder: msys2: fix links to host binaries Factor out non-environment code from host_env()/target_env() into host_env_base()/target_env_base(). Such as that for creating symlinks to root, link host binaries to the target root, as well as calling the hook. Call the _base() functions from the msys2 overrides so that symlinks are created properly, remove redundant symlink code. --- tools/builder/core.sh | 2 +- tools/builder/mingw.sh | 38 +++++++++++++++++++++++--------------- tools/win/msys2-builder | 6 ++---- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 28a57d61..caec89d6 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -13,7 +13,7 @@ export PERL_MAKE="${PERL_MAKE:-make}" BUILD_ENV=$BUILD_ENV$(cat </dev/null || : +} + +host_env() { if [ -z "$OCC" ]; then cat </dev/null || : + host_env_base 2>/dev/null || : } -target_env() { +target_env_base() { rm -f "$BUILD_ROOT/root" ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root" + # make links to executables in the target as well + IFS=$NL + for exe in $(find "$BUILD_ROOT/host/bin" -maxdepth 1 -type f); do + IFS=$OIFS + basename=${exe##*/} + if ! path_exists "$BUILD_ROOT/target/bin/$basename"; then + ln -s "$exe" "$BUILD_ROOT/target/bin/$basename"; + fi + done + IFS=$OIFS + + target_env_hook 2>/dev/null || : +} + +target_env() { if [ -n "$OCC" ]; then cat </dev/null || : + target_env_base 2>/dev/null || : } # replace install artifact paths with absolute paths into host and target trees diff --git a/tools/win/msys2-builder b/tools/win/msys2-builder index a11d20fa..b320e27f 100755 --- a/tools/win/msys2-builder +++ b/tools/win/msys2-builder @@ -107,8 +107,6 @@ DIST_TAR_ARGS=" . "${0%/*}/../builder/mingw.sh" host_env() { - ln -sf "$BUILD_ROOT/host" "$BUILD_ROOT/root" - cat </dev/null || : } target_env() { - ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root" - cat </dev/null || : } table_line_append DIST_PRE_BUILD c2man ":; \ From 36e412df53961932a29dffe70f97105ea9f861a1 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 3 Dec 2018 00:37:04 -0800 Subject: [PATCH 05/10] builder: mingw: fix libffi for i686 + improvemnts Add the tables DIST_EXTRA_{CPPFLAGS,CFLAGS,CXXFLAGS,OBJCXXFLAGS} for adjustments during builds. Add -DSYMBOL_UNDERSCORE to DIST_EXTRA_CPPFLAGS for libffi on mingw when the target is i686, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1336569 Also set target_bits and target_cpu appropriately in the msys2 script. --- tools/builder/core.sh | 40 ++++++++++++++++++++++++++++++++++++++++ tools/builder/mingw.sh | 6 ++++++ tools/win/msys2-builder | 4 ++++ 3 files changed, 50 insertions(+) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index caec89d6..2dd1e90b 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -1335,6 +1335,10 @@ build_dist() { dist_patch "$current_dist" dist_pre_build "$current_dist" + ORIG_CPPFLAGS=$CPPFLAGS + ORIG_CFLAGS=$CFLAGS + ORIG_CXXFLAGS=$CXXFLAGS + ORIG_OBJCXXFLAGS=$OBJCXXFLAGS ORIG_LDFLAGS=$LDFLAGS ORIG_LIBS=$LIBS @@ -1344,6 +1348,10 @@ build_dist() { export LDFLAGS="$CXXFLAGS $LDFLAGS" fi + export CPPFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cppflags "$current_dist")")" + export CFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cflags "$current_dist")")" + export CXXFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cxxflags "$current_dist")")" + export OBJCXXFLAGS="$LDFLAGS $(eval puts "$(dist_extra_objcxxflags "$current_dist")")" export LDFLAGS="$LDFLAGS $(eval puts "$(dist_extra_ldflags "$current_dist")")" export LIBS="$LIBS $(eval puts "$(dist_extra_libs "$current_dist")")" @@ -1605,6 +1613,10 @@ build_dist() { fi fi + export CPPFLAGS="$ORIG_CPPFLAGS" + export CFLAGS="$ORIG_CFLAGS" + export CXXFLAGS="$ORIG_CXXFLAGS" + export OBJCXXFLAGS="$ORIG_OBJCXXFLAGS" export LDFLAGS="$ORIG_LDFLAGS" export LIBS="$ORIG_LIBS" @@ -2199,6 +2211,34 @@ dist_make_install_args() { puts "$(table_line DIST_MAKE_INSTALL_ARGS $current_dist)" || : } +dist_extra_cppflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_cppflags: dist name required' + + puts "$(table_line DIST_EXTRA_CPPFLAGS $current_dist)" || : +} + +dist_extra_cflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_cflags: dist name required' + + puts "$(table_line DIST_EXTRA_CFLAGS $current_dist)" || : +} + +dist_extra_cxxflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_cxxflags: dist name required' + + puts "$(table_line DIST_EXTRA_CXXFLAGS $current_dist)" || : +} + +dist_extra_objcxxflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_objcxxflags: dist name required' + + puts "$(table_line DIST_EXTRA_OBJCXXFLAGS $current_dist)" || : +} + dist_extra_ldflags() { current_dist=$1 [ -n "$current_dist" ] || die 'dist_extra_ldflags: dist name required' diff --git a/tools/builder/mingw.sh b/tools/builder/mingw.sh index 96aa1508..aaf80e21 100644 --- a/tools/builder/mingw.sh +++ b/tools/builder/mingw.sh @@ -256,6 +256,12 @@ table_insert_after DISTS cmake "dlfcn https://github.com/dlfcn-win32/dlfcn-win32 table_line_replace DIST_CONFIGURE_TYPES dlfcn cmake +if [ "$target_bits" -eq 32 ]; then + # this is necessary for a linkable libffi on i686 for whatever reason + # see: https://bugzilla.mozilla.org/show_bug.cgi?id=1336569 + table_line_append DIST_EXTRA_CPPFLAGS libffi -DSYMBOL_UNDERSCORE +fi + libicu=libicu if [ -n "$(table_line DISTS libicu-target || :)" ]; then diff --git a/tools/win/msys2-builder b/tools/win/msys2-builder index b320e27f..5756059b 100755 --- a/tools/win/msys2-builder +++ b/tools/win/msys2-builder @@ -32,11 +32,15 @@ case "$MSYSTEM" in export HOST_SYSTEM=i686-w64-mingw32 sys_base=/mingw32 export BUILD_ROOT="$HOME/vbam-build-msys2-i686" + target_bits=32 + target_cpu=i686 ;; MINGW64) export HOST_SYSTEM=x86_64-w64-mingw32 sys_base=/mingw64 export BUILD_ROOT="$HOME/vbam-build-msys2-x86_64" + target_bits=64 + target_cpu=x86_64 ;; MSYS) exec "$0" "$@" -64 From c68f372e5a55301850717ab771e52fa30222099e Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 3 Dec 2018 16:22:57 -0800 Subject: [PATCH 06/10] fix wrong copy-pasta in 36e412df Set the CPPFLAGS/CFLAGS/CXXFLAGS/OBJCXXFLAGS variables correctly in build_dist(), were set incorrectly in 36e412df. --- tools/builder/core.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 2dd1e90b..8fda0c75 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -1348,10 +1348,10 @@ build_dist() { export LDFLAGS="$CXXFLAGS $LDFLAGS" fi - export CPPFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cppflags "$current_dist")")" - export CFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cflags "$current_dist")")" - export CXXFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cxxflags "$current_dist")")" - export OBJCXXFLAGS="$LDFLAGS $(eval puts "$(dist_extra_objcxxflags "$current_dist")")" + export CPPFLAGS="$CPPFLAGS $(eval puts "$(dist_extra_cppflags "$current_dist")")" + export CFLAGS="$CFLAGS $(eval puts "$(dist_extra_cflags "$current_dist")")" + export CXXFLAGS="$CXXFLAGS $(eval puts "$(dist_extra_cxxflags "$current_dist")")" + export OBJCXXFLAGS="$OBJCXXFLAGS $(eval puts "$(dist_extra_objcxxflags "$current_dist")")" export LDFLAGS="$LDFLAGS $(eval puts "$(dist_extra_ldflags "$current_dist")")" export LIBS="$LIBS $(eval puts "$(dist_extra_libs "$current_dist")")" From 3b185e235e2a03c6368a4ca00d59a65c78b10d34 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Wed, 5 Dec 2018 01:59:51 -0800 Subject: [PATCH 07/10] builder: libvorbis fix libvorbis autogen.sh calls the version-suffixed autoconf/automake scripts, which ends up calling the wrong scripts, so remove the autogen.sh and reconfigure manually. --- tools/builder/core.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 8fda0c75..64688d17 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -255,6 +255,7 @@ DIST_CONFIGURE_TYPES="$DIST_CONFIGURE_TYPES glib autoreconf graphviz autoreconf docbook2x autoreconf + libvorbis autoreconf " DIST_RELOCATION_TYPES="$DIST_RELOCATION_TYPES @@ -292,6 +293,7 @@ DIST_PRE_BUILD="$DIST_PRE_BUILD ' Makefile; libx265 cd source; libsoxr rm -rf tests; mkdir tests; touch tests/CMakeLists.txt; + libvorbis rm -f autogen.sh; XML-SAX sed -i.bak 's/-MXML::SAX/-Mblib -MXML::SAX/' Makefile.PL; docbook2x sed -i.bak 's/^\\( *SUBDIRS *= *.*\\)doc\\(.*\\)\$/\1\2/' Makefile.am; \ sed -i.bak 's/^\\( *SUBDIRS *= *.*\\)documentation\\(.*\\)\$/\1\2/' xslt/Makefile.am; From f385fb2faf7d8f9e3fc876597cd6197aa7a1d170 Mon Sep 17 00:00:00 2001 From: Scott Knight <4534275+knightsc@users.noreply.github.com> Date: Wed, 28 Nov 2018 11:10:31 -0500 Subject: [PATCH 08/10] Update gdb remote query support The latest version of gdb from devkitpro expects slightly different response to some of the remote queries. For instance when sending back the current thread id there should be no space or dash between 'm' and the thread id. Additionally a handful of other common remote gdb query params were added to better support current versions of gdb --- src/gba/remote.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gba/remote.cpp b/src/gba/remote.cpp index 5679ac00..5c5a43b0 100644 --- a/src/gba/remote.cpp +++ b/src/gba/remote.cpp @@ -3700,17 +3700,24 @@ void remoteMemoryRead(char* p) void remoteQuery(char* p) { if (!strncmp(p, "fThreadInfo", 11)) { - remotePutPacket("m-1"); + remotePutPacket("m1"); } else if (!strncmp(p, "sThreadInfo", 11)) { remotePutPacket("l"); } else if (!strncmp(p, "Supported", 9)) { remotePutPacket("PacketSize=1000"); + } else if (!strncmp(p, "C", 1)) { + remotePutPacket("QC1"); + } else if (!strncmp(p, "Attached", 8)) { + remotePutPacket("1"); + } else if (!strncmp(p, "Symbol", 6)) { + remotePutPacket("OK"); } else if (!strncmp(p, "Rcmd,", 5)) { p += 5; std::string cmd = HexToString(p); dbgExecute(cmd); remotePutPacket("OK"); } else { + fprintf(stderr, "Unknown packet %s\n", --p); remotePutPacket(""); } } From 6ba3b7791decba0f5449f9dd1ca667cd78c527e7 Mon Sep 17 00:00:00 2001 From: Scott Knight <4534275+knightsc@users.noreply.github.com> Date: Wed, 28 Nov 2018 11:12:57 -0500 Subject: [PATCH 09/10] Set correct register number in gdb stop reply https://github.com/bminor/binutils-gdb/blob/master/gdb/features/arm/arm-core.xml According to the current arm register definition file in gdb the cpsr register is actually register number 25 and not 16. --- src/gba/remote.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gba/remote.cpp b/src/gba/remote.cpp index 5c5a43b0..7ba0d82a 100644 --- a/src/gba/remote.cpp +++ b/src/gba/remote.cpp @@ -3612,7 +3612,7 @@ void remoteSendStatus() s += 12; CPUUpdateCPSR(); v = reg[16].I; - sprintf(s, "10:%02x%02x%02x%02x;", (v & 255), + sprintf(s, "19:%02x%02x%02x%02x;", (v & 255), (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255); From a52eddb5b4a888dc5b88a2fae8357ddf9a43e195 Mon Sep 17 00:00:00 2001 From: Scott Knight <4534275+knightsc@users.noreply.github.com> Date: Wed, 28 Nov 2018 08:47:26 -0500 Subject: [PATCH 10/10] Handle debugger disconnect and reconnect properly When connecting the debugger the debugger variable was being set to true before setting up the dbgMain and other related function pointers. This caused the idle loop to attempt to call dbgMain which was still NULL. This change makes sure that debugger isn't set to true until all function pointers are set and that when disconnecting the remotePort variable is reset back to 0 so we can reconnect properly. --- src/wx/cmdevents.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index c722d8cb..828721b4 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -1968,7 +1968,6 @@ void MainFrame::GDBBreak() if (connected) { remotePort = gdbPort; - debugger = true; emulating = 1; dbgMain = remoteStubMain; dbgSignal = remoteStubSignal; @@ -1976,6 +1975,7 @@ void MainFrame::GDBBreak() cmd_enable &= ~(CMDEN_NGDB_ANY | CMDEN_NGDB_GBA); cmd_enable |= CMDEN_GDB; enable_menus(); + debugger = true; } else { remoteCleanUp(); } @@ -2004,6 +2004,7 @@ EVT_HANDLER_MASK(DebugGDBDisconnect, "Disconnect GDB", CMDEN_GDB) dbgMain = NULL; dbgSignal = NULL; dbgOutput = NULL; + remotePort = 0; remoteCleanUp(); cmd_enable &= ~CMDEN_GDB; cmd_enable |= CMDEN_NGDB_GBA | CMDEN_NGDB_ANY;