diff --git a/gnuboy-go/Makefile b/gnuboy-go/Makefile index d5aa9de4..6535b188 100644 --- a/gnuboy-go/Makefile +++ b/gnuboy-go/Makefile @@ -4,6 +4,8 @@ # PROJECT_NAME := gnuboy-go +PROJECT_VER := $(shell date "+%Y%m%d")-$(shell git rev-parse HEAD | cut -b 1-10) + EXTRA_COMPONENT_DIRS := ../components CPPFLAGS += -DENABLE_NETPLAY diff --git a/gnuboy-go/main/component.mk b/gnuboy-go/main/component.mk index 797a9ffb..48dadde1 100644 --- a/gnuboy-go/main/component.mk +++ b/gnuboy-go/main/component.mk @@ -6,7 +6,5 @@ # in the build directory. This behaviour is entirely configurable, # please read the ESP-IDF documents if you need to do this. # -COMPILEDATE:=\"$(shell date "+%Y%m%d")\" -GITREV:=\"$(shell git rev-parse HEAD | cut -b 1-10)\" -CFLAGS += -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" +CFLAGS += -O3 -DPROJECT_VER='"$(PROJECT_VER)"' diff --git a/gnuboy-go/main/main.c b/gnuboy-go/main/main.c index ba87c341..6b6d2328 100644 --- a/gnuboy-go/main/main.c +++ b/gnuboy-go/main/main.c @@ -234,7 +234,8 @@ static bool advanced_settings_cb(odroid_dialog_choice_t *option, odroid_dialog_e void app_main(void) { - printf("gnuboy-go (%s-%s).\n", COMPILEDATE, GITREV); + printf("\n========================================\n\n"); + printf("gnuboy-go (%s).\n", PROJECT_VER); // Init all the console hardware odroid_system_init(APP_ID, AUDIO_SAMPLE_RATE); diff --git a/handy-go/Makefile b/handy-go/Makefile index e24e2e5e..54f41a4b 100644 --- a/handy-go/Makefile +++ b/handy-go/Makefile @@ -4,6 +4,8 @@ # PROJECT_NAME := handy-go +PROJECT_VER := $(shell date "+%Y%m%d")-$(shell git rev-parse HEAD | cut -b 1-10) + EXTRA_COMPONENT_DIRS := ../components # CPPFLAGS += -DENABLE_NETPLAY diff --git a/handy-go/components/handy/cart.cpp b/handy-go/components/handy/cart.cpp index 18a730dc..7908c83b 100644 --- a/handy-go/components/handy/cart.cpp +++ b/handy-go/components/handy/cart.cpp @@ -53,7 +53,7 @@ #include "system.h" #include "cart.h" //#include "zlib.h" -#include "scrc32.h" +#include "rom/crc.h" CCart::CCart(UBYTE *gamedata,ULONG gamesize) { @@ -66,8 +66,7 @@ CCart::CCart(UBYTE *gamedata,ULONG gamesize) mCartRAM=FALSE; mHeaderLess=0; mEEPROMType=0; - mCRC32=0; - mCRC32=crc32(mCRC32,gamedata,gamesize); + mCRC32=crc32_le(0,gamedata,gamesize); // Open up the file @@ -121,7 +120,8 @@ CCart::CCart(UBYTE *gamedata,ULONG gamesize) // Set the filetypes - CTYPE banktype0,banktype1; + CTYPE banktype0 = UNUSED; + CTYPE banktype1 = UNUSED; switch(header.page_size_bank0) { case 0x000: @@ -222,7 +222,7 @@ CCart::CCart(UBYTE *gamedata,ULONG gamesize) memset(mCartBank1A, DEFAULT_CART_CONTENTS, bank1size); if(bank0size==1) bank0size=0;// workaround ... if(bank1size==1) bank1size=0;// workaround ... - + memcpy( mCartBank0, gamedata+(headersize), @@ -462,7 +462,7 @@ void CCart::Poke0A(UBYTE data) { if(mWriteEnableBank0) { ULONG address=(mShifter<>3)&0x0001); } break; case MIKIE_PIXEL_FORMAT_16BPP_565: for(Spot.Index=0;Spot.Index<4096;Spot.Index++) { - mColourMap[Spot.Index]=((Spot.Colours.Red<<12)&0xf000) | (Spot.Colours.Red<<8)&0x0800; + mColourMap[Spot.Index]=((Spot.Colours.Red<<12)&0xf000) | ((Spot.Colours.Red<<8)&0x0800); mColourMap[Spot.Index]|=((Spot.Colours.Green<<7)&0x0780) | ((Spot.Colours.Green<<3)&0x0060); mColourMap[Spot.Index]|=((Spot.Colours.Blue<<1)&0x001e) | ((Spot.Colours.Blue>>3)&0x0001); } @@ -1263,9 +1264,9 @@ ULONG CMikie::DisplayEndOfFrame(void) if(gCPUWakeupTime) { gCPUWakeupTime = 0; - ClearCPUSleep(); + ClearCPUSleep(); } - + // Set the timer status flag if(mTimerInterruptMask&0x04) { TRACE_MIKIE0("Update() - TIMER2 IRQ Triggered (Frame Timer)"); @@ -1311,8 +1312,8 @@ ULONG CMikie::DisplayEndOfFrame(void) break; } - mikbuf.end_frame((gSystemCycleCount - gAudioLastUpdateCycle) / 4); - gAudioBufferPointer = mikbuf.read_samples((blip_sample_t*) gAudioBuffer, HANDY_AUDIO_BUFFER_SIZE / 2) * 2; + // mikbuf.end_frame((gSystemCycleCount - gAudioLastUpdateCycle) / 4); + // gAudioBufferPointer = mikbuf.read_samples((blip_sample_t*) gAudioBuffer, HANDY_AUDIO_BUFFER_SIZE / 2) * 2; return 0; } @@ -2596,9 +2597,9 @@ UBYTE CMikie::Peek(ULONG addr) inline void CMikie::Update(void) { - SLONG divide; - SLONG decval; - ULONG tmp; + SLONG divide = 0; + SLONG decval = 0; + ULONG tmp = 0; ULONG mikie_work_done=0; // @@ -2880,8 +2881,8 @@ inline void CMikie::Update(void) if(!mUART_RX_COUNTDOWN) { // Fetch a byte from the input queue if(mUART_Rx_waiting>0) { - mUART_RX_DATA=mUART_Rx_input_queue[mUART_Rx_output_ptr]; - mUART_Rx_output_ptr=(++mUART_Rx_output_ptr)%UART_MAX_RX_QUEUE; + mUART_RX_DATA = mUART_Rx_input_queue[mUART_Rx_output_ptr++]; + mUART_Rx_output_ptr %= UART_MAX_RX_QUEUE; mUART_Rx_waiting--; TRACE_MIKIE2("Update() - RX Byte output ptr=%02d waiting=%02d",mUART_Rx_output_ptr,mUART_Rx_waiting); } else { @@ -3727,12 +3728,12 @@ inline void CMikie::UpdateSound(void) static int last_rsample = 0; if(cur_lsample != last_lsample) { - miksynth.offset_inline((gSystemCycleCount - gAudioLastUpdateCycle) / 4, cur_lsample - last_lsample, mikbuf.left()); + // miksynth.offset_inline((gSystemCycleCount - gAudioLastUpdateCycle) / 4, cur_lsample - last_lsample, mikbuf.left()); last_lsample = cur_lsample; } if(cur_rsample != last_rsample) { - miksynth.offset_inline((gSystemCycleCount - gAudioLastUpdateCycle) / 4, cur_rsample - last_rsample, mikbuf.right()); + // miksynth.offset_inline((gSystemCycleCount - gAudioLastUpdateCycle) / 4, cur_rsample - last_rsample, mikbuf.right()); last_rsample = cur_rsample; } } diff --git a/handy-go/components/handy/mikie.h b/handy-go/components/handy/mikie.h index 599191d8..b09e82a3 100644 --- a/handy-go/components/handy/mikie.h +++ b/handy-go/components/handy/mikie.h @@ -180,9 +180,9 @@ enum MIKIE_PIXEL_FORMAT_32BPP, }; -#include +// #include -typedef Blip_Synth Synth; +// typedef Blip_Synth Synth; class CMikie : public CLynxBase { @@ -190,8 +190,8 @@ class CMikie : public CLynxBase CMikie(CSystem& parent); ~CMikie(); - Synth miksynth; - Stereo_Buffer mikbuf; + // Synth miksynth; + // Stereo_Buffer mikbuf; bool ContextSave(LSS_FILE *fp); bool ContextLoad(LSS_FILE *fp); diff --git a/handy-go/components/handy/system.h b/handy-go/components/handy/system.h index 76e6afc1..85638248 100644 --- a/handy-go/components/handy/system.h +++ b/handy-go/components/handy/system.h @@ -46,8 +46,8 @@ #ifndef SYSTEM_H #define SYSTEM_H -#pragma inline_depth (255) -#pragma inline_recursion (on) +// #pragma inline_depth (255) +// #pragma inline_recursion (on) #ifdef _LYNXDBG diff --git a/handy-go/main/component.mk b/handy-go/main/component.mk index 797a9ffb..136a9093 100644 --- a/handy-go/main/component.mk +++ b/handy-go/main/component.mk @@ -6,7 +6,6 @@ # in the build directory. This behaviour is entirely configurable, # please read the ESP-IDF documents if you need to do this. # -COMPILEDATE:=\"$(shell date "+%Y%m%d")\" -GITREV:=\"$(shell git rev-parse HEAD | cut -b 1-10)\" -CFLAGS += -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" +CFLAGS += -DPROJECT_VER='"$(PROJECT_VER)"' -Wall -Wno-comment -Wno-error=comment +CXXFLAGS += -DPROJECT_VER='"$(PROJECT_VER)"' -Wall -Wno-comment -Wno-error=comment diff --git a/handy-go/main/main.c b/handy-go/main/main.cpp similarity index 56% rename from handy-go/main/main.c rename to handy-go/main/main.cpp index f3365b20..f662c54a 100644 --- a/handy-go/main/main.c +++ b/handy-go/main/main.cpp @@ -1,15 +1,19 @@ +extern "C" { #include #include #include #include #include +} -#include "handy.h" +#include #define APP_ID 50 #define AUDIO_SAMPLE_RATE 22050 +static CSystem *lynx = NULL; + // static bool netplay = false; // --- MAIN @@ -22,13 +26,21 @@ static bool save_state(char *pathName) static bool load_state(char *pathName) { + lynx->Reset(); return true; } -void app_main(void) +static UBYTE* lynx_display_callback(ULONG objref) { - printf("Handy-go (%s-%s).\n", COMPILEDATE, GITREV); + return 0; +} + + +extern "C" void app_main(void) +{ + printf("\n========================================\n\n"); + printf("Handy-go (%s).\n", PROJECT_VER); odroid_system_init(APP_ID, AUDIO_SAMPLE_RATE); odroid_system_emu_init(&load_state, &save_state, NULL); @@ -36,6 +48,14 @@ void app_main(void) char *romFile = odroid_system_get_path(ODROID_PATH_ROM_FILE); // Init emulator + lynx = new CSystem(romFile, "bios", true); + lynx->SetButtonData(0); + lynx->DisplaySetAttributes( + MIKIE_NO_ROTATE, + MIKIE_PIXEL_FORMAT_16BPP_565, + SCREEN_WIDTH * 2, + lynx_display_callback, + 0); if (odroid_system_get_start_action() == ODROID_START_ACTION_RESUME) { @@ -43,6 +63,10 @@ void app_main(void) } // Start emulation + while (1) + { + lynx->Update(); + } printf("Handy died.\n"); abort(); diff --git a/huexpress-go/Makefile b/huexpress-go/Makefile index e1194bdf..cfef2916 100644 --- a/huexpress-go/Makefile +++ b/huexpress-go/Makefile @@ -4,6 +4,8 @@ # PROJECT_NAME := huexpress-go +PROJECT_VER := $(shell date "+%Y%m%d")-$(shell git rev-parse HEAD | cut -b 1-10) + EXTRA_COMPONENT_DIRS := ../components include $(IDF_PATH)/make/project.mk diff --git a/huexpress-go/main/component.mk b/huexpress-go/main/component.mk index 6db73b67..798941d3 100644 --- a/huexpress-go/main/component.mk +++ b/huexpress-go/main/component.mk @@ -6,8 +6,6 @@ # in the build directory. This behaviour is entirely configurable, # please read the ESP-IDF documents if you need to do this. # -COMPILEDATE:=\"$(shell date "+%Y%m%d")\" -GITREV:=\"$(shell git rev-parse HEAD | cut -b 1-10)\" -CFLAGS += -Ofast -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" -CPPFLAGS += -Ofast -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" +CFLAGS += -Ofast -DPROJECT_VER='"$(PROJECT_VER)"' +CPPFLAGS += -Ofast -DPROJECT_VER='"$(PROJECT_VER)"' diff --git a/huexpress-go/main/main.c b/huexpress-go/main/main.c index 486797ae..165d7ebd 100644 --- a/huexpress-go/main/main.c +++ b/huexpress-go/main/main.c @@ -34,7 +34,8 @@ static bool load_state(char *pathName) void app_main(void) { - printf("HuExpress-go (%s-%s).\n", COMPILEDATE, GITREV); + printf("\n========================================\n\n"); + printf("HuExpress-go (%s).\n", PROJECT_VER); odroid_system_init(APP_ID, AUDIO_SAMPLE_RATE); odroid_system_emu_init(&load_state, &save_state, NULL); diff --git a/nofrendo-go/main/main.c b/nofrendo-go/main/main.c index a81a54d6..b397a066 100644 --- a/nofrendo-go/main/main.c +++ b/nofrendo-go/main/main.c @@ -164,7 +164,7 @@ static bool advanced_settings_cb(odroid_dialog_choice_t *option, odroid_dialog_e {1, "Region", "Auto", 1, ®ion_update_cb}, {2, "Overscan", "Auto", 1, &overscan_update_cb}, {3, "Sprite limit", "On ", 1, &sprite_limit_cb}, - {4, "Left column", "Normal/Black/Crop ", 1, &leftcol_update_cb}, + // {4, "Left column", "Normal/Black/Crop ", 1, &leftcol_update_cb}, // {4, "", "", 1, NULL}, //{0, "Reset all", "", 1, NULL}, ODROID_DIALOG_CHOICE_LAST diff --git a/retro-go/Makefile b/retro-go/Makefile index ce7bfd35..e2a50bd2 100644 --- a/retro-go/Makefile +++ b/retro-go/Makefile @@ -4,6 +4,8 @@ # PROJECT_NAME := retro-go +PROJECT_VER := $(shell date "+%Y%m%d")-$(shell git rev-parse HEAD | cut -b 1-10) + EXTRA_COMPONENT_DIRS := ../components include $(IDF_PATH)/make/project.mk diff --git a/retro-go/main/component.mk b/retro-go/main/component.mk index b0da52cb..0bdfbd42 100644 --- a/retro-go/main/component.mk +++ b/retro-go/main/component.mk @@ -8,4 +8,4 @@ # COMPILEDATE:=\"$(shell date "+%Y-%m-%d")\" GITREV:=\"$(shell git rev-parse HEAD | cut -b 1-10)\" -CFLAGS += -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" +CFLAGS += -DPROJECT_VER='"$(PROJECT_VER)"' -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" diff --git a/retro-go/main/main.c b/retro-go/main/main.c index 8088fe21..9b3dc737 100644 --- a/retro-go/main/main.c +++ b/retro-go/main/main.c @@ -279,7 +279,8 @@ void retro_loop() void app_main(void) { - printf("Retro-Go (%s-%s).\n", COMPILEDATE, GITREV); + printf("\n========================================\n\n"); + printf("Retro-Go (%s).\n", PROJECT_VER); odroid_system_init(0, 32000); odroid_display_clear(0); diff --git a/smsplusgx-go/Makefile b/smsplusgx-go/Makefile index b5917097..201b016c 100644 --- a/smsplusgx-go/Makefile +++ b/smsplusgx-go/Makefile @@ -4,6 +4,8 @@ # PROJECT_NAME := smsplusgx-go +PROJECT_VER := $(shell date "+%Y%m%d")-$(shell git rev-parse HEAD | cut -b 1-10) + EXTRA_COMPONENT_DIRS := ../components include $(IDF_PATH)/make/project.mk diff --git a/smsplusgx-go/main/component.mk b/smsplusgx-go/main/component.mk index 797a9ffb..6e32658a 100644 --- a/smsplusgx-go/main/component.mk +++ b/smsplusgx-go/main/component.mk @@ -6,7 +6,5 @@ # in the build directory. This behaviour is entirely configurable, # please read the ESP-IDF documents if you need to do this. # -COMPILEDATE:=\"$(shell date "+%Y%m%d")\" -GITREV:=\"$(shell git rev-parse HEAD | cut -b 1-10)\" -CFLAGS += -DCOMPILEDATE="$(COMPILEDATE)" -DGITREV="$(GITREV)" +CFLAGS += -DPROJECT_VER='"$(PROJECT_VER)"' diff --git a/smsplusgx-go/main/main.c b/smsplusgx-go/main/main.c index ed710a5b..fe3142cc 100644 --- a/smsplusgx-go/main/main.c +++ b/smsplusgx-go/main/main.c @@ -115,7 +115,8 @@ void system_manage_sram(uint8 *sram, int slot, int mode) void app_main(void) { - printf("SMSPlusGX-go (%s-%s).\n", COMPILEDATE, GITREV); + printf("\n========================================\n\n"); + printf("SMSPlusGX-go (%s).\n", PROJECT_VER); // Init all the console hardware odroid_system_init(APP_ID, AUDIO_SAMPLE_RATE);