From: Shamus Hammons Date: Mon, 9 Sep 2013 02:18:23 +0000 (-0500) Subject: Converted to SDL 2, added fullscreen toggle. X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0bc82a6324c65aefd62cc3eb33c09a14db638bf;p=apple2 Converted to SDL 2, added fullscreen toggle. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a11e4d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +apple2 +apple2.log +disks/ +gmon.out +obj/ diff --git a/Makefile b/Makefile index 5fc33bb..ba62de7 100755 --- a/Makefile +++ b/Makefile @@ -12,7 +12,6 @@ ifeq "$(OSTYPE)" "msys" # Win32 SYSTYPE = __GCCWIN32__ EXESUFFIX = .exe -GLLIB = -lopengl32 ICON = obj/icon.o SDLLIBTYPE = --libs MSG = Win32 on MinGW @@ -23,7 +22,6 @@ ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and SYSTYPE = __GCCUNIX__ -D_OSX_ EXESUFFIX = -GLLIB = ICON = SDLLIBTYPE = --static-libs MSG = Mac OS X @@ -32,7 +30,6 @@ else # *nix SYSTYPE = __GCCUNIX__ EXESUFFIX = -GLLIB = -lGL ICON = SDLLIBTYPE = --libs MSG = generic Unix/Linux @@ -45,28 +42,28 @@ LD = gcc TARGET = apple2 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2 -#CFLAGS = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl-config --cflags` +#CFLAGS = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl2-config --cflags` #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) \ # No optimization and w/gcov flags, so that we get an accurate picture from gcov #CFLAGS = -MMD -Wall -Wno-switch -D$(SYSTYPE) \ -# -ffast-math -fomit-frame-pointer `sdl-config --cflags` -fprofile-arcs -ftest-coverage +# -ffast-math -fomit-frame-pointer `sdl2-config --cflags` -fprofile-arcs -ftest-coverage #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \ -# -ffast-math -fomit-frame-pointer `sdl-config --cflags` -fprofile-arcs -ftest-coverage +# -ffast-math -fomit-frame-pointer `sdl2-config --cflags` -fprofile-arcs -ftest-coverage # No optimization for profiling with gprof... CFLAGS = -MMD -Wall -Wno-switch -D$(SYSTYPE) \ - -ffast-math `sdl-config --cflags` -pg -g + -ffast-math `sdl2-config --cflags` -pg -g CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \ - -ffast-math `sdl-config --cflags` -pg -g -# -fomit-frame-pointer `sdl-config --cflags` -g -# -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES + -ffast-math `sdl2-config --cflags` -pg -g +# -fomit-frame-pointer `sdl2-config --cflags` -g +# -fomit-frame-pointer `sdl2-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES LDFLAGS = -#LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) +#LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) # Link in the gcov library (for profiling purposes) -#LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lgcov +#LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lgcov # Link in the gprof lib -LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -pg +LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -pg INCS = -I. -I./src -I/usr/local/include -I/usr/include @@ -89,7 +86,6 @@ OBJS = \ obj/floppy.o \ obj/log.o \ obj/sdlemu_config.o \ - obj/sdlemu_opengl.o \ obj/settings.o \ obj/sound.o \ obj/timing.o \ @@ -107,11 +103,11 @@ all: checkenv message obj $(TARGET)$(EXESUFFIX) checkenv: @echo @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m" -ifeq "" "$(shell which sdl-config)" +ifeq "" "$(shell which sdl2-config)" @echo @echo - @echo -e "\033[01;33mIt seems that you don't have the SDL development libraries installed. - @echo -e "have installed them, make sure that the sdl-config file is somewhere in your" + @echo -e "\033[01;33mIt seems that you don't have the SDL 2 development libraries installed. + @echo -e "have installed them, make sure that the sdl2-config file is somewhere in your" @echo -e "path and is executable.\033[00m" @echo #Is there a better way to break out of the makefile? @@ -165,3 +161,4 @@ $(TARGET)$(EXESUFFIX): $(OBJS) # The "-" in front in there just in case they haven't been created yet -include obj/*.d + diff --git a/apple2.cfg b/apple2.cfg index 9e2b2c1..f843a17 100755 --- a/apple2.cfg +++ b/apple2.cfg @@ -21,7 +21,7 @@ autoSaveState = 1 #floppyImage1 = ./disks/temp.nib #floppyImage1 = ./disks/temp.dsk # Yes -floppyImage1 = ./disks/bt1_boot.dsk +#floppyImage1 = ./disks/bt1_boot.dsk # Yes #floppyImage1 = ./disks/bt2_boot.dsk # Yes (but segfaults in the timer routine in the title screen--NB: Not anymore...) @@ -50,7 +50,7 @@ floppyImage1 = ./disks/bt1_boot.dsk #floppyImage1 = ./disks/MoebiusIIA.dsk #floppyImage2 = ./disks/MoebiusIIB.dsk # Yes -#floppyImage1 = ./disks/wind_walker_1.dsk +floppyImage1 = ./disks/wind_walker_1.dsk # Yes #floppyImage1 = ./disks/dino_eggs.dsk # ??? 1, yes; 2, no diff --git a/src/apple2.cpp b/src/apple2.cpp index 976addc..0e65183 100755 --- a/src/apple2.cpp +++ b/src/apple2.cpp @@ -31,7 +31,7 @@ #include "apple2.h" -#include +#include #include #include #include @@ -64,36 +64,36 @@ // Global variables -uint8 ram[0x10000], rom[0x10000]; // RAM & ROM spaces -uint8 ram2[0x10000]; -uint8 diskRom[0x100]; // Disk ROM space +uint8_t ram[0x10000], rom[0x10000]; // RAM & ROM spaces +uint8_t ram2[0x10000]; +uint8_t diskRom[0x100]; // Disk ROM space V65C02REGS mainCPU; // v65C02 execution context -uint8 appleType = APPLE_TYPE_II; +uint8_t appleType = APPLE_TYPE_II; FloppyDrive floppyDrive; // Local variables -static uint8 lastKeyPressed = 0; +static uint8_t lastKeyPressed = 0; static bool keyDown = false; //static FloppyDrive floppyDrive; enum { LC_BANK_1, LC_BANK_2 }; -static uint8 visibleBank = LC_BANK_1; +static uint8_t visibleBank = LC_BANK_1; static bool readRAM = false; static bool writeRAM = false; static bool running = true; // Machine running state flag... -static uint32 startTicks; +static uint32_t startTicks; static GUI * gui = NULL; // Local functions (technically, they're global...) -bool LoadImg(char * filename, uint8 * ram, int size); -uint8 RdMem(uint16 addr); -void WrMem(uint16 addr, uint8 b); +bool LoadImg(char * filename, uint8_t * ram, int size); +uint8_t RdMem(uint16_t addr); +void WrMem(uint16_t addr, uint8_t b); static void SaveApple2State(const char * filename); static bool LoadApple2State(const char * filename); @@ -139,7 +139,7 @@ WriteLog("CPU: SDL_SemWait(mainSem);\n"); #endif SDL_SemWait(mainSem); - uint32 cycles = 17066; + uint32_t cycles = 17066; #ifdef CPU_THREAD_OVERFLOW_COMPENSATION // ODD! It's closer *without* this overflow compensation. ??? WHY ??? overflow += 0.666666667; @@ -241,9 +241,9 @@ $C0EE - Disk set read mode // V65C02 read/write memory functions // -uint8 RdMem(uint16 addr) +uint8_t RdMem(uint16_t addr) { - uint8 b; + uint8_t b; #if 0 if (addr >= 0xC000 && addr <= 0xC0FF) @@ -263,7 +263,7 @@ if (addr >= 0xC080 && addr <= 0xC08F) //This is bogus: keyDown is set to false, so return val NEVER is set... //Fixed... //Also, this is IIe/IIc only...! - uint8 retVal = lastKeyPressed | (keyDown ? 0x80 : 0x00); + uint8_t retVal = lastKeyPressed | (keyDown ? 0x80 : 0x00); keyDown = false; return retVal; } @@ -569,7 +569,7 @@ APPENDIX F Assembly Language Program Listings 13 DDRB2 EQU $C482 ;DATA DIRECTION REGISTER (B) 14 DDRA2 EQU $C483 ;DATA DIRECTION REGISTER (A) */ -void WrMem(uint16 addr, uint8 b) +void WrMem(uint16_t addr, uint8_t b) { //temp... //extern V6809REGS regs; @@ -839,7 +839,7 @@ if (addr >= 0xD000 && addr <= 0xD00F) // // Load a file into RAM/ROM image space // -bool LoadImg(char * filename, uint8 * ram, int size) +bool LoadImg(char * filename, uint8_t * ram, int size) { FILE * fp = fopen(filename, "rb"); @@ -862,9 +862,9 @@ static bool LoadApple2State(const char * filename) } #ifdef CPU_CLOCK_CHECKING -uint8 counter = 0; -uint32 totalCPU = 0; -uint64 lastClock = 0; +uint8_t counter = 0; +uint32_t totalCPU = 0; +uint64_t lastClock = 0; #endif // // Main loop @@ -961,10 +961,12 @@ memcpy(ram + 0xD000, ram + 0xC000, 0x1000); WriteLog("About to initialize audio...\n"); SoundInit(); - SDL_EnableUNICODE(1); // Needed to do key translation shit +//nope SDL_EnableUNICODE(1); // Needed to do key translation shit // gui = new GUI(surface); // Set up the GUI system object... - gui = new GUI(mainSurface); // Set up the GUI system object... +// gui = new GUI(mainSurface); // Set up the GUI system object... +// SDL 2... this will likely cause Apple 2 to crash +// gui = new GUI(NULL); // Set up the GUI system object... #if 0 gui->AddMenuTitle("Apple2"); gui->AddMenuItem("Test!", TestWindow/*, hotkey*/); @@ -983,7 +985,7 @@ memcpy(ram + 0xD000, ram + 0xC000, 0x1000); #ifdef THREADED_65C02 cpuCond = SDL_CreateCond(); - cpuThread = SDL_CreateThread(CPUThreadFunc, NULL); + cpuThread = SDL_CreateThread(CPUThreadFunc, NULL, NULL); //Hmm... CPU does POST (+1), wait, then WAIT (-1) mainSem = SDL_CreateSemaphore(1); // SDL_sem * mainMutex = SDL_CreateMutex(); @@ -1118,21 +1120,25 @@ static void FrameCallback(void) { switch (event.type) { - case SDL_KEYDOWN: - if (event.key.keysym.unicode != 0) - { + case SDL_TEXTINPUT: +// if (event.key.keysym.unicode != 0) +// { //Need to do some key translation here, and screen out non-apple keys as well... - if (event.key.keysym.sym == SDLK_TAB) // Prelim key screening... - break; - - lastKeyPressed = event.key.keysym.unicode; - keyDown = true; - //kludge: should have a caps lock thingy here... - //or all uppercase for ][+... - if (lastKeyPressed >= 'a' && lastKeyPressed <='z') - lastKeyPressed &= 0xDF; // Convert to upper case... - } +// if (event.key.keysym.sym == SDLK_TAB) // Prelim key screening... + if (event.edit.text[0] == '\t') // Prelim key screening... + break; + +// lastKeyPressed = event.key.keysym.unicode; + lastKeyPressed = event.edit.text[0]; + keyDown = true; + //kludge: should have a caps lock thingy here... + //or all uppercase for ][+... + if (lastKeyPressed >= 'a' && lastKeyPressed <='z') + lastKeyPressed &= 0xDF; // Convert to upper case... +// } + break; + case SDL_KEYDOWN: // CTRL+RESET key emulation (mapped to CTRL+`) // This doesn't work... // if (event.key.keysym.sym == SDLK_BREAK && (event.key.keysym.mod & KMOD_CTRL)) @@ -1146,12 +1152,14 @@ static void FrameCallback(void) lastKeyPressed = 0x15, keyDown = true; else if (event.key.keysym.sym == SDLK_LEFT) lastKeyPressed = 0x08, keyDown = true; + else if (event.key.keysym.sym == SDLK_RETURN) + lastKeyPressed = 0x0D, keyDown = true; // Use ALT+Q to exit, as well as the usual window decoration method if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod & KMOD_ALT)) running = false; - if (event.key.keysym.sym == SDLK_F12) + if (event.key.keysym.sym == SDLK_F11) dumpDis = !dumpDis; // Toggle the disassembly process // else if (event.key.keysym.sym == SDLK_F11) // floppyDrive.LoadImage("./disks/bt1_char.dsk");//Kludge to load char disk... @@ -1196,6 +1204,23 @@ else if (event.key.keysym.sym == SDLK_F10) SpawnMessage("Volume: %s", volStr); } + static bool fullscreenDebounce = false; + + if (event.key.keysym.sym == SDLK_F12) + { + if (!fullscreenDebounce) + { + ToggleFullScreen(); + fullscreenDebounce = true; + } + } +// else + + break; + case SDL_KEYUP: + if (event.key.keysym.sym == SDLK_F12) + fullscreenDebounce = false; + break; case SDL_QUIT: running = false; @@ -1211,10 +1236,10 @@ else if (event.key.keysym.sym == SDLK_F10) counter++; if (counter == 60) { - uint64 clock = GetCurrentV65C02Clock(); -//totalCPU += (uint32)(clock - lastClock); + uint64_t clock = GetCurrentV65C02Clock(); +//totalCPU += (uint32_t)(clock - lastClock); - printf("Executed %u cycles...\n", (uint32)(clock - lastClock)); + printf("Executed %u cycles...\n", (uint32_t)(clock - lastClock)); lastClock = clock; // totalCPU = 0; counter = 0; @@ -1254,7 +1279,7 @@ One way would be to use a fractional accumulator, then subtract 1 every time it overflows. Like so: double overflow = 0; -uint32 time = 20; +uint32_t time = 20; while (!done) { Execute6808(&soundCPU, time); diff --git a/src/apple2.h b/src/apple2.h index 65fae5c..958bb0b 100755 --- a/src/apple2.h +++ b/src/apple2.h @@ -2,13 +2,13 @@ // Apple 2 SDL Portable Apple Emulator // -#include "types.h" +#include #include "floppy.h" enum { APPLE_TYPE_II, APPLE_TYPE_IIE, APPLE_TYPE_IIC }; // Global variables (exported) -extern uint8 ram[0x10000], rom[0x10000]; // RAM & ROM pointers -extern uint8 appleType; +extern uint8_t ram[0x10000], rom[0x10000]; // RAM & ROM pointers +extern uint8_t appleType; extern FloppyDrive floppyDrive; diff --git a/src/applevideo.cpp b/src/applevideo.cpp index ba8a272..919776f 100755 --- a/src/applevideo.cpp +++ b/src/applevideo.cpp @@ -28,8 +28,9 @@ #include "applevideo.h" #include // for memset() +#include #include // for va_* stuff -#include // for vsprintf() +//#include // for vsprintf() #include "apple2.h" #include "video.h" #include "charset.h" @@ -72,11 +73,11 @@ bool alternateCharset; // Local variables // We set up the colors this way so that they'll be endian safe -// when we cast them to a uint32. Note that the format is RGBA. +// when we cast them to a uint32_t. Note that the format is RGBA. // "Master Color Values" palette -static uint8 colors[16 * 4] = { +static uint8_t colors[16 * 4] = { 0x00, 0x00, 0x00, 0xFF, // Black 0xDD, 0x00, 0x33, 0xFF, // Deep Red (Magenta) 0x00, 0x00, 0x99, 0xFF, // Dark Blue @@ -97,7 +98,7 @@ static uint8 colors[16 * 4] = { // This palette comes from ApplePC's colors (more realistic to my eye ;-) -static uint8 altColors[16 * 4] = { +static uint8_t altColors[16 * 4] = { 0x00, 0x00, 0x00, 0xFF, 0x7D, 0x20, 0x41, 0xFF, 0x41, 0x30, 0x7D, 0xFF, @@ -117,14 +118,14 @@ static uint8 altColors[16 * 4] = { // Lo-res starting line addresses -static uint16 lineAddrLoRes[24] = { +static uint16_t lineAddrLoRes[24] = { 0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780, 0x0428, 0x04A8, 0x0528, 0x05A8, 0x0628, 0x06A8, 0x0728, 0x07A8, 0x0450, 0x04D0, 0x0550, 0x05D0, 0x0650, 0x06D0, 0x0750, 0x07D0 }; // Hi-res starting line addresses -static uint16 lineAddrHiRes[192] = { +static uint16_t lineAddrHiRes[192] = { 0x2000, 0x2400, 0x2800, 0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00, 0x2080, 0x2480, 0x2880, 0x2C80, 0x3080, 0x3480, 0x3880, 0x3C80, 0x2100, 0x2500, 0x2900, 0x2D00, 0x3100, 0x3500, 0x3900, 0x3D00, @@ -155,7 +156,7 @@ static uint16 lineAddrHiRes[192] = { 0x2350, 0x2750, 0x2B50, 0x2F50, 0x3350, 0x3750, 0x3B50, 0x3F50, 0x23D0, 0x27D0, 0x2BD0, 0x2FD0, 0x33D0, 0x37D0, 0x3BD0, 0x3FD0 }; -uint16 appleHiresToMono[0x200] = { +uint16_t appleHiresToMono[0x200] = { 0x0000, 0x3000, 0x0C00, 0x3C00, 0x0300, 0x3300, 0x0F00, 0x3F00, 0x00C0, 0x30C0, 0x0CC0, 0x3CC0, 0x03C0, 0x33C0, 0x0FC0, 0x3FC0, // $0x 0x0030, 0x3030, 0x0C30, 0x3C30, 0x0330, 0x3330, 0x0F30, 0x3F30, @@ -225,18 +226,18 @@ uint16 appleHiresToMono[0x200] = { 0x207F, 0x387F, 0x267F, 0x3E7F, 0x21FF, 0x39FF, 0x27FF, 0x3FFF // $Fx }; -//static uint8 blurTable[0x800][8]; // Color TV blur table -static uint8 blurTable[0x80][8]; // Color TV blur table -static uint32 * palette = (uint32 *)altColors; +//static uint8_t blurTable[0x800][8]; // Color TV blur table +static uint8_t blurTable[0x80][8]; // Color TV blur table +static uint32_t * palette = (uint32_t *)altColors; enum { ST_FIRST_ENTRY = 0, ST_COLOR_TV = 0, ST_WHITE_MONO, ST_GREEN_MONO, ST_LAST_ENTRY }; -static uint8 screenType = ST_COLOR_TV; +static uint8_t screenType = ST_COLOR_TV; // Local functions -static void Render40ColumnTextLine(uint8 line); +static void Render40ColumnTextLine(uint8_t line); static void Render40ColumnText(void); -static void RenderLoRes(uint16 toLine = 24); -static void RenderHiRes(uint16 toLine = 192); +static void RenderLoRes(uint16_t toLine = 24); +static void RenderHiRes(uint16_t toLine = 192); void SetupBlurTable(void) @@ -247,26 +248,26 @@ void SetupBlurTable(void) // from 0-$7FF stepping by 16 does. Hm. // Well, it seems that going from 0-$7F doesn't have enough precision to do the job. #if 0 -// for(uint16 bitPat=0; bitPat<0x800; bitPat++) - for(uint16 bitPat=0; bitPat<0x80; bitPat++) +// for(uint16_t bitPat=0; bitPat<0x800; bitPat++) + for(uint16_t bitPat=0; bitPat<0x80; bitPat++) { -/* uint16 w3 = bitPat & 0x888; - uint16 w2 = bitPat & 0x444; - uint16 w1 = bitPat & 0x222; - uint16 w0 = bitPat & 0x111;*/ - uint16 w3 = bitPat & 0x88; - uint16 w2 = bitPat & 0x44; - uint16 w1 = bitPat & 0x22; - uint16 w0 = bitPat & 0x11; - - uint16 blurred3 = (w3 | (w3 >> 1) | (w3 >> 2) | (w3 >> 3)) & 0x00FF; - uint16 blurred2 = (w2 | (w2 >> 1) | (w2 >> 2) | (w2 >> 3)) & 0x00FF; - uint16 blurred1 = (w1 | (w1 >> 1) | (w1 >> 2) | (w1 >> 3)) & 0x00FF; - uint16 blurred0 = (w0 | (w0 >> 1) | (w0 >> 2) | (w0 >> 3)) & 0x00FF; - - for(int8 i=7; i>=0; i--) +/* uint16_t w3 = bitPat & 0x888; + uint16_t w2 = bitPat & 0x444; + uint16_t w1 = bitPat & 0x222; + uint16_t w0 = bitPat & 0x111;*/ + uint16_t w3 = bitPat & 0x88; + uint16_t w2 = bitPat & 0x44; + uint16_t w1 = bitPat & 0x22; + uint16_t w0 = bitPat & 0x11; + + uint16_t blurred3 = (w3 | (w3 >> 1) | (w3 >> 2) | (w3 >> 3)) & 0x00FF; + uint16_t blurred2 = (w2 | (w2 >> 1) | (w2 >> 2) | (w2 >> 3)) & 0x00FF; + uint16_t blurred1 = (w1 | (w1 >> 1) | (w1 >> 2) | (w1 >> 3)) & 0x00FF; + uint16_t blurred0 = (w0 | (w0 >> 1) | (w0 >> 2) | (w0 >> 3)) & 0x00FF; + + for(int8_t i=7; i>=0; i--) { - uint8 color = (((blurred0 >> i) & 0x01) << 3) + uint8_t color = (((blurred0 >> i) & 0x01) << 3) | (((blurred1 >> i) & 0x01) << 2) | (((blurred2 >> i) & 0x01) << 1) | ((blurred3 >> i) & 0x01); @@ -274,18 +275,18 @@ void SetupBlurTable(void) } } #else - for(uint16 bitPat=0; bitPat<0x800; bitPat+=0x10) + for(uint16_t bitPat=0; bitPat<0x800; bitPat+=0x10) { - uint16 w0 = bitPat & 0x111, w1 = bitPat & 0x222, w2 = bitPat & 0x444, w3 = bitPat & 0x888; + uint16_t w0 = bitPat & 0x111, w1 = bitPat & 0x222, w2 = bitPat & 0x444, w3 = bitPat & 0x888; - uint16 blurred0 = (w0 | (w0 >> 1) | (w0 >> 2) | (w0 >> 3)) & 0x00FF; - uint16 blurred1 = (w1 | (w1 >> 1) | (w1 >> 2) | (w1 >> 3)) & 0x00FF; - uint16 blurred2 = (w2 | (w2 >> 1) | (w2 >> 2) | (w2 >> 3)) & 0x00FF; - uint16 blurred3 = (w3 | (w3 >> 1) | (w3 >> 2) | (w3 >> 3)) & 0x00FF; + uint16_t blurred0 = (w0 | (w0 >> 1) | (w0 >> 2) | (w0 >> 3)) & 0x00FF; + uint16_t blurred1 = (w1 | (w1 >> 1) | (w1 >> 2) | (w1 >> 3)) & 0x00FF; + uint16_t blurred2 = (w2 | (w2 >> 1) | (w2 >> 2) | (w2 >> 3)) & 0x00FF; + uint16_t blurred3 = (w3 | (w3 >> 1) | (w3 >> 2) | (w3 >> 3)) & 0x00FF; - for(int8 i=7; i>=0; i--) + for(int8_t i=7; i>=0; i--) { - uint8 color = (((blurred0 >> i) & 0x01) << 3) + uint8_t color = (((blurred0 >> i) & 0x01) << 3) | (((blurred1 >> i) & 0x01) << 2) | (((blurred2 >> i) & 0x01) << 1) | ((blurred3 >> i) & 0x01); @@ -295,20 +296,22 @@ void SetupBlurTable(void) #endif } + void TogglePalette(void) { - if (palette == (uint32 *)colors) + if (palette == (uint32_t *)colors) { - palette = (uint32 *)altColors; + palette = (uint32_t *)altColors; SpawnMessage("Color TV palette"); } else { - palette = (uint32 *)colors; + palette = (uint32_t *)colors; SpawnMessage("\"Master Color Values\" palette"); } } + void CycleScreenTypes(void) { char scrTypeStr[3][40] = { "Color TV", "White monochrome", "Green monochrome" }; @@ -321,7 +324,8 @@ void CycleScreenTypes(void) SpawnMessage("%s", scrTypeStr[screenType]); } -static uint32 msgTicks = 0; + +static uint32_t msgTicks = 0; static char message[4096]; void SpawnMessage(const char * text, ...) @@ -335,62 +339,64 @@ void SpawnMessage(const char * text, ...) msgTicks = 120; } -static void DrawString2(uint32 x, uint32 y, uint32 color); + +static void DrawString2(uint32_t x, uint32_t y, uint32_t color); static void DrawString(void) { //This approach works, and seems to be fast enough... Though it probably would //be better to make the oversized font to match this one... - for(uint32 x=7; x<=9; x++) - for(uint32 y=7; y<=9; y++) + for(uint32_t x=7; x<=9; x++) + for(uint32_t y=7; y<=9; y++) DrawString2(x, y, 0x00000000); DrawString2(8, 8, 0x0020FF20); } -static void DrawString2(uint32 x, uint32 y, uint32 color) + +static void DrawString2(uint32_t x, uint32_t y, uint32_t color) { -//uint32 x = 8, y = 8; - uint32 length = strlen(message), address = x + (y * VIRTUAL_SCREEN_WIDTH); -// uint32 color = 0x0020FF20; +//uint32_t x = 8, y = 8; + uint32_t length = strlen(message), address = x + (y * VIRTUAL_SCREEN_WIDTH); +// uint32_t color = 0x0020FF20; //This could be done ahead of time, instead of on each pixel... //(Now it is!) - uint8 nBlue = (color >> 16) & 0xFF, nGreen = (color >> 8) & 0xFF, nRed = color & 0xFF; + uint8_t nBlue = (color >> 16) & 0xFF, nGreen = (color >> 8) & 0xFF, nRed = color & 0xFF; - for(uint32 i=0; i> 16) & 0xFF, + uint8_t eBlue = (existingColor >> 16) & 0xFF, eGreen = (existingColor >> 8) & 0xFF, eRed = existingColor & 0xFF; //This could be sped up by using a table of 5 + 5 + 5 bits (32 levels transparency -> 32768 entries) //Here we've modified it to have 33 levels of transparency (could have any # we want!) //because dividing by 32 is faster than dividing by 31...! - uint8 invTrans = 255 - trans; + uint8_t invTrans = 255 - trans; - uint32 bRed = (eRed * invTrans + nRed * trans) / 255; - uint32 bGreen = (eGreen * invTrans + nGreen * trans) / 255; - uint32 bBlue = (eBlue * invTrans + nBlue * trans) / 255; + uint32_t bRed = (eRed * invTrans + nRed * trans) / 255; + uint32_t bGreen = (eGreen * invTrans + nGreen * trans) / 255; + uint32_t bBlue = (eBlue * invTrans + nBlue * trans) / 255; //THIS IS NOT ENDIAN SAFE *(scrBuffer + address + xx + (yy * VIRTUAL_SCREEN_WIDTH)) = 0xFF000000 | (bBlue << 16) | (bGreen << 8) | bRed; @@ -402,13 +408,14 @@ static void DrawString2(uint32 x, uint32 y, uint32 color) } } -static void Render40ColumnTextLine(uint8 line) + +static void Render40ColumnTextLine(uint8_t line) { - uint32 pixelOn = (screenType == ST_GREEN_MONO ? 0xFF61FF61 : 0xFFFFFFFF); + uint32_t pixelOn = (screenType == ST_GREEN_MONO ? 0xFF61FF61 : 0xFFFFFFFF); for(int x=0; x<40; x++) { - uint8 chr = ram[lineAddrLoRes[line] + (displayPage2 ? 0x0400 : 0x0000) + x]; + uint8_t chr = ram[lineAddrLoRes[line] + (displayPage2 ? 0x0400 : 0x0000) + x]; // Render character at (x, y) @@ -416,7 +423,7 @@ static void Render40ColumnTextLine(uint8 line) { for(int cx=0; cx<7; cx++) { - uint32 pixel = 0xFF000000; + uint32_t pixel = 0xFF000000; if (!alternateCharset) { @@ -455,13 +462,15 @@ static void Render40ColumnTextLine(uint8 line) } } + static void Render40ColumnText(void) { - for(uint8 line=0; line<24; line++) + for(uint8_t line=0; line<24; line++) Render40ColumnTextLine(line); } -static void RenderLoRes(uint16 toLine/*= 24*/) + +static void RenderLoRes(uint16_t toLine/*= 24*/) { // NOTE: The green mono rendering doesn't skip every other line... !!! FIX !!! // Also, we could set up three different Render functions depending on which @@ -488,18 +497,18 @@ fb 9e be -> 11 [1101] -> 11? PINK be ae fb -> 7 [1110] -> 7? LIGHT BLUE (CYAN) fb fb fb -> 15 [1111] -> 15 WHITE */ - uint8 mirrorNybble[16] = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; + uint8_t mirrorNybble[16] = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; //This is the old "perfect monitor" rendering code... /* if (screenType != ST_COLOR_TV) // Not correct, but for now... //if (1) { - for(uint16 y=0; y 15 [1111] -> 15 WHITE } else//*/ - uint32 pixelOn = (screenType == ST_WHITE_MONO ? 0xFFFFFFFF : 0xFF61FF61); + uint32_t pixelOn = (screenType == ST_WHITE_MONO ? 0xFFFFFFFF : 0xFF61FF61); - for(uint16 y=0; y 15 [1111] -> 15 WHITE if (screenType == ST_COLOR_TV) { - for(uint8 i=0; i<7; i++) + for(uint8_t i=0; i<7; i++) { - uint8 bitPat = (pixels & 0x7F000000) >> 24; + uint8_t bitPat = (pixels & 0x7F000000) >> 24; pixels <<= 4; - for(uint8 j=0; j<4; j++) + for(uint8_t j=0; j<4; j++) { - uint8 color = blurTable[bitPat][j]; + uint8_t color = blurTable[bitPat][j]; - for(uint32 cy=0; cy<8; cy++) + for(uint32_t cy=0; cy<8; cy++) { scrBuffer[((x * 14) + (i * 4) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = palette[color]; // scrBuffer[((x * 14) + (i * 4) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = palette[color]; @@ -563,7 +572,7 @@ fb fb fb -> 15 [1111] -> 15 WHITE { for(int j=0; j<28; j++) { - for(uint32 cy=0; cy<8; cy++) + for(uint32_t cy=0; cy<8; cy++) { scrBuffer[((x * 14) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = (pixels & 0x08000000 ? pixelOn : 0xFF000000); // scrBuffer[((x * 14) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = (pixels & 0x08000000 ? pixelOn : 0xFF000000); @@ -578,14 +587,14 @@ fb fb fb -> 15 [1111] -> 15 WHITE previous3Bits = 0; - for(uint16 x=0; x<40; x+=2) + for(uint16_t x=0; x<40; x+=2) { - uint8 scrByte1 = ram[lineAddrLoRes[y] + (displayPage2 ? 0x0400 : 0x0000) + x + 0] >> 4; - uint8 scrByte2 = ram[lineAddrLoRes[y] + (displayPage2 ? 0x0400 : 0x0000) + x + 1] >> 4; + uint8_t scrByte1 = ram[lineAddrLoRes[y] + (displayPage2 ? 0x0400 : 0x0000) + x + 0] >> 4; + uint8_t scrByte2 = ram[lineAddrLoRes[y] + (displayPage2 ? 0x0400 : 0x0000) + x + 1] >> 4; scrByte1 = mirrorNybble[scrByte1]; scrByte2 = mirrorNybble[scrByte2]; // This is just a guess, but it'll have to do for now... - uint32 pixels = previous3Bits | (scrByte1 << 24) | (scrByte1 << 20) | (scrByte1 << 16) + uint32_t pixels = previous3Bits | (scrByte1 << 24) | (scrByte1 << 20) | (scrByte1 << 16) | ((scrByte1 & 0x0C) << 12) | ((scrByte2 & 0x03) << 12) | (scrByte2 << 8) | (scrByte2 << 4) | scrByte2; @@ -595,16 +604,16 @@ fb fb fb -> 15 [1111] -> 15 WHITE if (screenType == ST_COLOR_TV) { - for(uint8 i=0; i<7; i++) + for(uint8_t i=0; i<7; i++) { - uint8 bitPat = (pixels & 0x7F000000) >> 24; + uint8_t bitPat = (pixels & 0x7F000000) >> 24; pixels <<= 4; - for(uint8 j=0; j<4; j++) + for(uint8_t j=0; j<4; j++) { - uint8 color = blurTable[bitPat][j]; + uint8_t color = blurTable[bitPat][j]; - for(uint32 cy=8; cy<16; cy++) + for(uint32_t cy=8; cy<16; cy++) { scrBuffer[((x * 14) + (i * 4) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = palette[color]; // scrBuffer[((x * 14) + (i * 4) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = palette[color]; @@ -618,7 +627,7 @@ fb fb fb -> 15 [1111] -> 15 WHITE { for(int j=0; j<28; j++) { - for(uint32 cy=8; cy<16; cy++) + for(uint32_t cy=8; cy<16; cy++) { scrBuffer[((x * 14) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = (pixels & 0x08000000 ? pixelOn : 0xFF000000); // scrBuffer[((x * 14) + j) + (((y * 16) + cy) * VIRTUAL_SCREEN_WIDTH)] = (pixels & 0x08000000 ? pixelOn : 0xFF000000); @@ -631,32 +640,33 @@ fb fb fb -> 15 [1111] -> 15 WHITE } } -static void RenderHiRes(uint16 toLine/*= 192*/) + +static void RenderHiRes(uint16_t toLine/*= 192*/) { // NOTE: Not endian safe. !!! FIX !!! [DONE] #if 0 - uint32 pixelOn = (screenType == ST_WHITE_MONO ? 0xFFFFFFFF : 0xFF61FF61); + uint32_t pixelOn = (screenType == ST_WHITE_MONO ? 0xFFFFFFFF : 0xFF61FF61); #else // Now it is. Now roll this fix into all the other places... !!! FIX !!! // The colors are set in the 8-bit array as R G B A - uint8 monoColors[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x61, 0xFF, 0x61, 0xFF }; - uint32 * colorPtr = (uint32 *)monoColors; - uint32 pixelOn = (screenType == ST_WHITE_MONO ? colorPtr[0] : colorPtr[1]); + uint8_t monoColors[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x61, 0xFF, 0x61, 0xFF }; + uint32_t * colorPtr = (uint32_t *)monoColors; + uint32_t pixelOn = (screenType == ST_WHITE_MONO ? colorPtr[0] : colorPtr[1]); #endif - for(uint16 y=0; y> 24; + uint8_t bitPat = (pixels & 0x7F000000) >> 24; pixels <<= 4; - for(uint8 j=0; j<4; j++) + for(uint8_t j=0; j<4; j++) { - uint8 color = blurTable[bitPat][j]; + uint8_t color = blurTable[bitPat][j]; #if 0 //This doesn't seem to make things go any faster... //It's the OpenGL render that's faster... Hmm... @@ -705,6 +715,7 @@ static void RenderHiRes(uint16 toLine/*= 192*/) } } + void RenderVideoFrame(void) { //temp... @@ -755,3 +766,4 @@ return;//*/ RenderScreenBuffer(); } + diff --git a/src/ay8910.cpp b/src/ay8910.cpp index a3ae361..3e5df25 100755 --- a/src/ay8910.cpp +++ b/src/ay8910.cpp @@ -292,10 +292,10 @@ void _AYWriteReg(int n, int r, int v) // /length/ is the number of samples we require // NB. This should be called at twice the 6522 IRQ rate or (eg) 60Hz if no IRQ. -void AY8910Update(int chip, int16 ** buffer, int length) // [TC: Removed static] +void AY8910Update(int chip, int16_t ** buffer, int length) // [TC: Removed static] { struct AY8910 * PSG = &AYPSG[chip]; - int16 * buf1, * buf2, * buf3; + int16_t * buf1, * buf2, * buf3; int outn; buf1 = buffer[0]; @@ -726,7 +726,7 @@ void AY8910_InitClock(int clock) AY8910_set_clock(chip, clock); } -uint8 * AY8910_GetRegsPtr(uint16 chipNum) +uint8_t * AY8910_GetRegsPtr(uint16_t chipNum) { if (chipNum >= MAX_8910) return NULL; diff --git a/src/ay8910.h b/src/ay8910.h index 449e8c3..6eb733a 100755 --- a/src/ay8910.h +++ b/src/ay8910.h @@ -1,16 +1,16 @@ #ifndef AY8910_H #define AY8910_H -#include "types.h" +#include #define MAX_8910 4 void _AYWriteReg(int n, int r, int v); void AY8910_reset(int chip); -void AY8910Update(int chip, int16 ** buffer, int length); +void AY8910Update(int chip, int16_t ** buffer, int length); void AY8910_InitAll(int clock, int sampleRate); void AY8910_InitClock(int clock); -uint8 * AY8910_GetRegsPtr(uint16 chipNum); +uint8_t * AY8910_GetRegsPtr(uint16_t chipNum); #endif diff --git a/src/dis65c02.cpp b/src/dis65c02.cpp index f8052e2..4a7eac6 100755 --- a/src/dis65c02.cpp +++ b/src/dis65c02.cpp @@ -20,7 +20,7 @@ extern V65C02REGS mainCPU;//Hm. Shouldn't we pass this shit in? ANSWER: YES. !!! // Private globals variables -static uint8 op_mat[256] = { +static uint8_t op_mat[256] = { 14, 6, 0, 0, 2, 2, 2, 2, 14, 1, 14, 0, 8, 8, 8, 13, 13, 7, 5, 0, 2, 3, 3, 2, 14, 10, 14, 0, 8, 9, 9, 13, 8, 6, 0, 0, 2, 2, 2, 2, 14, 1, 14, 0, 8, 8, 8, 13, @@ -38,7 +38,7 @@ static uint8 op_mat[256] = { 1, 6, 0, 0, 2, 2, 2, 2, 14, 1, 14, 0, 8, 8, 8, 13, 13, 7, 5, 0, 0, 3, 3, 2, 14, 10, 14, 0, 0, 9, 9, 13 }; -static uint8 mnemonics[256][6] = { +static uint8_t mnemonics[256][6] = { "BRK ","ORA ","??? ","??? ","TSB ","ORA ","ASL ","RMB0 ", "PHP ","ORA ","ASL ","??? ","TSB ","ORA ","ASL ","BBR0 ", "BPL ","ORA ","ORA ","??? ","TRB ","ORA ","ASL ","RMB1 ", @@ -75,15 +75,15 @@ static uint8 mnemonics[256][6] = { // // Display bytes in mem in hex // -static void DisplayBytes(uint16 src, uint32 dst) +static void DisplayBytes(uint16_t src, uint32_t dst) { WriteLog("%04X: ", src); - uint8 cnt = 0; // Init counter... + uint8_t cnt = 0; // Init counter... if (src > dst) dst += 0x10000; // That should fix the FFFF bug... - for(uint32 i=src; i -int Decode65C02(uint16 pc); +int Decode65C02(uint16_t pc); #endif // __DIS65C02_H__ diff --git a/src/fd-img-128x128.c b/src/fd-img-128x128.c index b1cd0a7..80b9ffb 100755 --- a/src/fd-img-128x128.c +++ b/src/fd-img-128x128.c @@ -1,6 +1,6 @@ /* GIMP RGBA C-Source image dump (fd-img-128x128.c) */ -uint8 floppyDiskImg[] = { +uint8_t floppyDiskImg[] = { // 128 / 256, 128 % 256, // width (HI byte, LO byte) // 128 / 256, 128 % 256, // height (HI byte, LO byte) "\000\200\000\200" // Same thing as above, just in octal... :-P diff --git a/src/floppy.cpp b/src/floppy.cpp index 8109604..193e5cb 100755 --- a/src/floppy.cpp +++ b/src/floppy.cpp @@ -29,13 +29,13 @@ enum { IO_MODE_READ, IO_MODE_WRITE }; // FloppyDrive class variable initialization -uint8 FloppyDrive::header[21] = { +uint8_t FloppyDrive::header[21] = { 0xD5, 0xAA, 0x96, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xD5, 0xAA, 0xAD }; -uint8 FloppyDrive::doSector[16] = { +uint8_t FloppyDrive::doSector[16] = { 0x0, 0x7, 0xE, 0x6, 0xD, 0x5, 0xC, 0x4, 0xB, 0x3, 0xA, 0x2, 0x9, 0x1, 0x8, 0xF }; -uint8 FloppyDrive::poSector[16] = { +uint8_t FloppyDrive::poSector[16] = { 0x0, 0x8, 0x1, 0x9, 0x2, 0xA, 0x3, 0xB, 0x4, 0xC, 0x5, 0xD, 0x6, 0xE, 0x7, 0xF }; char FloppyDrive::nameBuf[MAX_PATH]; @@ -60,7 +60,7 @@ FloppyDrive::~FloppyDrive() delete[] disk[1]; } -bool FloppyDrive::LoadImage(const char * filename, uint8 driveNum/*= 0*/) +bool FloppyDrive::LoadImage(const char * filename, uint8_t driveNum/*= 0*/) { WriteLog("FLOPPY: Attempting to load image '%s' in drive #%u.\n", filename, driveNum); @@ -86,7 +86,7 @@ bool FloppyDrive::LoadImage(const char * filename, uint8 driveNum/*= 0*/) fseek(fp, 0, SEEK_END); diskSize[driveNum] = ftell(fp); fseek(fp, 0, SEEK_SET); - disk[driveNum] = new uint8[diskSize[driveNum]]; + disk[driveNum] = new uint8_t[diskSize[driveNum]]; fread(disk[driveNum], 1, diskSize[driveNum], fp); fclose(fp); @@ -112,7 +112,7 @@ bool FloppyDrive::LoadImage(const char * filename, uint8 driveNum/*= 0*/) return true; } -bool FloppyDrive::SaveImage(uint8 driveNum/*= 0*/) +bool FloppyDrive::SaveImage(uint8_t driveNum/*= 0*/) { if (driveNum > 1) { @@ -153,7 +153,7 @@ bool FloppyDrive::SaveImage(uint8 driveNum/*= 0*/) return true; } -bool FloppyDrive::SaveImageAs(const char * filename, uint8 driveNum/*= 0*/) +bool FloppyDrive::SaveImageAs(const char * filename, uint8_t driveNum/*= 0*/) { //WARNING: Buffer overflow possibility #warning "Buffer overflow possible--!!! FIX !!!" @@ -161,12 +161,12 @@ bool FloppyDrive::SaveImageAs(const char * filename, uint8 driveNum/*= 0*/) return SaveImage(driveNum); } -void FloppyDrive::CreateBlankImage(uint8 driveNum/*= 0*/) +void FloppyDrive::CreateBlankImage(uint8_t driveNum/*= 0*/) { if (disk[driveNum] != NULL) delete disk[driveNum]; - disk[driveNum] = new uint8[143360]; + disk[driveNum] = new uint8_t[143360]; diskSize[driveNum] = 143360; memset(disk[driveNum], 0x00, 143360); memset(nybblizedImage[driveNum], 0x00, 232960); // Set it to 0 instead of $FF for proper formatting... @@ -178,7 +178,7 @@ SpawnMessage("New blank image inserted in drive %u...", driveNum); void FloppyDrive::SwapImages(void) { - uint8 nybblizedImageTmp[232960]; + uint8_t nybblizedImageTmp[232960]; char imageNameTmp[MAX_PATH]; memcpy(nybblizedImageTmp, nybblizedImage[0], 232960); @@ -189,29 +189,29 @@ void FloppyDrive::SwapImages(void) memcpy(imageName[0], imageName[1], MAX_PATH); memcpy(imageName[1], imageNameTmp, MAX_PATH); - uint8 * diskTmp = disk[0]; + uint8_t * diskTmp = disk[0]; disk[0] = disk[1]; disk[1] = diskTmp; - uint32 diskSizeTmp = diskSize[0]; + uint32_t diskSizeTmp = diskSize[0]; diskSize[0] = diskSize[1]; diskSize[1] = diskSizeTmp; - uint8 diskTypeTmp = diskType[0]; + uint8_t diskTypeTmp = diskType[0]; diskType[0] = diskType[1]; diskType[1] = diskTypeTmp; - uint8 imageDirtyTmp = imageDirty[0]; + uint8_t imageDirtyTmp = imageDirty[0]; imageDirty[0] = imageDirty[1]; imageDirty[1] = imageDirtyTmp; - uint8 writeProtectedTmp = writeProtected[0]; + uint8_t writeProtectedTmp = writeProtected[0]; writeProtected[0] = writeProtected[1]; writeProtected[1] = writeProtectedTmp; SpawnMessage("Drive 0: %s...", imageName[0]); } -void FloppyDrive::DetectImageType(const char * filename, uint8 driveNum) +void FloppyDrive::DetectImageType(const char * filename, uint8_t driveNum) { diskType[driveNum] = DT_UNKNOWN; @@ -268,7 +268,7 @@ WriteLog("FLOPPY: Detected image type %s...\n", (diskType[driveNum] == DT_NYBBLE "DOS 3.3 image" : (diskType[driveNum] == DT_PRODOS ? "ProDOS image" : "unknown")))); } -void FloppyDrive::NybblizeImage(uint8 driveNum) +void FloppyDrive::NybblizeImage(uint8_t driveNum) { // Format of a sector is header (23) + nybbles (343) + footer (30) = 396 // (short by 20 bytes of 416 [413 if 48 byte header is one time only]) @@ -277,7 +277,7 @@ void FloppyDrive::NybblizeImage(uint8 driveNum) // hdr (21) + nybbles (343) + footer (48) = 412 bytes per sector // (not incl. 64 byte track marker) - uint8 footer[48] = { + uint8_t footer[48] = { 0xDE, 0xAA, 0xEB, 0xFF, 0xEB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -285,7 +285,7 @@ void FloppyDrive::NybblizeImage(uint8 driveNum) 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - uint8 diskbyte[0x40] = { + uint8_t diskbyte[0x40] = { 0x96, 0x97, 0x9A, 0x9B, 0x9D, 0x9E, 0x9F, 0xA6, 0xA7, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB9, 0xBA, 0xBB, 0xBC, @@ -295,15 +295,15 @@ void FloppyDrive::NybblizeImage(uint8 driveNum) 0xED, 0xEE, 0xEF, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF }; - uint8 * img = nybblizedImage[driveNum]; + uint8_t * img = nybblizedImage[driveNum]; memset(img, 0xFF, 232960); // Doesn't matter if 00s or FFs... - for(uint8 trk=0; trk<35; trk++) + for(uint8_t trk=0; trk<35; trk++) { memset(img, 0xFF, 64); // Write gap 1, 64 bytes (self-sync) img += 64; - for(uint8 sector=0; sector<16; sector++) + for(uint8_t sector=0; sector<16; sector++) { memcpy(img, header, 21); // Set up the sector header @@ -315,7 +315,7 @@ void FloppyDrive::NybblizeImage(uint8 driveNum) img[10] = ((trk ^ sector ^ 0xFE) & 0x55) | 0xAA; img += 21; - uint8 * bytes = disk[driveNum]; + uint8_t * bytes = disk[driveNum]; if (diskType[driveNum] == DT_DOS33) bytes += (doSector[sector] * 256) + (trk * 256 * 16); @@ -326,7 +326,7 @@ void FloppyDrive::NybblizeImage(uint8 driveNum) // Convert the 256 8-bit bytes into 342 6-bit bytes. - for(uint16 i=0; i<0x56; i++) + for(uint16_t i=0; i<0x56; i++) { img[i] = ((bytes[(i + 0xAC) & 0xFF] & 0x01) << 7) | ((bytes[(i + 0xAC) & 0xFF] & 0x02) << 5) @@ -345,12 +345,12 @@ void FloppyDrive::NybblizeImage(uint8 driveNum) img[342] = 0x00; - for(uint16 i=342; i>0; i--) + for(uint16_t i=342; i>0; i--) img[i] = img[i] ^ img[i - 1]; // Using a lookup table, convert the 6-bit bytes into disk bytes. - for(uint16 i=0; i<343; i++) + for(uint16_t i=0; i<343; i++) //#define TEST_NYBBLIZATION #ifdef TEST_NYBBLIZATION { @@ -371,9 +371,9 @@ WriteLog("FL: i = %u, img[i] = %02X, diskbyte = %02X\n", i, img[i], diskbyte[img } } -void FloppyDrive::DenybblizeImage(uint8 driveNum) +void FloppyDrive::DenybblizeImage(uint8_t driveNum) { - uint8 decodeNybble[0x80] = { + uint8_t decodeNybble[0x80] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, @@ -399,19 +399,19 @@ void FloppyDrive::DenybblizeImage(uint8 driveNum) return; } - uint8 * srcImg = nybblizedImage[driveNum]; - uint8 * dstImg = disk[driveNum]; - uint8 buffer[345]; // 2 extra bytes for the unpack routine below... + uint8_t * srcImg = nybblizedImage[driveNum]; + uint8_t * dstImg = disk[driveNum]; + uint8_t buffer[345]; // 2 extra bytes for the unpack routine below... - for(uint8 trk=0; trk<35; trk++) + for(uint8_t trk=0; trk<35; trk++) { - uint8 * trackBase = srcImg + (trk * 6656); + uint8_t * trackBase = srcImg + (trk * 6656); - for(uint8 sector=0; sector<16; sector++) + for(uint8_t sector=0; sector<16; sector++) { - uint16 sectorStart = (uint16)-1; + uint16_t sectorStart = (uint16_t)-1; - for(uint16 i=0; i<6656; i++) + for(uint16_t i=0; i<6656; i++) { if (trackBase[i] == header[0] && trackBase[(i + 1) % 6656] == header[1] @@ -420,7 +420,7 @@ void FloppyDrive::DenybblizeImage(uint8 driveNum) && trackBase[(i + 4) % 6656] == header[4]) { //Could also check the track # at +5,6... - uint8 foundSector = ((trackBase[(i + 7) % 6656] & 0x55) << 1) + uint8_t foundSector = ((trackBase[(i + 7) % 6656] & 0x55) << 1) | (trackBase[(i + 8) % 6656] & 0x55); if (foundSector == sector) @@ -432,7 +432,7 @@ void FloppyDrive::DenybblizeImage(uint8 driveNum) } // Sanity check... - if (sectorStart == (uint16)-1) + if (sectorStart == (uint16_t)-1) { WriteLog("FLOPPY: Failed to find sector %u (track %u) in nybble image!\n", sector, trk); @@ -441,24 +441,24 @@ void FloppyDrive::DenybblizeImage(uint8 driveNum) // Using a lookup table, convert the disk bytes into 6-bit bytes. - for(uint16 i=0; i<343; i++) + for(uint16_t i=0; i<343; i++) buffer[i] = decodeNybble[trackBase[(sectorStart + i) % 6656] & 0x7F]; // XOR the data block with itself, offset by one byte. - for(uint16 i=1; i<342; i++) + for(uint16_t i=1; i<342; i++) buffer[i] = buffer[i] ^ buffer[i - 1]; // Convert the 342 6-bit bytes into 256 8-bit bytes (at buffer + $56). - for(uint16 i=0; i<0x56; i++) + for(uint16_t i=0; i<0x56; i++) { buffer[0x056 + i] |= ((buffer[i] >> 3) & 0x01) | ((buffer[i] >> 1) & 0x02); buffer[0x0AC + i] |= ((buffer[i] >> 5) & 0x01) | ((buffer[i] >> 3) & 0x02); buffer[0x102 + i] |= ((buffer[i] >> 7) & 0x01) | ((buffer[i] >> 5) & 0x02); } - uint8 * bytes = dstImg; + uint8_t * bytes = dstImg; if (diskType[driveNum] == DT_DOS33) bytes += (doSector[sector] * 256) + (trk * 256 * 16); @@ -472,7 +472,7 @@ void FloppyDrive::DenybblizeImage(uint8 driveNum) } } -const char * FloppyDrive::GetImageName(uint8 driveNum/*= 0*/) +const char * FloppyDrive::GetImageName(uint8_t driveNum/*= 0*/) { // Set up a zero-length string for return value nameBuf[0] = 0; @@ -508,7 +508,7 @@ const char * FloppyDrive::GetImageName(uint8 driveNum/*= 0*/) return nameBuf; } -void FloppyDrive::EjectImage(uint8 driveNum/*= 0*/) +void FloppyDrive::EjectImage(uint8_t driveNum/*= 0*/) { // Probably want to save a dirty image... ;-) SaveImage(driveNum); @@ -527,7 +527,7 @@ void FloppyDrive::EjectImage(uint8 driveNum/*= 0*/) memset(nybblizedImage[driveNum], 0xFF, 232960); // Doesn't matter if 00s or FFs... } -bool FloppyDrive::DriveIsEmpty(uint8 driveNum/*= 0*/) +bool FloppyDrive::DriveIsEmpty(uint8_t driveNum/*= 0*/) { if (driveNum > 1) { @@ -539,7 +539,7 @@ bool FloppyDrive::DriveIsEmpty(uint8 driveNum/*= 0*/) return (imageName[driveNum][0] == 0 ? true : false); } -bool FloppyDrive::DiskIsWriteProtected(uint8 driveNum/*= 0*/) +bool FloppyDrive::DiskIsWriteProtected(uint8_t driveNum/*= 0*/) { if (driveNum > 1) { @@ -550,7 +550,7 @@ bool FloppyDrive::DiskIsWriteProtected(uint8 driveNum/*= 0*/) return writeProtected[driveNum]; } -void FloppyDrive::SetWriteProtect(bool state, uint8 driveNum/*= 0*/) +void FloppyDrive::SetWriteProtect(bool state, uint8_t driveNum/*= 0*/) { if (driveNum > 1) { @@ -575,7 +575,7 @@ also more versatile and can represent the older 13-sector disks, many copy-prote other unusual encodings. */ -void FloppyDrive::ControlStepper(uint8 addr) +void FloppyDrive::ControlStepper(uint8_t addr) { // $C0E0 - 7 /* @@ -585,7 +585,7 @@ bit 0 is the "do something" bit. */ if (addr & 0x01) { - uint8 newPhase = (addr >> 1) & 0x03; + uint8_t newPhase = (addr >> 1) & 0x03; //WriteLog("*** Stepper change [%u]: track = %u, phase = %u, newPhase = %u\n", addr, track, phase, newPhase); if (((phase + 1) & 0x03) == newPhase) @@ -606,19 +606,19 @@ SpawnMessage("Stepping to track %u...", track); // return something if read mode... } -void FloppyDrive::ControlMotor(uint8 addr) +void FloppyDrive::ControlMotor(uint8_t addr) { // $C0E8 - 9 motorOn = addr; } -void FloppyDrive::DriveEnable(uint8 addr) +void FloppyDrive::DriveEnable(uint8_t addr) { // $C0EA - B activeDrive = addr; } -uint8 FloppyDrive::ReadWrite(void) +uint8_t FloppyDrive::ReadWrite(void) { SpawnMessage("%u:%sing %s track %u, sector %u...", activeDrive, (ioMode == IO_MODE_READ ? "Read" : "Write"), @@ -644,20 +644,20 @@ Which we now do. :-) return 0;//is this more like it? } - uint8 diskByte = nybblizedImage[activeDrive][(track * 6656) + currentPos]; + uint8_t diskByte = nybblizedImage[activeDrive][(track * 6656) + currentPos]; currentPos = (currentPos + 1) % 6656; //WriteLog("FL: diskByte=%02X, currentPos=%u\n", diskByte, currentPos); return diskByte; } -uint8 FloppyDrive::GetLatchValue(void) +uint8_t FloppyDrive::GetLatchValue(void) { // $C0ED return latchValue; } -void FloppyDrive::SetLatchValue(uint8 value) +void FloppyDrive::SetLatchValue(uint8_t value) { // $C0ED latchValue = value; diff --git a/src/floppy.h b/src/floppy.h index f92a99b..fd3c06e 100755 --- a/src/floppy.h +++ b/src/floppy.h @@ -12,7 +12,7 @@ #else #include // for MAX_PATH on MinGW/Darwin #endif -#include "types.h" +#include enum { DT_UNKNOWN, DT_DOS33, DT_PRODOS, DT_NYBBLE }; @@ -22,54 +22,54 @@ class FloppyDrive FloppyDrive(); ~FloppyDrive(); - bool LoadImage(const char * filename, uint8 driveNum = 0); - bool SaveImage(uint8 driveNum = 0); - bool SaveImageAs(const char * filename, uint8 driveNum = 0); - void CreateBlankImage(uint8 driveNum = 0); + bool LoadImage(const char * filename, uint8_t driveNum = 0); + bool SaveImage(uint8_t driveNum = 0); + bool SaveImageAs(const char * filename, uint8_t driveNum = 0); + void CreateBlankImage(uint8_t driveNum = 0); void SwapImages(void); - const char * GetImageName(uint8 driveNum = 0); - void EjectImage(uint8 driveNum = 0); - bool DriveIsEmpty(uint8 driveNum = 0); - bool DiskIsWriteProtected(uint8 driveNum = 0); - void SetWriteProtect(bool, uint8 driveNum = 0); + const char * GetImageName(uint8_t driveNum = 0); + void EjectImage(uint8_t driveNum = 0); + bool DriveIsEmpty(uint8_t driveNum = 0); + bool DiskIsWriteProtected(uint8_t driveNum = 0); + void SetWriteProtect(bool, uint8_t driveNum = 0); // I/O functions ($C0Ex accesses) - void ControlStepper(uint8 addr); - void ControlMotor(uint8 addr); - void DriveEnable(uint8 addr); - uint8 ReadWrite(void); - uint8 GetLatchValue(void); - void SetLatchValue(uint8 value); + void ControlStepper(uint8_t addr); + void ControlMotor(uint8_t addr); + void DriveEnable(uint8_t addr); + uint8_t ReadWrite(void); + uint8_t GetLatchValue(void); + void SetLatchValue(uint8_t value); void SetReadMode(void); void SetWriteMode(void); protected: - void DetectImageType(const char * filename, uint8 driveNum); - void NybblizeImage(uint8 driveNum); - void DenybblizeImage(uint8 driveNum); + void DetectImageType(const char * filename, uint8_t driveNum); + void NybblizeImage(uint8_t driveNum); + void DenybblizeImage(uint8_t driveNum); private: char imageName[2][MAX_PATH]; - uint8 * disk[2]; - uint32 diskSize[2]; - uint8 diskType[2]; + uint8_t * disk[2]; + uint32_t diskSize[2]; + uint8_t diskType[2]; bool imageDirty[2]; bool writeProtected[2]; - uint8 motorOn; - uint8 activeDrive; - uint8 ioMode; - uint8 latchValue; - uint8 phase; - uint8 track; + uint8_t motorOn; + uint8_t activeDrive; + uint8_t ioMode; + uint8_t latchValue; + uint8_t phase; + uint8_t track; - uint8 nybblizedImage[2][232960]; - uint32 currentPos; + uint8_t nybblizedImage[2][232960]; + uint32_t currentPos; // And here are some private class variables (to reduce function redundancy): - static uint8 header[21]; - static uint8 doSector[16]; - static uint8 poSector[16]; + static uint8_t header[21]; + static uint8_t doSector[16]; + static uint8_t poSector[16]; static char nameBuf[MAX_PATH]; }; diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 4a77a13..e5588ef 100755 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -42,7 +42,7 @@ Some notes about this class: - Button colors are hardwired (for plain text buttons) */ -Button::Button(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, +Button::Button(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, Element * parent/*= NULL*/): Element(x, y, w, h, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, parent), activated(false), clicked(false), inside(false), @@ -52,7 +52,7 @@ Button::Button(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0* // Should we make a local button bitmap here? } -Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, SDL_Surface * upImg, Element * parent/*= NULL*/): +Button::Button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, SDL_Surface * upImg, Element * parent/*= NULL*/): Element(x, y, w, h, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, parent), activated(false), clicked(false), inside(false), buttonUp(upImg), buttonDown(NULL), buttonHover(NULL), surfacesAreLocal(false), @@ -61,7 +61,7 @@ Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, SDL_Surface * upImg, Elem // if (upImg == NULL) // return; // -// uint32 width = ((Bitmap *)upImg)->width, height = ((Bitmap *)upImg)->height; +// uint32_t width = ((Bitmap *)upImg)->width, height = ((Bitmap *)upImg)->height; // // buttonUp = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, // 32, MASK_R, MASK_G, MASK_B, MASK_A); @@ -70,7 +70,7 @@ Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, SDL_Surface * upImg, Elem // Should we make a local button bitmap here? NO--it's passed in! } -Button::Button(uint32 x, uint32 y, SDL_Surface * bU, SDL_Surface * bH/*= NULL*/, +Button::Button(uint32_t x, uint32_t y, SDL_Surface * bU, SDL_Surface * bH/*= NULL*/, SDL_Surface * bD/*= NULL*/, Element * parent/*= NULL*/): Element(x, y, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, parent), activated(false), clicked(false), inside(false), @@ -82,7 +82,7 @@ Button::Button(uint32 x, uint32 y, SDL_Surface * bU, SDL_Surface * bH/*= NULL*/, extents.h = buttonUp->h; } -Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, std::string s, Element * parent/*= NULL*/): +Button::Button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, std::string s, Element * parent/*= NULL*/): Element(x, y, w, h, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, parent), activated(false), clicked(false), inside(false), buttonUp(NULL), buttonDown(NULL), buttonHover(NULL), surfacesAreLocal(true), @@ -91,7 +91,7 @@ Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, std::string s, Element * // Create the button surfaces here... } -Button::Button(uint32 x, uint32 y, std::string s, Element * parent/*= NULL*/): +Button::Button(uint32_t x, uint32_t y, std::string s, Element * parent/*= NULL*/): Element(x, y, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xCF, 0x00, 0xFF, parent), activated(false), clicked(false), inside(false), buttonUp(NULL), buttonDown(NULL), buttonHover(NULL), surfacesAreLocal(true), @@ -110,7 +110,7 @@ Button::Button(uint32 x, uint32 y, std::string s, Element * parent/*= NULL*/): MASK_R, MASK_G, MASK_B, MASK_A); //bleh -uint8 r1, g1, b1, a1; +uint8_t r1, g1, b1, a1; SDL_GetRGBA(fgColor, screen->format, &r1, &g1, &b1, &a1); fgColor = SDL_MapRGBA(buttonUp->format, r1, g1, b1, a1); SDL_GetRGBA(bgColor, screen->format, &r1, &g1, &b1, &a1); @@ -151,11 +151,11 @@ Button::~Button() } } -void Button::HandleKey(SDLKey key) +void Button::HandleKey(SDL_Scancode key) { } -void Button::HandleMouseMove(uint32 x, uint32 y) +void Button::HandleMouseMove(uint32_t x, uint32_t y) { if (!visible) return; @@ -165,7 +165,7 @@ void Button::HandleMouseMove(uint32 x, uint32 y) CheckStateAndRedrawIfNeeded(); } -void Button::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void Button::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { if (!visible) return; diff --git a/src/gui/button.h b/src/gui/button.h index bd0cc7c..4b4f131 100755 --- a/src/gui/button.h +++ b/src/gui/button.h @@ -17,15 +17,15 @@ class Button: public Element { public: - Button(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, Element * parent = NULL); - Button(uint32 x, uint32 y, uint32 w, uint32 h, SDL_Surface * upImg, Element * parent = NULL); - Button(uint32 x, uint32 y, SDL_Surface * bU, SDL_Surface * bH = NULL, SDL_Surface * bD = NULL, Element * parent = NULL); - Button(uint32 x, uint32 y, uint32 w, uint32 h, std::string s, Element * parent = NULL); - Button(uint32 x, uint32 y, std::string s, Element * parent = NULL); + Button(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, Element * parent = NULL); + Button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, SDL_Surface * upImg, Element * parent = NULL); + Button(uint32_t x, uint32_t y, SDL_Surface * bU, SDL_Surface * bH = NULL, SDL_Surface * bD = NULL, Element * parent = NULL); + Button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, std::string s, Element * parent = NULL); + Button(uint32_t x, uint32_t y, std::string s, Element * parent = NULL); ~Button(); - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); virtual void Notify(Element *); bool ButtonClicked(void); @@ -36,8 +36,8 @@ class Button: public Element protected: bool activated, clicked, inside; SDL_Surface * buttonUp, * buttonDown, * buttonHover; - uint32 fgColorHL; - uint32 bgColorHL; + uint32_t fgColorHL; + uint32_t bgColorHL; private: bool surfacesAreLocal; diff --git a/src/gui/diskwindow.cpp b/src/gui/diskwindow.cpp index 7b33dbc..32973ce 100644 --- a/src/gui/diskwindow.cpp +++ b/src/gui/diskwindow.cpp @@ -48,7 +48,7 @@ IDEA: Make a recently used file list when ejecting a disk, either here or in // NOTE: FG/BG colors are hard-wired // -DiskWindow::DiskWindow(FloppyDrive * fdp, uint32 x/*= 0*/, uint32 y/*= 0*/): Window(x, y, 200, 140, NULL), floppyDrive(fdp) +DiskWindow::DiskWindow(FloppyDrive * fdp, uint32_t x/*= 0*/, uint32_t y/*= 0*/): Window(x, y, 200, 140, NULL), floppyDrive(fdp) { //Could probably move this into the initializer list as well... // closeButton = new Button(w - (cbWidth + 1), 1, cbUp, cbHover, cbDown, this); @@ -104,7 +104,7 @@ printf("Inside ~DiskWindow()...\n"); #endif } -void DiskWindow::HandleKey(SDLKey key) +void DiskWindow::HandleKey(SDL_Scancode key) { Window::HandleKey(key); #if 0 @@ -116,34 +116,34 @@ void DiskWindow::HandleKey(SDLKey key) } // Handle the items this window contains... - for(uint32 i=0; iHandleKey(key); #endif } -void DiskWindow::HandleMouseMove(uint32 x, uint32 y) +void DiskWindow::HandleMouseMove(uint32_t x, uint32_t y) { Window::HandleMouseMove(x, y); #if 0 // Handle the items this window contains... - for(uint32 i=0; iHandleMouseMove(x - extents.x, y - extents.y); #endif } -void DiskWindow::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void DiskWindow::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { Window::HandleMouseButton(x, y, mouseDown); #if 0 #if 1 // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); #else //? This works in draggablewindow2... // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); @@ -164,7 +164,7 @@ void DiskWindow::Draw(void) SDL_FillRect(screen, &extents, bgColor); // Handle the items this window contains... - for(uint32 i=0; iDraw(); needToRefreshScreen = true; diff --git a/src/gui/diskwindow.h b/src/gui/diskwindow.h index 8ef6272..3131750 100644 --- a/src/gui/diskwindow.h +++ b/src/gui/diskwindow.h @@ -15,11 +15,11 @@ class Text; class DiskWindow: public Window { public: - DiskWindow(FloppyDrive * fdp, uint32 x = 0, uint32 y = 0); + DiskWindow(FloppyDrive * fdp, uint32_t x = 0, uint32_t y = 0); ~DiskWindow(); //Does this destructor need to be virtual? Not sure... Check! - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); virtual void Notify(Element *); // void AddElement(Element * e); @@ -32,7 +32,7 @@ class DiskWindow: public Window private: FloppyDrive * floppyDrive; -// uint16 cbWidth, cbHeight; +// uint16_t cbWidth, cbHeight; // SDL_Surface * cbUp, * cbDown, * cbHover; Text * name1, * name2; Button * load1, * load2, * eject1, * eject2, diff --git a/src/gui/draggablewindow.cpp b/src/gui/draggablewindow.cpp index 45635bf..5b25649 100755 --- a/src/gui/draggablewindow.cpp +++ b/src/gui/draggablewindow.cpp @@ -41,7 +41,7 @@ // NOTE: FG/BG colors are hard-wired // -DraggableWindow::DraggableWindow(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, +DraggableWindow::DraggableWindow(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, void (* f)(Element *)/*= NULL*/): Element(x, y, w, h, 0x4D, 0xFF, 0x84, 0xFF, 0x1F, 0x84, 0x84, 0xFF), handler(f), clicked(false), @@ -58,8 +58,8 @@ DraggableWindow::DraggableWindow(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0 list.push_back(closeButton); #ifdef BACKGROUND_IMG_TEST -uint16 imgWidth = (floppyDiskImg[0] << 8) | floppyDiskImg[1]; -uint16 imgHeight = (floppyDiskImg[2] << 8) | floppyDiskImg[3]; +uint16_t imgWidth = (floppyDiskImg[0] << 8) | floppyDiskImg[1]; +uint16_t imgHeight = (floppyDiskImg[2] << 8) | floppyDiskImg[3]; img = SDL_CreateRGBSurfaceFrom(&floppyDiskImg[4], imgWidth, imgHeight, 32, imgWidth * 4, MASK_R, MASK_G, MASK_B, MASK_A); #endif @@ -70,7 +70,7 @@ img = SDL_CreateRGBSurfaceFrom(&floppyDiskImg[4], imgWidth, imgHeight, 32, imgWi DraggableWindow::~DraggableWindow() { - for(uint32 i=0; iHandleKey(key); } -void DraggableWindow::HandleMouseMove(uint32 x, uint32 y) +void DraggableWindow::HandleMouseMove(uint32_t x, uint32_t y) { if (clicked) { @@ -112,12 +112,12 @@ void DraggableWindow::HandleMouseMove(uint32 x, uint32 y) } // Handle the items this window contains... - for(uint32 i=0; iHandleMouseMove(x - extents.x, y - extents.y); } -void DraggableWindow::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void DraggableWindow::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { clicked = false; @@ -129,7 +129,7 @@ void DraggableWindow::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) } // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); @@ -148,7 +148,7 @@ void DraggableWindow::Draw(void) SDL_FillRect(screen, &(*i), bgColor); // Handle the items this window contains... - for(uint32 i=0; iDraw(); #else // These are *always* top level and parentless, so no need to traverse up through @@ -162,7 +162,7 @@ void DraggableWindow::Draw(void) SDL_BlitSurface(img, &src, screen, &dst); extern char textChar2e[]; - uint8 * fontAddr = (uint8 *)textChar2e + ((128 + 32) * 7 * 8); + uint8_t * fontAddr = (uint8_t *)textChar2e + ((128 + 32) * 7 * 8); SetNewFont(Font(fontAddr, 7, 8)); DrawStringOpaque(screen, extents.x + 8, extents.y + 6, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo"); DrawStringOpaque(screen, extents.x + 8, extents.y + 14, 0xFF000000, 0xFFFFFFFF, "0123456789012345"); @@ -174,7 +174,7 @@ void DraggableWindow::Draw(void) #endif // Handle the items this window contains... - for(uint32 i=0; iDraw(); #endif diff --git a/src/gui/draggablewindow.h b/src/gui/draggablewindow.h index 41e8966..a658cb9 100755 --- a/src/gui/draggablewindow.h +++ b/src/gui/draggablewindow.h @@ -15,12 +15,12 @@ class Button; // Forward declaration class DraggableWindow: public Element { public: - DraggableWindow(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, + DraggableWindow(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, void (* f)(Element *) = NULL); ~DraggableWindow(); //Does this destructor need to be virtual? Not sure... Check! - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); virtual void Notify(Element *); void AddElement(Element * e); @@ -33,7 +33,7 @@ class DraggableWindow: public Element SDL_Rect offset; private: - uint16 cbWidth, cbHeight; + uint16_t cbWidth, cbHeight; SDL_Surface * cbUp, * cbDown, * cbHover; SDL_Surface * img; }; diff --git a/src/gui/draggablewindow2.cpp b/src/gui/draggablewindow2.cpp index be4207c..a34d3d0 100755 --- a/src/gui/draggablewindow2.cpp +++ b/src/gui/draggablewindow2.cpp @@ -44,13 +44,13 @@ // NOTE: FG/BG colors are hard-wired // -DraggableWindow2::DraggableWindow2(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, +DraggableWindow2::DraggableWindow2(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, void (* f)(Element *)/*= NULL*/): Window(x, y, w, h, f), clicked(false) { #ifdef BACKGROUND_IMG_TEST - uint16 imgWidth = (floppyDiskImg[0] << 8) | floppyDiskImg[1]; - uint16 imgHeight = (floppyDiskImg[2] << 8) | floppyDiskImg[3]; + uint16_t imgWidth = (floppyDiskImg[0] << 8) | floppyDiskImg[1]; + uint16_t imgHeight = (floppyDiskImg[2] << 8) | floppyDiskImg[3]; img = SDL_CreateRGBSurfaceFrom(&floppyDiskImg[4], imgWidth, imgHeight, 32, imgWidth * 4, MASK_R, MASK_G, MASK_B, MASK_A); // label = SDL_CreateRGBSurface(SDL_SWSURFACE, 16*7, 32, 32, @@ -59,7 +59,7 @@ DraggableWindow2::DraggableWindow2(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= //Prolly should draw this in the constructor... //Now is! :-D extern char textChar2e[]; - uint8 * fontAddr = (uint8 *)textChar2e + ((128 + 32) * 7 * 8); + uint8_t * fontAddr = (uint8_t *)textChar2e + ((128 + 32) * 7 * 8); SetNewFont(Font(fontAddr, 7, 8)); // DrawStringOpaque(label, 0, 0, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo"); // DrawStringOpaque(label, 0, 8, 0xFF000000, 0xFFFFFFFF, "0123456789012345"); @@ -92,14 +92,14 @@ printf("Inside ~DraggableWindow2()...\n"); #endif } -void DraggableWindow2::HandleMouseMove(uint32 x, uint32 y) +void DraggableWindow2::HandleMouseMove(uint32_t x, uint32_t y) { if (clicked) { //Need to check whether or not we've run into the extents of the screen... !!! FIX !!! //[DONE] - int32 newX = x - offset.x; - int32 newY = y - offset.y; + int32_t newX = x - offset.x; + int32_t newY = y - offset.y; SDL_Rect clip = GetParentRect(); if (newX < clip.x) @@ -127,13 +127,13 @@ void DraggableWindow2::HandleMouseMove(uint32 x, uint32 y) } // Handle the items this window contains... -// for(uint32 i=0; iHandleMouseMove(x - extents.x, y - extents.y); Window::HandleMouseMove(x, y); } -void DraggableWindow2::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void DraggableWindow2::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { clicked = false; @@ -145,7 +145,7 @@ void DraggableWindow2::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) } // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); @@ -177,7 +177,7 @@ void DraggableWindow2::Draw(void) // SDL_BlitSurface(label, &src, screen, &dst); // Handle the items this window contains... - for(uint32 i=0; iDraw(); #else // These are *always* top level and parentless, so no need to traverse up through @@ -192,7 +192,7 @@ void DraggableWindow2::Draw(void) //WTF? Unnecessary! // extern char textChar2e[]; -// uint8 * fontAddr = (uint8 *)textChar2e + ((128 + 32) * 7 * 8); +// uint8_t * fontAddr = (uint8_t *)textChar2e + ((128 + 32) * 7 * 8); // SetNewFont(Font(fontAddr, 7, 8)); // DrawStringOpaque(screen, extents.x + 8, extents.y + 6, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo"); // DrawStringOpaque(screen, extents.x + 8, extents.y + 14, 0xFF000000, 0xFFFFFFFF, "0123456789012345"); @@ -204,7 +204,7 @@ void DraggableWindow2::Draw(void) #endif // Handle the items this window contains... - for(uint32 i=0; iDraw(); #endif diff --git a/src/gui/draggablewindow2.h b/src/gui/draggablewindow2.h index 0942ec9..045f988 100755 --- a/src/gui/draggablewindow2.h +++ b/src/gui/draggablewindow2.h @@ -13,11 +13,11 @@ class DraggableWindow2: public Window { public: - DraggableWindow2(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, + DraggableWindow2(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, void (* f)(Element *) = NULL); ~DraggableWindow2(); // Does this destructor need to be virtual? No, it doesn't! - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); protected: diff --git a/src/gui/element.cpp b/src/gui/element.cpp index 1c65b2d..5598f61 100755 --- a/src/gui/element.cpp +++ b/src/gui/element.cpp @@ -40,7 +40,7 @@ SDL_Surface * Element::screen = NULL; bool Element::needToRefreshScreen = false; -Element::Element(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, +Element::Element(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, Element * parentElement/*= NULL*/): parent(parentElement), backstore(NULL), visible(true) { extents.x = x, @@ -50,9 +50,9 @@ Element::Element(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= coverList.push_back(extents); } -Element::Element(uint32 x, uint32 y, uint32 w, uint32 h, - uint8 fgR/*= 0xFF*/, uint8 fgG/*= 0xFF*/, uint8 fgB/*= 0xFF*/, uint8 fgA/*= 0xFF*/, - uint8 bgR/*= 0x00*/, uint8 bgG/*= 0x00*/, uint8 bgB/*= 0x00*/, uint8 bgA/*= 0xFF*/, +Element::Element(uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint8_t fgR/*= 0xFF*/, uint8_t fgG/*= 0xFF*/, uint8_t fgB/*= 0xFF*/, uint8_t fgA/*= 0xFF*/, + uint8_t bgR/*= 0x00*/, uint8_t bgG/*= 0x00*/, uint8_t bgB/*= 0x00*/, uint8_t bgA/*= 0xFF*/, Element * parentElement/*= NULL*/): parent(parentElement), backstore(NULL), visible(true) { extents.x = x, @@ -63,9 +63,9 @@ Element::Element(uint32 x, uint32 y, uint32 w, uint32 h, #if 0 // This *should* allow us to store our colors in an endian safe way... :-/ - uint8 * c = (uint8 *)&fgColor; + uint8_t * c = (uint8_t *)&fgColor; c[0] = fgR, c[1] = fgG, c[2] = fgB, c[3] = fgA; - c = (uint8 *)&bgColor; + c = (uint8_t *)&bgColor; c[0] = bgR, c[1] = bgG, c[2] = bgB, c[3] = bgA; #else fgColor = SDL_MapRGBA(screen->format, fgR, fgG, fgB, fgA); @@ -83,10 +83,10 @@ Element::~Element() } } -bool Element::Inside(uint32 x, uint32 y) +bool Element::Inside(uint32_t x, uint32_t y) { - return (x >= (uint32)extents.x && x < (uint32)(extents.x + extents.w) - && y >= (uint32)extents.y && y < (uint32)(extents.y + extents.h) ? true : false); + return (x >= (uint32_t)extents.x && x < (uint32_t)(extents.x + extents.w) + && y >= (uint32_t)extents.y && y < (uint32_t)(extents.y + extents.h) ? true : false); } //Badly named--!!! FIX !!! [DONE] @@ -255,10 +255,10 @@ Steps: //This approach won't work--if no rect1 then we're screwed! [FIXED] //Now *that* will work... SDL_Rect current = *i; - uint32 bottomOfRect1 = current.y; -// uint32 rightOfRect2 = current.x; -// uint32 leftOfRect3 = current.x + current.w; - uint32 topOfRect4 = current.y + current.h; + uint32_t bottomOfRect1 = current.y; +// uint32_t rightOfRect2 = current.x; +// uint32_t leftOfRect3 = current.x + current.w; + uint32_t topOfRect4 = current.y + current.h; // Rectangle #1 (top) if (r.y > current.y) // Simple rectangle degeneracy test... diff --git a/src/gui/element.h b/src/gui/element.h index 305b90e..e3ad812 100755 --- a/src/gui/element.h +++ b/src/gui/element.h @@ -12,26 +12,26 @@ enum { WINDOW_CLOSE, MENU_ITEM_CHOSEN, SCREEN_REFRESH_NEEDED }; -#include +#include #include -#include "types.h" +#include class Element { public: - Element(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, + Element(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, Element * parentElement = NULL); - Element(uint32 x, uint32 y, uint32 w, uint32 h, - uint8 fgR = 0xFF, uint8 fgG = 0xFF, uint8 fgB = 0xFF, uint8 fgA = 0xFF, - uint8 bgR = 0x00, uint8 bgG = 0x00, uint8 bgB = 0x00, uint8 bgA = 0xFF, + Element(uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint8_t fgR = 0xFF, uint8_t fgG = 0xFF, uint8_t fgB = 0xFF, uint8_t fgA = 0xFF, + uint8_t bgR = 0x00, uint8_t bgG = 0x00, uint8_t bgB = 0x00, uint8_t bgA = 0xFF, Element * parentElement = NULL); virtual ~Element(); // Destructor cannot be pure virtual... - virtual void HandleKey(SDLKey key) = 0; // These are "pure" virtual functions... - virtual void HandleMouseMove(uint32 x, uint32 y) = 0; - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) = 0; + virtual void HandleKey(SDL_Scancode key) = 0; // These are "pure" virtual functions... + virtual void HandleMouseMove(uint32_t x, uint32_t y) = 0; + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) = 0; virtual void Draw(void) = 0; virtual void Notify(Element *) = 0; - bool Inside(uint32 x, uint32 y); + bool Inside(uint32_t x, uint32_t y); //Badly named, though we may code something that does this... // SDL_Rect GetParentCorner(void); SDL_Rect GetScreenCoords(void); @@ -54,10 +54,10 @@ class Element protected: SDL_Rect extents; - uint32 state; + uint32_t state; Element * parent; - uint32 fgColor; - uint32 bgColor; + uint32_t fgColor; + uint32_t bgColor; SDL_Surface * backstore; std::list coverList; bool visible; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 5bbd85e..3b6084c 100755 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -34,7 +34,7 @@ // This works, but the colors are rendered incorrectly. Also, it seems that there's // fullscreen blitting still going on--dragging the disk is fast at first but then // gets painfully slow. Not sure what's going on there. -#define USE_NEW_MAINBUFFERING +//#define USE_NEW_MAINBUFFERING //#ifdef DEBUG_MAIN_LOOP #include "log.h" @@ -64,6 +64,7 @@ GUI::GUI(SDL_Surface * surface): menuItem(new MenuItems()) windowList.push_back(new DiskWindow(&floppyDrive, 240, 20)); } + GUI::~GUI() { // Clean up menuItem, if any @@ -78,17 +79,20 @@ GUI::~GUI() delete *i; } + void GUI::AddMenuTitle(const char * title) { menuItem->title = title; menuItem->item.clear(); } -void GUI::AddMenuItem(const char * item, Element * (* a)(void)/*= NULL*/, SDLKey k/*= SDLK_UNKNOWN*/) + +void GUI::AddMenuItem(const char * item, Element * (* a)(void)/*= NULL*/, SDL_Scancode k/*= SDLK_UNKNOWN*/) { menuItem->item.push_back(NameAction(item, a, k)); } + void GUI::CommitItemsToMenu(void) { //We could just do a simple check here to see if more than one item is in the list, @@ -104,6 +108,7 @@ void GUI::CommitItemsToMenu(void) ((Menu *)(*windowList.begin()))->Add(*menuItem); } + void GUI::Run(void) { exitGUI = false; @@ -111,7 +116,8 @@ void GUI::Run(void) SDL_Event event; std::list::iterator i; - SDL_EnableKeyRepeat(150, 75); +// Not sure what replaces this in SDL2... +// SDL_EnableKeyRepeat(150, 75); // Also: Need to pick up backbuffer (for those windows that have them) // BEFORE drawing... @@ -194,6 +200,8 @@ WriteLog(" -- SDL_USEREVENT\n"); FlipMainScreen(); #endif } +//Not sure what to do here for SDL2... +#if 0 else if (event.type == SDL_ACTIVEEVENT) { //Need to do a screen refresh here... @@ -203,9 +211,10 @@ WriteLog(" -- SDL_USEREVENT\n"); #ifndef USE_NEW_MAINBUFFERING RenderScreenBuffer(); #else - FlipMainScreen(); + FlipMainScreen(); #endif } +#endif else if (event.type == SDL_KEYDOWN) { #ifdef DEBUG_MAIN_LOOP @@ -218,7 +227,7 @@ WriteLog(" -- SDL_KEYDOWN\n"); //Probably should only give this to the top level window... // for(i=windowList.begin(); i!=windowList.end(); i++) // (*i)->HandleKey(event.key.keysym.sym); - windowList.back()->HandleKey(event.key.keysym.sym); + windowList.back()->HandleKey(event.key.keysym.scancode); } else if (event.type == SDL_MOUSEMOTION) { @@ -459,11 +468,14 @@ WriteLog("Screen refresh called!\n"); //SDL_Delay(10); } - SDL_EnableKeyRepeat(0, 0); +// Not sure what to do for this in SDL 2... +// SDL_EnableKeyRepeat(0, 0); // return false; } + void GUI::Stop(void) { exitGUI = true; } + diff --git a/src/gui/gui.h b/src/gui/gui.h index 05ab391..f5b15fb 100755 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -7,20 +7,21 @@ #ifndef __GUI_H__ #define __GUI_H__ -#include +#include #include class Menu; // Now *this* should work, since we've got pointers... class MenuItems; class Element; + class GUI { public: GUI(SDL_Surface *); ~GUI(); void AddMenuTitle(const char *); - void AddMenuItem(const char *, Element * (* a)(void) = NULL, SDLKey k = SDLK_UNKNOWN); + void AddMenuItem(const char *, Element * (* a)(void) = NULL, SDL_Scancode k = SDL_SCANCODE_UNKNOWN); void CommitItemsToMenu(void); void Run(void); void Stop(void); @@ -35,3 +36,4 @@ class GUI }; #endif // __GUI_H__ + diff --git a/src/gui/guielements.h b/src/gui/guielements.h index 4ea89a3..af17ca1 100755 --- a/src/gui/guielements.h +++ b/src/gui/guielements.h @@ -7,7 +7,7 @@ #ifndef __GUIELEMENTS_H__ #define __GUIELEMENTS_H__ -#include "types.h" +#include #ifdef __cplusplus extern "C" { @@ -28,10 +28,10 @@ struct Bitmap { //NOTE: 32-bit pixels are in the format of ABGR... // This may not be endian safe... Mac users? //Using the GIMP C style bitmap is portable in that it's specified in bytes -//but we can cast it in uint32s and thus it will display correctly regardless of +//but we can cast it in uint32_ts and thus it will display correctly regardless of //the underlying endianess. At least, in theory. ;-) -uint32 mousePic[] = { +uint32_t mousePic[] = { 6, 8, 0xFF00FF00,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, // + @@ -63,7 +63,7 @@ uint32 mousePic[] = { */ }; -uint32 upArrowBox[] = { +uint32_t upArrowBox[] = { 8, 8, 0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649, // ++++++++ @@ -76,7 +76,7 @@ uint32 upArrowBox[] = { 0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400 // ........ }; -uint32 downArrowBox[] = { +uint32_t downArrowBox[] = { 8, 8, 0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649, // ++++++++ @@ -134,7 +134,7 @@ static const struct { "\0", }; -uint32 pushButtonUp[] = { +uint32_t pushButtonUp[] = { 8, 8, 0x00000000, 0xFF1B1B1B, 0xFF545477, 0xFF525292, 0xFF474787, 0xFF363659, 0xFF0F0F0F, 0x00000000, @@ -147,7 +147,7 @@ uint32 pushButtonUp[] = { 0x00000000, 0xFF0D0D0D, 0xFF343456, 0xFF3D3D80, 0xFF3D3D82, 0xFF333358, 0xFF0D0D0D, 0x00000000 }; -uint8 pbuAlpha[] = { +uint8_t pbuAlpha[] = { 0xFF, 0xE4, 0xA0, 0x99, 0xA4, 0xBE, 0xF0, 0xFF, 0xE3, 0x85, 0x00, 0x00, 0x00, 0x00, 0xAF, 0xF0, 0x9F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, @@ -204,7 +204,7 @@ static const struct { "yy\343xxx\303xxx\177sss\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", }; -uint32 pushButtonDown[] = { +uint32_t pushButtonDown[] = { 8, 8, 0x00000000, 0xFF1B1B1B, 0xFF8B8B90, 0xFF8C8CAF, 0xFF767699, 0xFF56565B, 0xFF0F0F0F, 0x00000000, @@ -217,7 +217,7 @@ uint32 pushButtonDown[] = { 0x00000000, 0xFF101010, 0xFF4E4E55, 0xFF5B5B83, 0xFF5B5B84, 0xFF4D4D54, 0xFF101010, 0x00000000 }; -uint8 pbdAlpha[] = { +uint8_t pbdAlpha[] = { 0xFF, 0xE4, 0x72, 0x68, 0x7E, 0xA7, 0xF0, 0xFF, 0xE4, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x93, 0xF0, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB2, @@ -228,7 +228,7 @@ uint8 pbdAlpha[] = { 0xFF, 0xEF, 0xAE, 0x98, 0x97, 0xAF, 0xEF, 0xFF }; -uint32 slideSwitchUp[] = { +uint32_t slideSwitchUp[] = { 8, 16, //0C7F -> 000011 00011 11111 -> 0000 1100 0001 1000 1111 1111 -> 0C 18 FF @@ -250,7 +250,7 @@ uint32 slideSwitchUp[] = { 0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400,0xFFBD8400 // ........ }; -uint32 slideSwitchDown[] = { +uint32_t slideSwitchDown[] = { 8, 16, 0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649,0xFFF7D649, // ++++++++ @@ -274,7 +274,7 @@ uint32 slideSwitchDown[] = { #define CLOSEBOX_WIDTH 15 #define CLOSEBOX_HEIGHT 15 -uint32 closeBox[] = { +uint32_t closeBox[] = { 15, 15, 0x00000000, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0x00000000, @@ -294,7 +294,7 @@ uint32 closeBox[] = { 0x00000000, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0x00000000 }; -uint32 closeBoxHover[] = { +uint32_t closeBoxHover[] = { 15, 15, 0x00000000, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0x00000000, @@ -314,7 +314,7 @@ uint32 closeBoxHover[] = { 0x00000000, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0x00000000 }; -uint32 closeBoxDown[] = { +uint32_t closeBoxDown[] = { 15, 15, 0x00000000, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0xFF3838ED, 0x00000000, diff --git a/src/gui/guimisc.cpp b/src/gui/guimisc.cpp index 6a7af2e..62358f8 100755 --- a/src/gui/guimisc.cpp +++ b/src/gui/guimisc.cpp @@ -35,7 +35,7 @@ // Local variables // This will enable us to set up any font without having it embedded here... -static Font font((uint8 *)font2, FONT_WIDTH, FONT_HEIGHT); +static Font font((uint8_t *)font2, FONT_WIDTH, FONT_HEIGHT); static std::vector oldFontList; @@ -54,12 +54,12 @@ void RestoreOldFont(void) oldFontList.pop_back(); } -uint32 GetFontWidth(void) +uint32_t GetFontWidth(void) { return font.width; } -uint32 GetFontHeight(void) +uint32_t GetFontHeight(void) { return font.height; } @@ -67,7 +67,7 @@ uint32 GetFontHeight(void) // // Draw text at the given x/y coordinates with transparency (255 is fully opaque, 0 is fully transparent). // -void DrawStringTrans(SDL_Surface * screen, uint32 x, uint32 y, uint32 color, const char * text, ...) +void DrawStringTrans(SDL_Surface * screen, uint32_t x, uint32_t y, uint32_t color, const char * text, ...) { char string[4096]; va_list arg; @@ -76,9 +76,9 @@ void DrawStringTrans(SDL_Surface * screen, uint32 x, uint32 y, uint32 color, con vsprintf(string, text, arg); va_end(arg); - uint8 * esColor = (uint8 *)&color; // Do things endian safe...! - uint8 trans = esColor[3]; - uint32 length = strlen(string); + uint8_t * esColor = (uint8_t *)&color; // Do things endian safe...! + uint8_t trans = esColor[3]; + uint32_t length = strlen(string); // Make a "stamp" surface (with built in alpha!) for constructing our font chars... SDL_Surface * chr = SDL_CreateRGBSurface(SDL_SWSURFACE, font.width, font.height, 32, @@ -87,22 +87,22 @@ void DrawStringTrans(SDL_Surface * screen, uint32 x, uint32 y, uint32 color, con rect.x = x, rect.y = y; //bleh -uint8 r1, g1, b1, a1; +uint8_t r1, g1, b1, a1; SDL_GetRGBA(color, screen->format, &r1, &g1, &b1, &a1); color = SDL_MapRGBA(chr->format, r1, g1, b1, a1); //helb - for(uint32 i=0; ipixels)[xx + (yy * (chr->pitch / 4))] = color; + ((uint32_t *)chr->pixels)[xx + (yy * (chr->pitch / 4))] = color; } } @@ -116,7 +116,7 @@ color = SDL_MapRGBA(chr->format, r1, g1, b1, a1); // // Draw text at given x/y coords using foreground/background color combination // -void DrawStringOpaque(SDL_Surface * screen, uint32 x, uint32 y, uint32 fg, uint32 bg, const char * text, ...) +void DrawStringOpaque(SDL_Surface * screen, uint32_t x, uint32_t y, uint32_t fg, uint32_t bg, const char * text, ...) { char string[4096]; va_list arg; @@ -125,8 +125,8 @@ void DrawStringOpaque(SDL_Surface * screen, uint32 x, uint32 y, uint32 fg, uint3 vsprintf(string, text, arg); va_end(arg); - uint8 * esColor = (uint8 *)&fg; // Do things endian safe...! - uint32 length = strlen(string); + uint8_t * esColor = (uint8_t *)&fg; // Do things endian safe...! + uint32_t length = strlen(string); SDL_Rect destRect; @@ -142,24 +142,24 @@ void DrawStringOpaque(SDL_Surface * screen, uint32 x, uint32 y, uint32 fg, uint3 rect.x = x, rect.y = y; //bleh (we have to map colors from the HW surface to the SW surface) -uint8 r1, g1, b1, a1; +uint8_t r1, g1, b1, a1; SDL_GetRGBA(fg, screen->format, &r1, &g1, &b1, &a1); fg = SDL_MapRGBA(chr->format, r1, g1, b1, a1); SDL_GetRGBA(bg, screen->format, &r1, &g1, &b1, &a1); bg = SDL_MapRGBA(chr->format, r1, g1, b1, a1); //helb - for(uint32 i=0; ipixels)[xx + (yy * (chr->pitch / 4))] = fg; + ((uint32_t *)chr->pixels)[xx + (yy * (chr->pitch / 4))] = fg; } } @@ -218,7 +218,7 @@ bool RectangleFirstInsideSecond(SDL_Rect r1, SDL_Rect r2) // These representations *should* be endian safe. -uint8 closeBox[] = { +uint8_t closeBox[] = { 15 / 256, 15 % 256, // width (HI byte, LO byte) 15 / 256, 15 % 256, // height (HI byte, LO byte) @@ -239,7 +239,7 @@ uint8 closeBox[] = { 0x00, 0x00, 0x00, 0x00, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0x00, 0x00, 0x00, 0x00 }; -uint8 closeBoxHover[] = { +uint8_t closeBoxHover[] = { 15 / 256, 15 % 256, // width (HI byte, LO byte) 15 / 256, 15 % 256, // height (HI byte, LO byte) @@ -260,7 +260,7 @@ uint8 closeBoxHover[] = { 0x00, 0x00, 0x00, 0x00, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0xED, 0x38, 0x38, 0xFF, 0x00, 0x00, 0x00, 0x00 }; -uint8 closeBoxDown[] = { +uint8_t closeBoxDown[] = { 15 / 256, 15 % 256, // width (HI byte, LO byte) 15 / 256, 15 % 256, // height (HI byte, LO byte) @@ -312,17 +312,17 @@ using namespace std; // For STL stuff class Window; // Forward declaration... -//void DrawTransparentBitmap(uint32 * screen, uint32 x, uint32 y, uint32 * bitmap, uint8 * alpha = NULL); -void DrawTransparentBitmapDeprecated(uint32 * screen, uint32 x, uint32 y, uint32 * bitmap); -void DrawTransparentBitmap(uint32 * screen, uint32 x, uint32 y, const void * bitmap); -void DrawBitmap(uint32 * screen, uint32 x, uint32 y, const void * bitmap); +//void DrawTransparentBitmap(uint32_t * screen, uint32_t x, uint32_t y, uint32_t * bitmap, uint8_t * alpha = NULL); +void DrawTransparentBitmapDeprecated(uint32_t * screen, uint32_t x, uint32_t y, uint32_t * bitmap); +void DrawTransparentBitmap(uint32_t * screen, uint32_t x, uint32_t y, const void * bitmap); +void DrawBitmap(uint32_t * screen, uint32_t x, uint32_t y, const void * bitmap); //Should call this FillScreenRectangle with a number representing the RGBA value to fill. !!! FIX !!! -//void ClearScreenRectangle(uint32 * screen, uint32 x, uint32 y, uint32 w, uint32 h); -void FillScreenRectangle(uint32 * screen, uint32 x, uint32 y, uint32 w, uint32 h, uint32 color); -void DrawStringTrans(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 opacity, const char * text, ...); -void DrawStringOpaque(uint32 * screen, uint32 x, uint32 y, uint32 color1, uint32 color2, const char * text, ...); -void DrawString(uint32 * screen, uint32 x, uint32 y, bool invert, const char * text, ...); -void DrawString2(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 transparency, const char * text, ...); +//void ClearScreenRectangle(uint32_t * screen, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void FillScreenRectangle(uint32_t * screen, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color); +void DrawStringTrans(uint32_t * screen, uint32_t x, uint32_t y, uint32_t color, uint8_t opacity, const char * text, ...); +void DrawStringOpaque(uint32_t * screen, uint32_t x, uint32_t y, uint32_t color1, uint32_t color2, const char * text, ...); +void DrawString(uint32_t * screen, uint32_t x, uint32_t y, bool invert, const char * text, ...); +void DrawString2(uint32_t * screen, uint32_t x, uint32_t y, uint32_t color, uint8_t transparency, const char * text, ...); Window * LoadROM(void); Window * ResetJaguar(void); Window * ResetJaguarCD(void); @@ -335,10 +335,10 @@ int gzfilelength(gzFile gd); // External variables -extern uint8 * jaguar_mainRam; -extern uint8 * jaguar_mainRom; -extern uint8 * jaguar_bootRom; -extern uint8 * jaguar_CDBootROM; +extern uint8_t * jaguar_mainRam; +extern uint8_t * jaguar_mainRom; +extern uint8_t * jaguar_bootRom; +extern uint8_t * jaguar_CDBootROM; extern bool BIOSLoaded; extern bool CDBIOSLoaded; @@ -346,7 +346,7 @@ extern bool CDBIOSLoaded; bool exitGUI = false; // GUI (emulator) done variable int mouseX = 0, mouseY = 0; -uint32 background[1280 * 256]; // GUI background buffer +uint32_t background[1280 * 256]; // GUI background buffer char separator[] = "--------------------------------------------------------"; @@ -382,38 +382,38 @@ enum { WINDOW_CLOSE, MENU_ITEM_CHOSEN }; class Element { public: - Element(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0) + Element(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0) { extents.x = x, extents.y = y, extents.w = w, extents.h = h; } - virtual void HandleKey(SDLKey key) = 0; // These are "pure" virtual functions... - virtual void HandleMouseMove(uint32 x, uint32 y) = 0; - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) = 0; - virtual void Draw(uint32, uint32) = 0; + virtual void HandleKey(SDL_Scancode key) = 0; // These are "pure" virtual functions... + virtual void HandleMouseMove(uint32_t x, uint32_t y) = 0; + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) = 0; + virtual void Draw(uint32_t, uint32_t) = 0; virtual void Notify(Element *) = 0; //Needed? virtual ~Element() = 0; //We're not allocating anything in the base class, so the answer would be NO. - bool Inside(uint32 x, uint32 y); + bool Inside(uint32_t x, uint32_t y); // Class method -// static void SetScreenAndPitch(int16 * s, uint32 p) { screenBuffer = s, pitch = p; } - static void SetScreenAndPitch(uint32 * s, uint32 p) { screenBuffer = s, pitch = p; } +// static void SetScreenAndPitch(int16_t * s, uint32_t p) { screenBuffer = s, pitch = p; } + static void SetScreenAndPitch(uint32_t * s, uint32_t p) { screenBuffer = s, pitch = p; } protected: SDL_Rect extents; - uint32 state; + uint32_t state; // Class variables... -// static int16 * screenBuffer; - static uint32 * screenBuffer; - static uint32 pitch; +// static int16_t * screenBuffer; + static uint32_t * screenBuffer; + static uint32_t pitch; }; // Initialize class variables (Element) -//int16 * Element::screenBuffer = NULL; -uint32 * Element::screenBuffer = NULL; -uint32 Element::pitch = 0; +//int16_t * Element::screenBuffer = NULL; +uint32_t * Element::screenBuffer = NULL; +uint32_t Element::pitch = 0; -bool Element::Inside(uint32 x, uint32 y) +bool Element::Inside(uint32_t x, uint32_t y) { - return (x >= (uint32)extents.x && x < (uint32)(extents.x + extents.w) - && y >= (uint32)extents.y && y < (uint32)(extents.y + extents.h) ? true : false); + return (x >= (uint32_t)extents.x && x < (uint32_t)(extents.x + extents.w) + && y >= (uint32_t)extents.y && y < (uint32_t)(extents.y + extents.h) ? true : false); } @@ -424,46 +424,46 @@ bool Element::Inside(uint32 x, uint32 y) class Button: public Element { public: - Button(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0): Element(x, y, w, h), + Button(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0): Element(x, y, w, h), activated(false), clicked(false), inside(false), fgColor(0xFFFFFFFF), bgColor(0xFF00FF00), pic(NULL), elementToTell(NULL) {} - Button(uint32 x, uint32 y, uint32 w, uint32 h, uint32 * p): Element(x, y, w, h), + Button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t * p): Element(x, y, w, h), activated(false), clicked(false), inside(false), fgColor(0xFFFFFFFF), bgColor(0xFF00FF00), pic(p), elementToTell(NULL) {} -// Button(uint32 x, uint32 y, uint32 * p): Element(x, y, 0, 0), - Button(uint32 x, uint32 y, uint32 * p, uint32 * pH = NULL, uint32 * pD = NULL): Element(x, y, 0, 0), +// Button(uint32_t x, uint32_t y, uint32_t * p): Element(x, y, 0, 0), + Button(uint32_t x, uint32_t y, uint32_t * p, uint32_t * pH = NULL, uint32_t * pD = NULL): Element(x, y, 0, 0), activated(false), clicked(false), inside(false), fgColor(0xFFFFFFFF), bgColor(0xFF00FF00), pic(p), picHover(pH), picDown(pD), elementToTell(NULL) { if (pic) extents.w = pic[0], extents.h = pic[1]; } - Button(uint32 x, uint32 y, uint32 w, uint32 h, string s): Element(x, y, w, h), + Button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, string s): Element(x, y, w, h), activated(false), clicked(false), inside(false), fgColor(0xFFFFFFFF), bgColor(0xFF00FF00), pic(NULL), text(s), elementToTell(NULL) {} - Button(uint32 x, uint32 y, string s): Element(x, y, 0, FONT_HEIGHT), + Button(uint32_t x, uint32_t y, string s): Element(x, y, 0, FONT_HEIGHT), activated(false), clicked(false), inside(false), fgColor(0xFFFFFFFF), bgColor(0xFF00FF00), pic(NULL), text(s), elementToTell(NULL) { extents.w = s.length() * FONT_WIDTH; } - virtual void HandleKey(SDLKey key) {} - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + virtual void HandleKey(SDL_Scancode key) {} + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element *) {} bool ButtonClicked(void) { return activated; } void SetNotificationElement(Element * e) { elementToTell = e; } protected: bool activated, clicked, inside; - uint32 fgColor, bgColor; - uint32 * pic, * picHover, * picDown; + uint32_t fgColor, bgColor; + uint32_t * pic, * picHover, * picDown; string text; Element * elementToTell; }; -void Button::HandleMouseMove(uint32 x, uint32 y) +void Button::HandleMouseMove(uint32_t x, uint32_t y) { inside = Inside(x, y); } -void Button::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void Button::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { if (inside) { @@ -483,16 +483,16 @@ void Button::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) clicked = activated = false; } -void Button::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void Button::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { - uint32 addr = (extents.x + offsetX) + ((extents.y + offsetY) * pitch); + uint32_t addr = (extents.x + offsetX) + ((extents.y + offsetY) * pitch); if (text.length() > 0) // Simple text button // if (pic == NULL) { - for(uint32 y=0; y 010011 11111 10000 -> 0100 1101 1111 1111 1000 0100 -> 4D FF 84 @@ -714,17 +714,17 @@ class Window: public Element list.push_back(close); close->SetNotificationElement(this); } virtual ~Window(); - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element * e); void AddElement(Element * e); // bool WindowActive(void) { return true; }//return !close->ButtonClicked(); } protected: // bool clicked, inside; - uint32 fgColor, bgColor; + uint32_t fgColor, bgColor; void (* handler)(Element *); Button * close; //We have to use a list of Element *pointers* because we can't make a list that will hold @@ -734,12 +734,12 @@ class Window: public Element Window::~Window() { - for(uint32 i=0; iHandleKey(key); } -void Window::HandleMouseMove(uint32 x, uint32 y) +void Window::HandleMouseMove(uint32_t x, uint32_t y) { // Handle the items this window contains... - for(uint32 i=0; iHandleMouseMove(x - extents.x, y - extents.y); } -void Window::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void Window::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); } -void Window::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void Window::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { - uint32 addr = (extents.x + offsetX) + ((extents.y + offsetY) * pitch); + uint32_t addr = (extents.x + offsetX) + ((extents.y + offsetY) * pitch); - for(uint32 y=0; yDraw(extents.x, extents.y); } @@ -812,28 +812,28 @@ void Window::Notify(Element * e) class Text: public Element { public: -// Text(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0): Element(x, y, w, h), +// Text(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0): Element(x, y, w, h), // fgColor(0x4FF0), bgColor(0xFE10) {} -// Text(uint32 x, uint32 y, string s, uint16 fg = 0x4FF0, uint16 bg = 0xFE10): Element(x, y, 0, 0), +// Text(uint32_t x, uint32_t y, string s, uint16_t fg = 0x4FF0, uint16_t bg = 0xFE10): Element(x, y, 0, 0), // fgColor(fg), bgColor(bg), text(s) {} //4FF0 -> 010011 11111 10000 -> 0100 1101 1111 1111 1000 0100 -> 4D FF 84 //FE10 -> 111111 10000 10000 -> 1111 1111 1000 0100 1000 0100 -> FF 84 84 - Text(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0): Element(x, y, w, h), + Text(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0): Element(x, y, w, h), fgColor(0xFF8484FF), bgColor(0xFF84FF4D) {} - Text(uint32 x, uint32 y, string s, uint32 fg = 0xFF8484FF, uint32 bg = 0xFF84FF4D): + Text(uint32_t x, uint32_t y, string s, uint32_t fg = 0xFF8484FF, uint32_t bg = 0xFF84FF4D): Element(x, y, 0, 0), fgColor(fg), bgColor(bg), text(s) {} - virtual void HandleKey(SDLKey key) {} - virtual void HandleMouseMove(uint32 x, uint32 y) {} - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) {} - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + virtual void HandleKey(SDL_Scancode key) {} + virtual void HandleMouseMove(uint32_t x, uint32_t y) {} + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) {} + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element *) {} protected: - uint32 fgColor, bgColor; + uint32_t fgColor, bgColor; string text; }; -void Text::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void Text::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { if (text.length() > 0) // DrawString(screenBuffer, extents.x + offsetX, extents.y + offsetY, false, "%s", text.c_str()); @@ -848,19 +848,19 @@ void Text::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) class Image: public Element { public: - Image(uint32 x, uint32 y, const void * img): Element(x, y, 0, 0), image(img) {} - virtual void HandleKey(SDLKey key) {} - virtual void HandleMouseMove(uint32 x, uint32 y) {} - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) {} - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + Image(uint32_t x, uint32_t y, const void * img): Element(x, y, 0, 0), image(img) {} + virtual void HandleKey(SDL_Scancode key) {} + virtual void HandleMouseMove(uint32_t x, uint32_t y) {} + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) {} + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element *) {} protected: - uint32 fgColor, bgColor; + uint32_t fgColor, bgColor; const void * image; }; -void Image::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void Image::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { if (image != NULL) DrawTransparentBitmap(screenBuffer, extents.x + offsetX, extents.y + offsetY, image); @@ -874,27 +874,27 @@ void Image::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) class TextEdit: public Element { public: - TextEdit(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0): Element(x, y, w, h), + TextEdit(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0): Element(x, y, w, h), fgColor(0xFF8484FF), bgColor(0xFF84FF4D), text(""), caretPos(0), maxScreenSize(10) {} - TextEdit(uint32 x, uint32 y, string s, uint32 mss = 10, uint32 fg = 0xFF8484FF, - uint32 bg = 0xFF84FF4D): Element(x, y, 0, 0), fgColor(fg), bgColor(bg), text(s), + TextEdit(uint32_t x, uint32_t y, string s, uint32_t mss = 10, uint32_t fg = 0xFF8484FF, + uint32_t bg = 0xFF84FF4D): Element(x, y, 0, 0), fgColor(fg), bgColor(bg), text(s), caretPos(0), maxScreenSize(mss) {} - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y) {} - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) {} - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y) {} + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) {} + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element *) {} protected: - uint32 fgColor, bgColor; + uint32_t fgColor, bgColor; string text; - uint32 caretPos; - uint32 maxScreenSize; + uint32_t caretPos; + uint32_t maxScreenSize; }; //Set different filters depending on type passed in on construction, e.g., filename, amount, etc...? -void TextEdit::HandleKey(SDLKey key) +void TextEdit::HandleKey(SDL_Scancode key) { if ((key >= SDLK_a && key <= SDLK_z) || (key >= SDLK_0 && key <= SDLK_9) || key == SDLK_PERIOD || key == SDLK_SLASH) @@ -913,7 +913,7 @@ void TextEdit::HandleKey(SDLKey key) //left, right arrow } -void TextEdit::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void TextEdit::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { if (text.length() > 0) { @@ -934,15 +934,15 @@ class ListBox: public Element //class ListBox: public Window { public: -// ListBox(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0): Element(x, y, w, h), - ListBox(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0);//: Window(x, y, w, h), +// ListBox(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0): Element(x, y, w, h), + ListBox(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0);//: Window(x, y, w, h), // windowPtr(0), cursor(0), limit(0), charWidth((w / 8) - 1), charHeight(h / 8), // elementToTell(NULL), upArrow(w - 8, 0, upArrowBox), // downArrow(w - 8, h - 8, downArrowBox), upArrow2(w - 8, h - 16, upArrowBox) {} - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element * e); void SetNotificationElement(Element * e) { elementToTell = e; } void AddItem(string s); @@ -950,17 +950,17 @@ class ListBox: public Element protected: bool thumbClicked; - uint32 windowPtr, cursor, limit; - uint32 charWidth, charHeight; // Box width/height in characters + uint32_t windowPtr, cursor, limit; + uint32_t charWidth, charHeight; // Box width/height in characters Element * elementToTell; Button upArrow, downArrow, upArrow2; vector item; private: - uint32 yRelativePoint; + uint32_t yRelativePoint; }; -ListBox::ListBox(uint32 x, uint32 y, uint32 w, uint32 h): Element(x, y, w, h), +ListBox::ListBox(uint32_t x, uint32_t y, uint32_t w, uint32_t h): Element(x, y, w, h), thumbClicked(false), windowPtr(0), cursor(0), limit(0), charWidth((w / FONT_WIDTH) - 1), charHeight(h / FONT_HEIGHT), elementToTell(NULL), upArrow(w - 8, 0, upArrowBox), downArrow(w - 8, h - 8, downArrowBox), upArrow2(w - 8, h - 16, upArrowBox) @@ -971,7 +971,7 @@ ListBox::ListBox(uint32 x, uint32 y, uint32 w, uint32 h): Element(x, y, w, h), extents.w -= 8; // Make room for scrollbar... } -void ListBox::HandleKey(SDLKey key) +void ListBox::HandleKey(SDL_Scancode key) { if (key == SDLK_DOWN) { @@ -1019,9 +1019,9 @@ void ListBox::HandleKey(SDLKey key) else if (key >= SDLK_a && key <= SDLK_z) { // Advance cursor to filename with first letter pressed... - uint8 which = (key - SDLK_a) + 65; // Convert key to A-Z char + uint8_t which = (key - SDLK_a) + 65; // Convert key to A-Z char - for(uint32 i=0; i sbHeight - thumb) + if ((uint32_t)newThumbStart > sbHeight - thumb) newThumbStart = sbHeight - thumb; - windowPtr = (uint32)(((float)newThumbStart / (float)sbHeight) * (float)item.size()); + windowPtr = (uint32_t)(((float)newThumbStart / (float)sbHeight) * (float)item.size()); //Check for cursor bounds as well... Or do we need to??? //Actually, we don't...! } } -void ListBox::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void ListBox::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { if (Inside(x, y) && mouseDown) { @@ -1073,15 +1073,15 @@ void ListBox::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) } // Check for a hit on the scrollbar... - if (x > (uint32)(extents.x + extents.w) && x <= (uint32)(extents.x + extents.w + 8) - && y > (uint32)(extents.y + 8) && y <= (uint32)(extents.y + extents.h - 16)) + if (x > (uint32_t)(extents.x + extents.w) && x <= (uint32_t)(extents.x + extents.w + 8) + && y > (uint32_t)(extents.y + 8) && y <= (uint32_t)(extents.y + extents.h - 16)) { if (mouseDown) { // This shiaut should be calculated in AddItem(), not here... (or in Draw() for that matter) - uint32 sbHeight = extents.h - 24, - thumb = (uint32)(((float)limit / (float)item.size()) * (float)sbHeight), - thumbStart = (uint32)(((float)windowPtr / (float)item.size()) * (float)sbHeight); + uint32_t sbHeight = extents.h - 24, + thumb = (uint32_t)(((float)limit / (float)item.size()) * (float)sbHeight), + thumbStart = (uint32_t)(((float)windowPtr / (float)item.size()) * (float)sbHeight); // Did we hit the thumb? if (y >= (extents.y + 8 + thumbStart) && y < (extents.y + 8 + thumbStart + thumb)) @@ -1101,9 +1101,9 @@ void ListBox::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) upArrow2.HandleMouseButton(x - extents.x, y - extents.y, mouseDown); } -void ListBox::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void ListBox::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { - for(uint32 i=0; i= thumbStart + (extents.y+offsetY+8) && y < thumbStart + thumb + (extents.y+offsetY+8)) // screenBuffer[x + (y * pitch)] = (thumbClicked ? 0x458E : 0xFFFF); @@ -1196,12 +1196,12 @@ string ListBox::GetSelectedItem(void) class FileList: public Window { public: - FileList(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0); + FileList(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0); virtual ~FileList() {} - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y) { Window::HandleMouseMove(x, y); } - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) { Window::HandleMouseButton(x, y, mouseDown); } - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0) { Window::Draw(offsetX, offsetY); } + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y) { Window::HandleMouseMove(x, y); } + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { Window::HandleMouseButton(x, y, mouseDown); } + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0) { Window::Draw(offsetX, offsetY); } virtual void Notify(Element * e); protected: @@ -1210,7 +1210,7 @@ class FileList: public Window }; //Need 4 buttons, one scrollbar... -FileList::FileList(uint32 x, uint32 y, uint32 w, uint32 h): Window(x, y, w, h) +FileList::FileList(uint32_t x, uint32_t y, uint32_t w, uint32_t h): Window(x, y, w, h) { files = new ListBox(8, 8, w - 16, h - 32); AddElement(files); @@ -1243,7 +1243,7 @@ FileList::FileList(uint32 x, uint32 y, uint32 w, uint32 h): Window(x, y, w, h) } } -void FileList::HandleKey(SDLKey key) +void FileList::HandleKey(SDL_Scancode key) { if (key == SDLK_RETURN) Notify(load); @@ -1264,7 +1264,7 @@ void FileList::Notify(Element * e) strcat(filename, files->GetSelectedItem().c_str()); -// uint32 romSize = JaguarLoadROM(jaguar_mainRom, filename); +// uint32_t romSize = JaguarLoadROM(jaguar_mainRom, filename); // JaguarLoadCart(jaguar_mainRom, filename); if (JaguarLoadFile(filename)) { @@ -1300,9 +1300,9 @@ struct NameAction { string name; Window * (* action)(void); - SDLKey hotKey; + SDL_Scancode hotKey; - NameAction(string n, Window * (* a)(void) = NULL, SDLKey k = SDLK_UNKNOWN): name(n), + NameAction(string n, Window * (* a)(void) = NULL, SDL_Scancode k = SDLK_UNKNOWN): name(n), action(a), hotKey(k) {} }; @@ -1310,13 +1310,13 @@ class MenuItems { public: MenuItems(): charLength(0) {} - bool Inside(uint32 x, uint32 y) - { return (x >= (uint32)extents.x && x < (uint32)(extents.x + extents.w) - && y >= (uint32)extents.y && y < (uint32)(extents.y + extents.h) ? true : false); } + bool Inside(uint32_t x, uint32_t y) + { return (x >= (uint32_t)extents.x && x < (uint32_t)(extents.x + extents.w) + && y >= (uint32_t)extents.y && y < (uint32_t)(extents.y + extents.h) ? true : false); } string title; vector item; - uint32 charLength; + uint32_t charLength; SDL_Rect extents; }; @@ -1325,40 +1325,40 @@ class Menu: public Element public: // 1CFF -> 0 001 11 00 111 1 1111 // 421F -> 0 100 00 10 000 1 1111 - Menu(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = FONT_HEIGHT, -/* uint16 fgc = 0x1CFF, uint16 bgc = 0x000F, uint16 fgch = 0x421F, - uint16 bgch = 0x1CFF): Element(x, y, w, h), activated(false), clicked(false),*/ -/* uint32 fgc = 0xFF3F3F00, uint32 bgc = 0x7F000000, uint32 fgch = 0xFF878700, - uint32 bgch = 0xFF3F3F00): Element(x, y, w, h), activated(false), clicked(false),*/ -/* uint32 fgc = 0xFFFF3F3F, uint32 bgc = 0xFF7F0000, uint32 fgch = 0xFFFF8787, - uint32 bgch = 0xFFFF3F3F): Element(x, y, w, h), activated(false), clicked(false),*/ - uint32 fgc = 0xFF7F0000, uint32 bgc = 0xFFFF3F3F, uint32 fgch = 0xFFFF3F3F, - uint32 bgch = 0xFFFF8787): Element(x, y, w, h), activated(false), clicked(false), + Menu(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = FONT_HEIGHT, +/* uint16_t fgc = 0x1CFF, uint16_t bgc = 0x000F, uint16_t fgch = 0x421F, + uint16_t bgch = 0x1CFF): Element(x, y, w, h), activated(false), clicked(false),*/ +/* uint32_t fgc = 0xFF3F3F00, uint32_t bgc = 0x7F000000, uint32_t fgch = 0xFF878700, + uint32_t bgch = 0xFF3F3F00): Element(x, y, w, h), activated(false), clicked(false),*/ +/* uint32_t fgc = 0xFFFF3F3F, uint32_t bgc = 0xFF7F0000, uint32_t fgch = 0xFFFF8787, + uint32_t bgch = 0xFFFF3F3F): Element(x, y, w, h), activated(false), clicked(false),*/ + uint32_t fgc = 0xFF7F0000, uint32_t bgc = 0xFFFF3F3F, uint32_t fgch = 0xFFFF3F3F, + uint32_t bgch = 0xFFFF8787): Element(x, y, w, h), activated(false), clicked(false), inside(0), insidePopup(0), fgColor(fgc), bgColor(bgc), fgColorHL(fgch), bgColorHL(bgch), menuChosen(-1), menuItemChosen(-1) {} - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0); virtual void Notify(Element *) {} void Add(MenuItems mi); protected: bool activated, clicked; - uint32 inside, insidePopup; -// uint16 fgColor, bgColor, fgColorHL, bgColorHL; - uint32 fgColor, bgColor, fgColorHL, bgColorHL; + uint32_t inside, insidePopup; +// uint16_t fgColor, bgColor, fgColorHL, bgColorHL; + uint32_t fgColor, bgColor, fgColorHL, bgColorHL; int menuChosen, menuItemChosen; private: vector itemList; }; -void Menu::HandleKey(SDLKey key) +void Menu::HandleKey(SDL_Scancode key) { - for(uint32 i=0; i= xpos && x < xpos + width) { @@ -1411,7 +1411,7 @@ void Menu::HandleMouseMove(uint32 x, uint32 y) } } -void Menu::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void Menu::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { if (!clicked) { @@ -1454,15 +1454,15 @@ void Menu::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) } } -void Menu::Draw(uint32 offsetX/*= 0*/, uint32 offsetY/*= 0*/) +void Menu::Draw(uint32_t offsetX/*= 0*/, uint32_t offsetY/*= 0*/) { - uint32 xpos = extents.x + offsetX; + uint32_t xpos = extents.x + offsetX; - for(uint32 i=0; i mi.charLength) mi.charLength = mi.item[i].name.length(); @@ -1519,23 +1519,23 @@ void Menu::Add(MenuItems mi) RootWindow(Menu * m, Window * w = NULL): menu(m), window(w) {} //Do we even need to care about this crap? // { extents.x = extents.y = 0, extents.w = 320, extents.h = 240; } - virtual void HandleKey(SDLKey key) {} - virtual void HandleMouseMove(uint32 x, uint32 y) {} - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) {} - virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0) {} + virtual void HandleKey(SDL_Scancode key) {} + virtual void HandleMouseMove(uint32_t x, uint32_t y) {} + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) {} + virtual void Draw(uint32_t offsetX = 0, uint32_t offsetY = 0) {} virtual void Notify(Element *) {} private: Menu * menu; Window * window; - int16 * rootImage[1280 * 240 * 2]; + int16_t * rootImage[1280 * 240 * 2]; };//*/ // // Draw text at the given x/y coordinates. Can invert text as well. // -void DrawString(uint32 * screen, uint32 x, uint32 y, bool invert, const char * text, ...) +void DrawString(uint32_t * screen, uint32_t x, uint32_t y, bool invert, const char * text, ...) { char string[4096]; va_list arg; @@ -1544,32 +1544,32 @@ void DrawString(uint32 * screen, uint32 x, uint32 y, bool invert, const char * t vsprintf(string, text, arg); va_end(arg); - uint32 pitch = sdlemuGetOverlayWidthInPixels();//GetSDLScreenWidthInPixels(); - uint32 length = strlen(string), address = x + (y * pitch); + uint32_t pitch = sdlemuGetOverlayWidthInPixels();//GetSDLScreenWidthInPixels(); + uint32_t length = strlen(string), address = x + (y * pitch); - uint32 color1 = 0x0080FF; - uint8 nBlue = (color1 >> 16) & 0xFF, nGreen = (color1 >> 8) & 0xFF, nRed = color1 & 0xFF; - uint8 xorMask = (invert ? 0xFF : 0x00); + uint32_t color1 = 0x0080FF; + uint8_t nBlue = (color1 >> 16) & 0xFF, nGreen = (color1 >> 8) & 0xFF, nRed = color1 & 0xFF; + uint8_t xorMask = (invert ? 0xFF : 0x00); - for(uint32 i=0; i> 16) & 0xFF, + uint8_t eBlue = (existingColor >> 16) & 0xFF, eGreen = (existingColor >> 8) & 0xFF, eRed = existingColor & 0xFF; - uint8 trans = font2[fontAddr] ^ xorMask; - uint8 invTrans = trans ^ 0xFF; + uint8_t trans = font2[fontAddr] ^ xorMask; + uint8_t invTrans = trans ^ 0xFF; - uint32 bRed = (eRed * invTrans + nRed * trans) / 255, + uint32_t bRed = (eRed * invTrans + nRed * trans) / 255, bGreen = (eGreen * invTrans + nGreen * trans) / 255, bBlue = (eBlue * invTrans + nBlue * trans) / 255; @@ -1585,7 +1585,7 @@ void DrawString(uint32 * screen, uint32 x, uint32 y, bool invert, const char * t // // Draw text at the given x/y coordinates, using FG/BG colors. // -void DrawStringOpaque(uint32 * screen, uint32 x, uint32 y, uint32 color1, uint32 color2, const char * text, ...) +void DrawStringOpaque(uint32_t * screen, uint32_t x, uint32_t y, uint32_t color1, uint32_t color2, const char * text, ...) { char string[4096]; va_list arg; @@ -1594,28 +1594,28 @@ void DrawStringOpaque(uint32 * screen, uint32 x, uint32 y, uint32 color1, uint32 vsprintf(string, text, arg); va_end(arg); - uint32 pitch = sdlemuGetOverlayWidthInPixels(); - uint32 length = strlen(string), address = x + (y * pitch); + uint32_t pitch = sdlemuGetOverlayWidthInPixels(); + uint32_t length = strlen(string), address = x + (y * pitch); - uint8 eBlue = (color2 >> 16) & 0xFF, eGreen = (color2 >> 8) & 0xFF, eRed = color2 & 0xFF, + uint8_t eBlue = (color2 >> 16) & 0xFF, eGreen = (color2 >> 8) & 0xFF, eRed = color2 & 0xFF, nBlue = (color1 >> 16) & 0xFF, nGreen = (color1 >> 8) & 0xFF, nRed = color1 & 0xFF; - for(uint32 i=0; i> 16) & 0xFF, + uint8_t eBlue = (existingColor >> 16) & 0xFF, eGreen = (existingColor >> 8) & 0xFF, eRed = existingColor & 0xFF, //This could be done ahead of time, instead of on each pixel... @@ -1663,11 +1663,11 @@ void DrawStringTrans(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 tr //This could be sped up by using a table of 5 + 5 + 5 bits (32 levels transparency -> 32768 entries) //Here we've modified it to have 33 levels of transparency (could have any # we want!) //because dividing by 32 is faster than dividing by 31...! - uint8 invTrans = 32 - trans; + uint8_t invTrans = 32 - trans; - uint32 bRed = (eRed * trans + nRed * invTrans) / 32; - uint32 bGreen = (eGreen * trans + nGreen * invTrans) / 32; - uint32 bBlue = (eBlue * trans + nBlue * invTrans) / 32; + uint32_t bRed = (eRed * trans + nRed * invTrans) / 32; + uint32_t bGreen = (eGreen * trans + nGreen * invTrans) / 32; + uint32_t bBlue = (eBlue * trans + nBlue * invTrans) / 32; *(screen + address + xx + (yy * pitch)) = 0xFF000000 | (bBlue << 16) | (bGreen << 8) | bRed; } @@ -1683,7 +1683,7 @@ void DrawStringTrans(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 tr // // Draw text at the given x/y coordinates, using FG color and overlay alpha blending. // -void DrawString2(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 transparency, const char * text, ...) +void DrawString2(uint32_t * screen, uint32_t x, uint32_t y, uint32_t color, uint8_t transparency, const char * text, ...) { char string[4096]; va_list arg; @@ -1692,24 +1692,24 @@ void DrawString2(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 transp vsprintf(string, text, arg); va_end(arg); - uint32 pitch = sdlemuGetOverlayWidthInPixels(); - uint32 length = strlen(string), address = x + (y * pitch); + uint32_t pitch = sdlemuGetOverlayWidthInPixels(); + uint32_t length = strlen(string), address = x + (y * pitch); color &= 0x00FFFFFF; // Just in case alpha was passed in... - for(uint32 i=0; i> 8) & 0xFF, eBlue = (existingColor >> 16) & 0xFF, @@ -1758,12 +1758,12 @@ void DrawString2(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 transp nGreen = (color >> 8) & 0xFF, nBlue = (color >> 16) & 0xFF; - uint8 invTrans = 255 - trans; - uint32 bRed = (eRed * trans + nRed * invTrans) / 255; - uint32 bGreen = (eGreen * trans + nGreen * invTrans) / 255; - uint32 bBlue = (eBlue * trans + nBlue * invTrans) / 255; + uint8_t invTrans = 255 - trans; + uint32_t bRed = (eRed * trans + nRed * invTrans) / 255; + uint32_t bGreen = (eGreen * trans + nGreen * invTrans) / 255; + uint32_t bBlue = (eBlue * trans + nBlue * invTrans) / 255; - uint32 blendedColor = 0xFF000000 | bRed | (bGreen << 8) | (bBlue << 16); + uint32_t blendedColor = 0xFF000000 | bRed | (bGreen << 8) | (bBlue << 16); *(screen + address + xx + (yy * pitch)) = blendedColor; @@ -1774,28 +1774,28 @@ void DrawString2(uint32 * screen, uint32 x, uint32 y, uint32 color, uint8 transp } } }*/ -void DrawTransparentBitmapDeprecated(uint32 * screen, uint32 x, uint32 y, uint32 * bitmap) +void DrawTransparentBitmapDeprecated(uint32_t * screen, uint32_t x, uint32_t y, uint32_t * bitmap) { - uint32 width = bitmap[0], height = bitmap[1]; + uint32_t width = bitmap[0], height = bitmap[1]; bitmap += 2; - uint32 pitch = sdlemuGetOverlayWidthInPixels();//GetSDLScreenWidthInPixels(); - uint32 address = x + (y * pitch); + uint32_t pitch = sdlemuGetOverlayWidthInPixels();//GetSDLScreenWidthInPixels(); + uint32_t address = x + (y * pitch); - for(uint32 yy=0; yy> 24 != 0x00) // Pixel needs blending { - uint8 trans = color >> 24; - uint8 invTrans = trans ^ 0xFF;//255 - trans; + uint8_t trans = color >> 24; + uint8_t invTrans = trans ^ 0xFF;//255 - trans; - uint8 eRed = existingColor & 0xFF, + uint8_t eRed = existingColor & 0xFF, eGreen = (existingColor >> 8) & 0xFF, eBlue = (existingColor >> 16) & 0xFF, @@ -1803,9 +1803,9 @@ void DrawTransparentBitmapDeprecated(uint32 * screen, uint32 x, uint32 y, uint32 nGreen = (color >> 8) & 0xFF, nBlue = (color >> 16) & 0xFF; - uint32 bRed = (eRed * invTrans + nRed * trans) / 255; - uint32 bGreen = (eGreen * invTrans + nGreen * trans) / 255; - uint32 bBlue = (eBlue * invTrans + nBlue * trans) / 255; + uint32_t bRed = (eRed * invTrans + nRed * trans) / 255; + uint32_t bGreen = (eGreen * invTrans + nGreen * trans) / 255; + uint32_t bBlue = (eBlue * invTrans + nBlue * trans) / 255; blendedColor = 0xFF000000 | bRed | (bGreen << 8) | (bBlue << 16); } @@ -1816,26 +1816,26 @@ void DrawTransparentBitmapDeprecated(uint32 * screen, uint32 x, uint32 y, uint32 } } -void DrawTransparentBitmap(uint32 * screen, uint32 x, uint32 y, const void * bitmap) +void DrawTransparentBitmap(uint32_t * screen, uint32_t x, uint32_t y, const void * bitmap) { - uint32 pitch = sdlemuGetOverlayWidthInPixels(); - uint32 address = x + (y * pitch); - uint32 count = 0; + uint32_t pitch = sdlemuGetOverlayWidthInPixels(); + uint32_t address = x + (y * pitch); + uint32_t count = 0; - for(uint32 yy=0; yy<((Bitmap *)bitmap)->height; yy++) + for(uint32_t yy=0; yy<((Bitmap *)bitmap)->height; yy++) { - for(uint32 xx=0; xx<((Bitmap *)bitmap)->width; xx++) + for(uint32_t xx=0; xx<((Bitmap *)bitmap)->width; xx++) { - uint32 color = ((uint32 *)((Bitmap *)bitmap)->pixelData)[count]; - uint32 blendedColor = color; - uint32 existingColor = *(screen + address + xx + (yy * pitch)); + uint32_t color = ((uint32_t *)((Bitmap *)bitmap)->pixelData)[count]; + uint32_t blendedColor = color; + uint32_t existingColor = *(screen + address + xx + (yy * pitch)); if (existingColor >> 24 != 0x00) // Pixel needs blending { - uint8 trans = color >> 24; - uint8 invTrans = trans ^ 0xFF; + uint8_t trans = color >> 24; + uint8_t invTrans = trans ^ 0xFF; - uint8 eRed = existingColor & 0xFF, + uint8_t eRed = existingColor & 0xFF, eGreen = (existingColor >> 8) & 0xFF, eBlue = (existingColor >> 16) & 0xFF, @@ -1843,9 +1843,9 @@ void DrawTransparentBitmap(uint32 * screen, uint32 x, uint32 y, const void * bit nGreen = (color >> 8) & 0xFF, nBlue = (color >> 16) & 0xFF; - uint32 bRed = (eRed * invTrans + nRed * trans) / 255; - uint32 bGreen = (eGreen * invTrans + nGreen * trans) / 255; - uint32 bBlue = (eBlue * invTrans + nBlue * trans) / 255; + uint32_t bRed = (eRed * invTrans + nRed * trans) / 255; + uint32_t bGreen = (eGreen * invTrans + nGreen * trans) / 255; + uint32_t bBlue = (eBlue * invTrans + nBlue * trans) / 255; // Instead of $FF, should use the alpha from the destination pixel as the final alpha value... blendedColor = 0xFF000000 | bRed | (bGreen << 8) | (bBlue << 16); @@ -1860,17 +1860,17 @@ void DrawTransparentBitmap(uint32 * screen, uint32 x, uint32 y, const void * bit // // Draw a bitmap without using blending // -void DrawBitmap(uint32 * screen, uint32 x, uint32 y, const void * bitmap) +void DrawBitmap(uint32_t * screen, uint32_t x, uint32_t y, const void * bitmap) { - uint32 pitch = sdlemuGetOverlayWidthInPixels(); - uint32 address = x + (y * pitch); - uint32 count = 0; + uint32_t pitch = sdlemuGetOverlayWidthInPixels(); + uint32_t address = x + (y * pitch); + uint32_t count = 0; - for(uint32 yy=0; yy<((Bitmap *)bitmap)->height; yy++) + for(uint32_t yy=0; yy<((Bitmap *)bitmap)->height; yy++) { - for(uint32 xx=0; xx<((Bitmap *)bitmap)->width; xx++) + for(uint32_t xx=0; xx<((Bitmap *)bitmap)->width; xx++) { - *(screen + address + xx + (yy * pitch)) = ((uint32 *)((Bitmap *)bitmap)->pixelData)[count]; + *(screen + address + xx + (yy * pitch)) = ((uint32_t *)((Bitmap *)bitmap)->pixelData)[count]; count++; } } @@ -1879,14 +1879,14 @@ void DrawBitmap(uint32 * screen, uint32 x, uint32 y, const void * bitmap) // // Fill a portion of the screen with the passed in color // -void FillScreenRectangle(uint32 * screen, uint32 x, uint32 y, uint32 w, uint32 h, uint32 color) -//void ClearScreenRectangle(uint32 * screen, uint32 x, uint32 y, uint32 w, uint32 h) +void FillScreenRectangle(uint32_t * screen, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color) +//void ClearScreenRectangle(uint32_t * screen, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { - uint32 pitch = sdlemuGetOverlayWidthInPixels(); - uint32 address = x + (y * pitch); + uint32_t pitch = sdlemuGetOverlayWidthInPixels(); + uint32_t address = x + (y * pitch); - for(uint32 yy=0; yy 000100 01000 10001 -> 0001 0000 0100 0010 1000 1100 -> 10 42 8C - for(uint32 i=0; iHandleMouseButton(mx, my, true); @@ -2085,7 +2085,7 @@ WriteLog("GUI: Entering main loop...\n"); } else if (event.type == SDL_MOUSEBUTTONUP) { - uint32 mx = event.button.x, my = event.button.y; + uint32_t mx = event.button.x, my = event.button.y; if (mainWindow) mainWindow->HandleMouseButton(mx, my, false); @@ -2120,7 +2120,7 @@ WriteLog("GUI: Entering main loop...\n"); mainWindow->Draw(); #endif -/*uint32 pBGS[6 * 8 + 3] = { 6, 8, 4, +/*uint32_t pBGS[6 * 8 + 3] = { 6, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2133,19 +2133,19 @@ WriteLog("GUI: Entering main loop...\n"); //This isn't working... Why???? //It's because DrawTransparentBitmap does alpha blending if it detects zero in the alpha channel. //So why do it that way? Hm. - overlayPixels = (uint32 *)sdlemuGetOverlayPixels(); + overlayPixels = (uint32_t *)sdlemuGetOverlayPixels(); #ifdef NEW_BACKSTORE_METHOD // DrawTransparentBitmapDeprecated(overlayPixels, oldMouseX, oldMouseY, pointerBGSave); // DrawTransparentBitmap(overlayPixels, oldMouseX, oldMouseY, pBGS); - for(uint32 y=0; y> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF; + uint32_t pixel = backbuffer[i]; + uint8_t b = (pixel >> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF; pixel = ((r + g + b) / 3) & 0x00FF; backbuffer[i] = 0xFF000000 | (pixel << 16) | (pixel << 8); } @@ -2217,16 +2217,16 @@ return NULL;//*/ //This is crappy... !!! FIX !!! extern bool finished, showGUI; -// uint32 nFrame = 0, nFrameskip = 0; - uint32 totalFrames = 0; +// uint32_t nFrame = 0, nFrameskip = 0; + uint32_t totalFrames = 0; finished = false; bool showMessage = true; - uint32 showMsgFrames = 120; - uint8 transparency = 0; + uint32_t showMsgFrames = 120; + uint8_t transparency = 0; // Pass a message to the "joystick" code to debounce the ESC key... debounceRunKey = true; - uint32 cartType = 4; + uint32_t cartType = 4; if (jaguarRomSize == 0x200000) cartType = 0; else if (jaguarRomSize == 0x400000) @@ -2237,7 +2237,7 @@ return NULL;//*/ cartType = 3; char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" }; - uint32 elapsedTicks = SDL_GetTicks(), frameCount = 0, framesPerSecond = 0; + uint32_t elapsedTicks = SDL_GetTicks(), frameCount = 0, framesPerSecond = 0; while (true) { @@ -2259,7 +2259,7 @@ return NULL;//*/ // Some QnD GUI stuff here... if (showGUI) { - extern uint32 gpu_pc, dsp_pc; + extern uint32_t gpu_pc, dsp_pc; DrawString(backbuffer, 8, 8, false, "GPU PC: %08X", gpu_pc); DrawString(backbuffer, 8, 16, false, "DSP PC: %08X", dsp_pc); DrawString(backbuffer, 8, 32, false, "%u FPS", framesPerSecond); @@ -2269,9 +2269,9 @@ return NULL;//*/ { // FF0F -> 1111 11 11 000 0 1111 -> 3F 18 0F // 3FE3 -> 0011 11 11 111 0 0011 -> 0F 3F 03 -/* DrawStringTrans((uint32 *)backbuffer, 8, 24*8, 0xFF0F, transparency, "Running..."); - DrawStringTrans((uint32 *)backbuffer, 8, 26*8, 0x3FE3, transparency, "%s, run address: %06X", cartTypeName[cartType], jaguarRunAddress); - DrawStringTrans((uint32 *)backbuffer, 8, 27*8, 0x3FE3, transparency, "CRC: %08X", jaguar_mainRom_crc32);//*/ +/* DrawStringTrans((uint32_t *)backbuffer, 8, 24*8, 0xFF0F, transparency, "Running..."); + DrawStringTrans((uint32_t *)backbuffer, 8, 26*8, 0x3FE3, transparency, "%s, run address: %06X", cartTypeName[cartType], jaguarRunAddress); + DrawStringTrans((uint32_t *)backbuffer, 8, 27*8, 0x3FE3, transparency, "CRC: %08X", jaguar_mainRom_crc32);//*/ //first has wrong color. !!! FIX !!! DrawStringTrans(backbuffer, 8, 24*8, 0xFF7F63FF, transparency, "Running..."); DrawStringTrans(backbuffer, 8, 26*8, 0xFF1FFF3F, transparency, "%s, run address: %06X", cartTypeName[cartType], jaguarRunAddress); @@ -2301,15 +2301,15 @@ doGPUDis = true;//*/ } // Reset the pitch, since it may have been changed in-game... - Element::SetScreenAndPitch((uint32 *)backbuffer, GetSDLScreenWidthInPixels()); + Element::SetScreenAndPitch((uint32_t *)backbuffer, GetSDLScreenWidthInPixels()); // Save the background for the GUI... // memcpy(background, backbuffer, tom_getVideoModeWidth() * 240 * 2); // In this case, we squash the color to monochrome, then force it to blue + green... - for(uint32 i=0; i> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF; + uint32_t pixel = backbuffer[i]; + uint8_t b = (pixel >> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF; pixel = ((r + g + b) / 3) & 0x00FF; background[i] = 0xFF000000 | (pixel << 16) | (pixel << 8); } @@ -2322,8 +2322,8 @@ doGPUDis = true;//*/ bool debounceRunKey = true; Window * RunEmu(void) { - extern uint32 * backbuffer; - uint32 * overlayPixels = (uint32 *)sdlemuGetOverlayPixels(); + extern uint32_t * backbuffer; + uint32_t * overlayPixels = (uint32_t *)sdlemuGetOverlayPixels(); memset(overlayPixels, 0x00, 640 * 480 * 4); // Clear out overlay... //This is crappy... !!! FIX !!! @@ -2331,16 +2331,16 @@ Window * RunEmu(void) sdlemuDisableOverlay(); -// uint32 nFrame = 0, nFrameskip = 0; - uint32 totalFrames = 0; +// uint32_t nFrame = 0, nFrameskip = 0; + uint32_t totalFrames = 0; finished = false; bool showMessage = true; - uint32 showMsgFrames = 120; - uint8 transparency = 0xFF; + uint32_t showMsgFrames = 120; + uint8_t transparency = 0xFF; // Pass a message to the "joystick" code to debounce the ESC key... debounceRunKey = true; - uint32 cartType = 4; + uint32_t cartType = 4; if (jaguarRomSize == 0x200000) cartType = 0; else if (jaguarRomSize == 0x400000) @@ -2351,7 +2351,7 @@ Window * RunEmu(void) cartType = 3; char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" }; - uint32 elapsedTicks = SDL_GetTicks(), frameCount = 0, framesPerSecond = 0; + uint32_t elapsedTicks = SDL_GetTicks(), frameCount = 0, framesPerSecond = 0; while (!finished) { @@ -2376,7 +2376,7 @@ else if (showGUI) { FillScreenRectangle(overlayPixels, 8, 1*FONT_HEIGHT, 128, 4*FONT_HEIGHT, 0x00000000); - extern uint32 gpu_pc, dsp_pc; + extern uint32_t gpu_pc, dsp_pc; DrawString(overlayPixels, 8, 1*FONT_HEIGHT, false, "GPU PC: %08X", gpu_pc); DrawString(overlayPixels, 8, 2*FONT_HEIGHT, false, "DSP PC: %08X", dsp_pc); DrawString(overlayPixels, 8, 4*FONT_HEIGHT, false, "%u FPS", framesPerSecond); @@ -2412,10 +2412,10 @@ doGPUDis = true;//*/ // Save the background for the GUI... // In this case, we squash the color to monochrome, then force it to blue + green... - for(uint32 i=0; i> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF; + uint32_t pixel = backbuffer[i]; + uint8_t b = (pixel >> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF; pixel = ((r + g + b) / 3) & 0x00FF; backbuffer[i] = 0xFF000000 | (pixel << 16) | (pixel << 8); } @@ -2444,8 +2444,8 @@ Window * About(void) //fprintf(fp, "VirtualJaguar v1.0.8 (Last full build was on %s %s)\n", __DATE__, __TIME__); //VirtualJaguar v1.0.8 (Last full build was on Dec 30 2004 20:01:31) //Hardwired, bleh... !!! FIX !!! -uint32 width = 55 * FONT_WIDTH, height = 18 * FONT_HEIGHT; -uint32 xpos = (640 - width) / 2, ypos = (480 - height) / 2; +uint32_t width = 55 * FONT_WIDTH, height = 18 * FONT_HEIGHT; +uint32_t xpos = (640 - width) / 2, ypos = (480 - height) / 2; // Window * window = new Window(8, 16, 50 * FONT_WIDTH, 21 * FONT_HEIGHT); Window * window = new Window(xpos, ypos, width, height); // window->AddElement(new Text(8, 8, "Virtual Jaguar 1.0.8")); @@ -2485,8 +2485,8 @@ Window * MiscOptions(void) window->AddElement(new TextEdit(88, 8, vjs.ROMPath, 20, 0xFF8484FF, 0xFF000000)); -/*TextEdit(uint32 x, uint32 y, string s, uint32 mss = 10, uint32 fg = 0xFF8484FF, - uint32 bg = 0xFF84FF4D): Element(x, y, 0, 0), fgColor(fg), bgColor(bg), text(s), +/*TextEdit(uint32_t x, uint32_t y, string s, uint32_t mss = 10, uint32_t fg = 0xFF8484FF, + uint32_t bg = 0xFF84FF4D): Element(x, y, 0, 0), fgColor(fg), bgColor(bg), text(s), caretPos(0), maxScreenSize(mss) {}*/ // Missing: // * BIOS path @@ -2506,11 +2506,11 @@ Window * MiscOptions(void) // // Generic ROM loading // -uint32 JaguarLoadROM(uint8 * rom, char * path) +uint32_t JaguarLoadROM(uint8_t * rom, char * path) { // We really should have some kind of sanity checking for the ROM size here to prevent // a buffer overflow... !!! FIX !!! - uint32 romSize = 0; + uint32_t romSize = 0; WriteLog("JaguarLoadROM: Attempting to load file '%s'...", path); char * ext = strrchr(path, '.'); @@ -2721,7 +2721,7 @@ Start of Data Segment = 0x00803dd0 */ if (jaguar_mainRom[0] == 0x60 && jaguar_mainRom[1] == 0x1B) { - uint32 loadAddress = GET32(jaguar_mainRom, 0x16), //runAddress = GET32(jaguar_mainRom, 0x2A), + uint32_t loadAddress = GET32(jaguar_mainRom, 0x16), //runAddress = GET32(jaguar_mainRom, 0x2A), codeSize = GET32(jaguar_mainRom, 0x02) + GET32(jaguar_mainRom, 0x06); WriteLog("GUI: Setting up homebrew (ABS-1)... Run address: %08X, length: %08X\n", loadAddress, codeSize); @@ -2741,7 +2741,7 @@ Start of Data Segment = 0x00803dd0 } else if (jaguar_mainRom[0] == 0x01 && jaguar_mainRom[1] == 0x50) { - uint32 loadAddress = GET32(jaguar_mainRom, 0x28), runAddress = GET32(jaguar_mainRom, 0x24), + uint32_t loadAddress = GET32(jaguar_mainRom, 0x28), runAddress = GET32(jaguar_mainRom, 0x24), codeSize = GET32(jaguar_mainRom, 0x18) + GET32(jaguar_mainRom, 0x1C); WriteLog("GUI: Setting up homebrew (ABS-2)... Run address: %08X, length: %08X\n", runAddress, codeSize); @@ -2772,11 +2772,11 @@ Start of Data Segment = 0x00803dd0 // Also, there's *always* a $601A header at position $00... if (jaguar_mainRom[0] == 0x60 && jaguar_mainRom[1] == 0x1A) { - uint32 loadAddress = GET32(jaguar_mainRom, 0x22), runAddress = GET32(jaguar_mainRom, 0x2A); + uint32_t loadAddress = GET32(jaguar_mainRom, 0x22), runAddress = GET32(jaguar_mainRom, 0x2A); //This is not always right! Especially when converted via bin2jag1!!! //We should have access to the length of the furshlumiger file that was loaded anyway! //Now, we do! ;-) -// uint32 progLength = GET32(jaguar_mainRom, 0x02); +// uint32_t progLength = GET32(jaguar_mainRom, 0x02); //jaguarRomSize //jaguarRunAddress // WriteLog("Jaguar: Setting up PD ROM... Run address: %08X, length: %08X\n", runAddress, progLength); diff --git a/src/gui/guimisc.h b/src/gui/guimisc.h index 84da874..30f3023 100755 --- a/src/gui/guimisc.h +++ b/src/gui/guimisc.h @@ -9,16 +9,16 @@ #include #include -#include "types.h" +#include // Useful structs struct Font { - Font(uint8 * d = NULL, uint32 w = 0, uint32 h = 0): data(d), width(w), height(h) {} + Font(uint8_t * d = NULL, uint32_t w = 0, uint32_t h = 0): data(d), width(w), height(h) {} - uint8 * data; - uint32 width, height; + uint8_t * data; + uint32_t width, height; }; // Okay, this is ugly but works and I can't think of any better way to handle this. So what @@ -40,13 +40,13 @@ struct Font // Global functions -//void SetFont(uint8 *, uint32, uint32); +//void SetFont(uint8_t *, uint32_t, uint32_t); void SetNewFont(Font); void RestoreOldFont(void); -uint32 GetFontWidth(void); -uint32 GetFontHeight(void); -void DrawStringTrans(SDL_Surface * screen, uint32 x, uint32 y, uint32 color, const char * text, ...); -void DrawStringOpaque(SDL_Surface * screen, uint32 x, uint32 y, uint32 fg, uint32 bg, const char * text, ...); +uint32_t GetFontWidth(void); +uint32_t GetFontHeight(void); +void DrawStringTrans(SDL_Surface * screen, uint32_t x, uint32_t y, uint32_t color, const char * text, ...); +void DrawStringOpaque(SDL_Surface * screen, uint32_t x, uint32_t y, uint32_t fg, uint32_t bg, const char * text, ...); //Not sure these belong here, but there you go... bool RectanglesIntersect(SDL_Rect r1, SDL_Rect r2); @@ -54,9 +54,9 @@ bool RectangleFirstInsideSecond(SDL_Rect r1, SDL_Rect r2); // GUI bitmaps (exported) -extern uint8 closeBox[]; -extern uint8 closeBoxDown[]; -extern uint8 closeBoxHover[]; -extern uint8 floppyDiskImg[]; +extern uint8_t closeBox[]; +extern uint8_t closeBoxDown[]; +extern uint8_t closeBoxHover[]; +extern uint8_t floppyDiskImg[]; #endif // __GUIMISC_H__ diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index f5c273e..4c30c37 100755 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -41,21 +41,21 @@ MenuItems::MenuItems(): charLength(0), popupBackstore(NULL) { } -bool MenuItems::Inside(uint32 x, uint32 y) +bool MenuItems::Inside(uint32_t x, uint32_t y) { - return (x >= (uint32)extents.x && x < (uint32)(extents.x + extents.w) - && y >= (uint32)extents.y && y < (uint32)(extents.y + extents.h) ? true : false); + return (x >= (uint32_t)extents.x && x < (uint32_t)(extents.x + extents.w) + && y >= (uint32_t)extents.y && y < (uint32_t)(extents.y + extents.h) ? true : false); } // // Menu class implementation // -Menu::Menu(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, - uint8 fgcR/*= 0x00*/, uint8 fgcG/*= 0x00*/, uint8 fgcB/*= 0x7F*/, uint8 fgcA/*= 0xFF*/, - uint8 bgcR/*= 0x3F*/, uint8 bgcG/*= 0x3F*/, uint8 bgcB/*= 0xFF*/, uint8 bgcA/*= 0xFF*/, - uint8 fgchR/*= 0x3F*/, uint8 fgchG/*= 0x3F*/, uint8 fgchB/*= 0xFF*/, uint8 fgchA/*= 0xFF*/, - uint8 bgchR/*= 0x87*/, uint8 bgchG/*= 0x87*/, uint8 bgchB/*= 0xFF*/, uint8 bgchA/*= 0xFF*/): +Menu::Menu(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, + uint8_t fgcR/*= 0x00*/, uint8_t fgcG/*= 0x00*/, uint8_t fgcB/*= 0x7F*/, uint8_t fgcA/*= 0xFF*/, + uint8_t bgcR/*= 0x3F*/, uint8_t bgcG/*= 0x3F*/, uint8_t bgcB/*= 0xFF*/, uint8_t bgcA/*= 0xFF*/, + uint8_t fgchR/*= 0x3F*/, uint8_t fgchG/*= 0x3F*/, uint8_t fgchB/*= 0xFF*/, uint8_t fgchA/*= 0xFF*/, + uint8_t bgchR/*= 0x87*/, uint8_t bgchG/*= 0x87*/, uint8_t bgchB/*= 0xFF*/, uint8_t bgchA/*= 0xFF*/): Element(x, y, w, GetFontHeight(), fgcR, fgcG, fgcB, fgcA, bgcR, bgcG, bgcB, bgcA), activated(false), clicked(false), inside(0), insidePopup(0), menuChosen(-1), menuItemChosen(-1), @@ -65,9 +65,9 @@ Menu::Menu(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, #if 0 // This *should* allow us to store our colors in an endian safe way... :-/ // Nope. Only on SW surfaces. With HW, all bets are off. :-( - uint8 * c = (uint8 *)&fgColorHL; + uint8_t * c = (uint8_t *)&fgColorHL; c[0] = fgchR, c[1] = fgchG, c[2] = fgchB, c[3] = fgchA; - c = (uint8 *)&bgColorHL; + c = (uint8_t *)&bgColorHL; c[0] = bgchR, c[1] = bgchG, c[2] = bgchB, c[3] = bgchA; #else fgColorHL = SDL_MapRGBA(screen->format, fgchR, fgchG, fgchB, fgchA); @@ -77,20 +77,20 @@ Menu::Menu(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, Menu::~Menu() { - for(uint32 i=0; i Inside Menu::HandleMouseMove()...\n"); @@ -121,11 +121,11 @@ WriteLog("--> Inside Menu::HandleMouseMove()...\n"); if (Inside(x, y)) { // Find out *where* we are inside the menu bar - uint32 xpos = extents.x; + uint32_t xpos = extents.x; - for(uint32 i=0; i= xpos && x < xpos + width) { @@ -152,7 +152,7 @@ WriteLog("--> Inside Menu::HandleMouseMove()...\n"); CheckStateAndRedrawIfNeeded(); } -void Menu::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void Menu::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { #ifdef DEBUG_MENU WriteLog("--> Inside Menu::HandleMouseButton()...\n"); @@ -201,13 +201,13 @@ WriteLog("--> Inside Menu::Draw()...\n"); #endif char separator[] = "--------------------------------------------------------"; - uint32 xpos = extents.x; + uint32_t xpos = extents.x; - for(uint32 i=0; i Attempting to prime pubs...\n pubs x/y/w/h = %u/%u/%u/%u\n s // Draw sub menu (but only if active) if (clicked) { - uint32 ypos = extents.y + GetFontHeight() + 1; + uint32_t ypos = extents.y + GetFontHeight() + 1; - for(uint32 i=0; i mi.charLength) mi.charLength = mi.item[i].name.length(); diff --git a/src/gui/menu.h b/src/gui/menu.h index c4c47a0..47ed93b 100755 --- a/src/gui/menu.h +++ b/src/gui/menu.h @@ -15,9 +15,9 @@ struct NameAction { std::string name; Element * (* action)(void); - SDLKey hotKey; + SDL_Scancode hotKey; - NameAction(std::string n, Element * (* a)(void) = NULL, SDLKey k = SDLK_UNKNOWN): name(n), + NameAction(std::string n, Element * (* a)(void) = NULL, SDL_Scancode k = SDL_SCANCODE_UNKNOWN): name(n), action(a), hotKey(k) {} }; @@ -25,11 +25,11 @@ class MenuItems { public: MenuItems(); - bool Inside(uint32 x, uint32 y); + bool Inside(uint32_t x, uint32_t y); std::string title; std::vector item; - uint32 charLength; + uint32_t charLength; SDL_Rect extents; SDL_Surface * popupBackstore; }; @@ -37,15 +37,15 @@ class MenuItems class Menu: public Element { public: - Menu(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, - uint8 fgcR = 0x00, uint8 fgcG = 0x00, uint8 fgcB = 0x7F, uint8 fgcA = 0xFF, - uint8 bgcR = 0x3F, uint8 bgcG = 0x3F, uint8 bgcB = 0xFF, uint8 bgcA = 0xFF, - uint8 fgchR = 0x3F, uint8 fgchG = 0x3F, uint8 fgchB = 0xFF, uint8 fgchA = 0xFF, - uint8 bgchR = 0x87, uint8 bgchG = 0x87, uint8 bgchB = 0xFF, uint8 bgchA = 0xFF); + Menu(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, + uint8_t fgcR = 0x00, uint8_t fgcG = 0x00, uint8_t fgcB = 0x7F, uint8_t fgcA = 0xFF, + uint8_t bgcR = 0x3F, uint8_t bgcG = 0x3F, uint8_t bgcB = 0xFF, uint8_t bgcA = 0xFF, + uint8_t fgchR = 0x3F, uint8_t fgchG = 0x3F, uint8_t fgchB = 0xFF, uint8_t fgchA = 0xFF, + uint8_t bgchR = 0x87, uint8_t bgchG = 0x87, uint8_t bgchB = 0xFF, uint8_t bgchA = 0xFF); ~Menu(); - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); virtual void Notify(Element *); void Add(MenuItems mi); @@ -54,14 +54,14 @@ class Menu: public Element protected: bool activated, clicked; - uint32 inside, insidePopup; + uint32_t inside, insidePopup; int menuChosen, menuItemChosen; - uint32 fgColorHL, bgColorHL; + uint32_t fgColorHL, bgColorHL; private: std::vector itemList; bool activatedSave, clickedSave; - uint32 insideSave, insidePopupSave; + uint32_t insideSave, insidePopupSave; int menuChosenSave, menuItemChosenSave; }; diff --git a/src/gui/text.cpp b/src/gui/text.cpp index d149035..0c7ea6d 100644 --- a/src/gui/text.cpp +++ b/src/gui/text.cpp @@ -8,13 +8,13 @@ #include "guimisc.h" -Text::Text(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, Element * parent/*= NULL*/): +Text::Text(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, Element * parent/*= NULL*/): Element(x, y, w, h, parent) { fgColor = 0xFF8484FF, bgColor = 0xFF84FF4D; } -Text::Text(uint32 x, uint32 y, std::string s, uint32 fg/*= 0xFF8484FF*/, uint32 bg/*= 0xFF84FF4D*/, Element * parent/*= NULL*/): +Text::Text(uint32_t x, uint32_t y, std::string s, uint32_t fg/*= 0xFF8484FF*/, uint32_t bg/*= 0xFF84FF4D*/, Element * parent/*= NULL*/): Element(x, y, 0, 0, parent), text(s) { fgColor = fg, bgColor = bg; diff --git a/src/gui/text.h b/src/gui/text.h index df3614b..ff7e8aa 100644 --- a/src/gui/text.h +++ b/src/gui/text.h @@ -13,17 +13,17 @@ class Text: public Element { public: - Text(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, Element * parent = NULL); - Text(uint32 x, uint32 y, std::string s, uint32 fg = 0xFF8484FF, uint32 bg = 0xFF84FF4D, Element * parent = NULL); - virtual void HandleKey(SDLKey key) {} - virtual void HandleMouseMove(uint32 x, uint32 y) {} - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) {} + Text(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, Element * parent = NULL); + Text(uint32_t x, uint32_t y, std::string s, uint32_t fg = 0xFF8484FF, uint32_t bg = 0xFF84FF4D, Element * parent = NULL); + virtual void HandleKey(SDL_Scancode key) {} + virtual void HandleMouseMove(uint32_t x, uint32_t y) {} + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) {} virtual void Draw(void); virtual void Notify(Element *) {} void SetText(std::string s); protected: -// uint32 fgColor, bgColor; +// uint32_t fgColor, bgColor; std::string text; }; diff --git a/src/gui/textedit.cpp b/src/gui/textedit.cpp index 96e45e7..3803296 100755 --- a/src/gui/textedit.cpp +++ b/src/gui/textedit.cpp @@ -31,7 +31,7 @@ // Text edit class implementation // -TextEdit::TextEdit(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, +TextEdit::TextEdit(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, std::string s/*= ""*/, Element * parent/*= NULL*/): Element(x, y, w, h, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x40, 0x40, 0xFF, parent), activated(false), clicked(false), inside(false), @@ -44,9 +44,9 @@ TextEdit::TextEdit(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/* // Setup hardwired colors... - uint8 * c = (uint8 *)&hiliteColor; + uint8_t * c = (uint8_t *)&hiliteColor; c[0] = 0xFF, c[1] = 0x80, c[2] = 0x00, c[3] = 0xFF; - c = (uint8 *)&cursorColor; + c = (uint8_t *)&cursorColor; c[0] = 0x40, c[1] = 0xFF, c[2] = 0x60, c[3] = 0xFF; // Create the text edit surface here... @@ -64,18 +64,20 @@ TextEdit::~TextEdit() } //Set different filters depending on type passed in on construction, e.g., filename, amount, etc...? -void TextEdit::HandleKey(SDLKey key) +void TextEdit::HandleKey(SDL_Scancode key) { if (!activated) return; +// Punting this for now on SDL 2... +#if 0 SaveStateVariables(); SDLMod keyMod = SDL_GetModState(); if ((key >= SDLK_a && key <= SDLK_z) || (key >= SDLK_0 && key <= SDLK_9) || key == SDLK_PERIOD || key == SDLK_SLASH || key == SDLK_SPACE) { - uint8 chr = (uint8)key; + uint8_t chr = (uint8_t)key; // Handle shift key as well... if (keyMod & KMOD_SHIFT) @@ -134,16 +136,17 @@ void TextEdit::HandleKey(SDLKey key) } CheckStateAndRedrawIfNeeded(); +#endif } -void TextEdit::HandleMouseMove(uint32 x, uint32 y) +void TextEdit::HandleMouseMove(uint32_t x, uint32_t y) { SaveStateVariables(); inside = Inside(x, y); CheckStateAndRedrawIfNeeded(); } -void TextEdit::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void TextEdit::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { SaveStateVariables(); diff --git a/src/gui/textedit.h b/src/gui/textedit.h index e7b1cf0..11904bf 100755 --- a/src/gui/textedit.h +++ b/src/gui/textedit.h @@ -13,11 +13,11 @@ class TextEdit: public Element { public: - TextEdit(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, std::string s = "", Element * parent = NULL); + TextEdit(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, std::string s = "", Element * parent = NULL); ~TextEdit(); - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); virtual void Notify(Element *); std::string GetText(void); @@ -28,12 +28,12 @@ class TextEdit: public Element bool activated, clicked, inside; SDL_Surface * img; std::string text; - uint32 caretPos, scrollPos; + uint32_t caretPos, scrollPos; private: bool activatedSave, clickedSave, insideSave; - uint32 caretPosSave, scrollPosSave, lengthSave; - uint32 hiliteColor, cursorColor; + uint32_t caretPosSave, scrollPosSave, lengthSave; + uint32_t hiliteColor, cursorColor; }; #endif // __TEXTEDIT_H__ diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 28c0212..48e3db6 100755 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -43,7 +43,7 @@ // NOTE: FG/BG colors are hard-wired // -Window::Window(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, +Window::Window(uint32_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, void (* f)(Element *)/*= NULL*/): Element(x, y, w, h, 0x4D, 0xFF, 0x84, 0xFF, 0x1F, 0x84, 0x84, 0xFF), handler(f), cbWidth((closeBox[0] << 8) | closeBox[1]), cbHeight((closeBox[2] << 8) | closeBox[3]), @@ -67,7 +67,7 @@ Window::~Window() #ifdef DESTRUCTOR_TESTING printf("Inside ~Window()...\n"); #endif - for(uint32 i=0; iHandleKey(key); } -void Window::HandleMouseMove(uint32 x, uint32 y) +void Window::HandleMouseMove(uint32_t x, uint32_t y) { // Handle the items this window contains... - for(uint32 i=0; iHandleMouseMove(x - extents.x, y - extents.y); } -void Window::HandleMouseButton(uint32 x, uint32 y, bool mouseDown) +void Window::HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown) { #if 1 // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); #else //? This works in draggablewindow2... // Handle the items this window contains... - for(uint32 i=0; iHandleMouseButton(x - extents.x, y - extents.y, mouseDown); @@ -127,7 +127,7 @@ void Window::Draw(void) SDL_FillRect(screen, &(*i), bgColor); // Handle the items this window contains... - for(uint32 i=0; iDraw(); #else if (drawBackground) @@ -140,7 +140,7 @@ void Window::Draw(void) RestoreScreenFromBackstore(); // Handle the items this window contains... - for(uint32 i=0; iDraw(); #endif diff --git a/src/gui/window.h b/src/gui/window.h index fc31282..0a4fd32 100755 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -15,12 +15,12 @@ class Button; // Forward declaration class Window: public Element { public: - Window(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0, + Window(uint32_t x = 0, uint32_t y = 0, uint32_t w = 0, uint32_t h = 0, void (* f)(Element *) = NULL); ~Window(); //Does this destructor need to be virtual? Not sure... Check! - virtual void HandleKey(SDLKey key); - virtual void HandleMouseMove(uint32 x, uint32 y); - virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown); + virtual void HandleKey(SDL_Scancode key); + virtual void HandleMouseMove(uint32_t x, uint32_t y); + virtual void HandleMouseButton(uint32_t x, uint32_t y, bool mouseDown); virtual void Draw(void); virtual void Notify(Element *); void AddElement(Element * e); @@ -33,7 +33,7 @@ class Window: public Element std::vector list; private: - uint16 cbWidth, cbHeight; + uint16_t cbWidth, cbHeight; SDL_Surface * cbUp, * cbDown, * cbHover; bool drawBackground; }; diff --git a/src/icon.h b/src/icon.h deleted file mode 100755 index c91e619..0000000 --- a/src/icon.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// This file was automagically generated by raw2c (by James L. Hammons) -// - -char icon[0x1000] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/src/log.cpp b/src/log.cpp index c52620c..ebf2535 100755 --- a/src/log.cpp +++ b/src/log.cpp @@ -16,12 +16,12 @@ #include #include #include -#include "types.h" +#include #define MAX_LOG_SIZE 10000000 // Maximum size of log file (10 MB) static FILE * log_stream = NULL; -static uint32 logSize = 0; +static uint32_t logSize = 0; bool InitLog(const char * path) { diff --git a/src/sdlemu_opengl.c b/src/sdlemu_opengl.c deleted file mode 100755 index 7ea9faf..0000000 --- a/src/sdlemu_opengl.c +++ /dev/null @@ -1,535 +0,0 @@ -/* - * SDLEMU library - Free sdl related functions library - * Copyrigh(c) 1999-2004 sdlemu development crew - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* SDLEMU_OPENGL.C - SDLEMU related sources for using OpenGL with SDL. - By Niels Wagenaar | http://sdlemu.ngemu.com | shalafi@xs4all.nl - - Version 1.0.001 - 4-10-2004 - - - Added support for 16, 24 and 32 bit textures; - - Added support for 16, 24 and 32 bit texture rendering; - - Version 1.0.002 - 6-10-2004 - - - Cleaned up a lot of code and removed non functional and obsolete code; - - Removed sdlemu_resize_texture function because of double code; - - Removed the texture creation from the sdlemu_init_opengl; - - Added sdlemu_create_texture function to replace the sdlemu_resize_texture function - and the texture creation in sdlemu_init_opengl; - - Added the usage of OPENGL_16BPP_CORRECT_RGBA for activating the correct 16bpp RGBA masks; - - Added the usage of WANT_OPENGL_ALPHA for using ALPHA blending with 32bpp textures; - - Added automatic and override texture bpp depth setting (based upon the src surface); - -*/ - -#include "sdlemu_opengl.h" - -static SDL_Surface *texture = 0; -static GLuint texid = 0; -static GLfloat texcoord[4]; -static unsigned int glFilter; -static unsigned int texturebpp = 0; // 16, 24 or 32 bpp - -static SDL_Surface * overlay = 0; -static GLuint overlayID = 0; -static GLfloat overlayCoord[4]; -void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp); - -static int showOverlay = 0; - -static inline int power_of_two(int input) -{ - int value = 1; - - while (value < input) - value <<= 1; - - return value; -} - -void sdlemu_init_opengl(SDL_Surface * src, SDL_Surface * dst, int texturetype, int filter, int src_bpp) -{ - printf("\nOpenGL driver information :\n"); - printf("\n"); - printf("Vendor: %s\n", glGetString(GL_VENDOR)); - printf("Renderer: %s\n", glGetString(GL_RENDERER)); - printf("Version: %s\n", glGetString(GL_VERSION)); - printf("OpenGL drawmethod: "); - - switch (texturetype) - { - case 1: - printf("GL_QUAD rendering\n\n"); - break; - default: - printf("GL_TRIANGLE rendering\n\n"); - break; - } - - glFilter = filter; - - // Let us create the texture information : - sdlemu_create_texture(src, dst, filter, src_bpp); - sdlemu_create_overlay(dst, src_bpp); -} - -void sdlemu_draw_texture(SDL_Surface * dst, SDL_Surface * src, int texturetype) -{ -/* - This is needed when we want to render OpenGL textures with the Alpha mask set. - Be warned! This only works with the bpp of texture en *src set to 32. -*/ -#ifdef WANT_OPENGL_ALPHA - Uint32 saved_flags; - Uint8 saved_alpha; - - /* Save the alpha blending attributes */ - saved_flags = src->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); - saved_alpha = src->format->alpha; - if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { - SDL_SetAlpha(src, 0, 0); - } - - // Blit the src display to the texture. - SDL_BlitSurface(src, NULL, texture, NULL); - - /* Restore the alpha blending attributes */ - if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { - SDL_SetAlpha(src, saved_flags, saved_alpha); - } -#else - SDL_BlitSurface(src, NULL, texture, NULL); -#endif -// SDL_BlitSurface(src, NULL, overlay, NULL); -/*Uint32 * pix = (Uint32 *)overlay->pixels; -Uint32 y,x; -for(y=10; y<200; y++) -for(x=30; x<250; x++) -pix[x+(y*1024)] = 0x800000FF;//*/ - -glBlendFunc(GL_ONE, GL_ZERO); -glBindTexture(GL_TEXTURE_2D, texid); - // Texturemap complete texture to surface so we have free scaling - // and antialiasing - switch (texturebpp) - { - case 16: - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture->w, texture->h, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, texture->pixels); - break; - case 24: - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture->w, texture->h, - GL_RGB, GL_UNSIGNED_BYTE, texture->pixels); - break; - case 32: - default: - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture->w, texture->h, - GL_RGBA, GL_UNSIGNED_BYTE, texture->pixels); - break; - } - - // Render the texture to the screen using OpenGL! - switch (texturetype) - { - case 1: - glBegin(GL_QUADS); - glTexCoord2f(texcoord[0], texcoord[1]); - glVertex2f(0, 0); - glTexCoord2f(texcoord[2], texcoord[1]); - glVertex2f(dst->w, 0); - glTexCoord2f(texcoord[2], texcoord[3]); - glVertex2f(dst->w, dst->h); - glTexCoord2f(texcoord[0], texcoord[3]); - glVertex2f(0, dst->h); - glEnd(); - - default: - glBegin(GL_TRIANGLE_STRIP); - glTexCoord2f(texcoord[0], texcoord[1]); glVertex3i(0, 0, 0); - glTexCoord2f(texcoord[2], texcoord[1]); glVertex3i(dst->w, 0, 0); - glTexCoord2f(texcoord[0], texcoord[3]); glVertex3i(0, dst->h, 0); - glTexCoord2f(texcoord[2], texcoord[3]); glVertex3i(dst->w, dst->h, 0); - glEnd(); - }//*/ - - if (showOverlay) - { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, overlayID); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, overlay->w, overlay->h, GL_RGBA, GL_UNSIGNED_BYTE, overlay->pixels); - glBegin(GL_QUADS); - glTexCoord2f(overlayCoord[0], overlayCoord[1]); - glVertex2f(0, 0); - glTexCoord2f(overlayCoord[2], overlayCoord[1]); - glVertex2f(dst->w, 0); - glTexCoord2f(overlayCoord[2], overlayCoord[3]); - glVertex2f(dst->w, dst->h); - glTexCoord2f(overlayCoord[0], overlayCoord[3]); - glVertex2f(0, dst->h); - glEnd(); - } - -//Do some OpenGL stuff here... -//Doesn't work... -/*unsigned long int map[25] = { - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF -}; -glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -glRasterPos2i(10, 10); -glDrawPixels(5, 5, GL_RGBA, GL_UNSIGNED_INT, map);//*/ - -// glFlush(); - SDL_GL_SwapBuffers(); -// glFinish(); - -} - -void sdlemu_close_opengl(void) -{ - if (texture) - SDL_FreeSurface(texture); - - if (overlay) - SDL_FreeSurface(overlay); -} - -void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp) -{ - // Local variables. - Uint32 rmask, gmask, bmask, amask; // Needed for creating RGBA masks. - - // Delete old texture (if allocated). Useful when there is a screen resize. - if (overlay) - SDL_FreeSurface(overlay); - - // Texture width/height should be power of 2 of the SDL_Surface *src when using OpenGL. - // So, find the largest power of two that will contain both the width and height - int w = power_of_two(dst->w); - int h = power_of_two(dst->h); - - printf("OpenGL - Overlay size : %d x %d\n", w, h); - - // Setting bpp based upon src_bpp. - int bpp = src_bpp; - - // We allow the developer to set its own texture bpp. But if the value is NULL or - // not equal to 16, 24 or 32, we make the texturebpp the same as the BPP from src. - if (bpp == 16 || bpp == 24 || bpp == 32) - texturebpp = bpp; - else - texturebpp = dst->format->BitsPerPixel; - - printf("OpenGL - Overlay depth : %d bpp\n", texturebpp); - - // Now were are going to create a SDL_Surface named texture. This will be our surface - // which will function as a buffer between the SDL_Surface *src and SDL_Surface *dst. - // This buffer is needed because we need to convert the SDL_Surface *src to an OpenGL - // texture with a depth of 16, 24 or 32 bpp, before we can blit the pixels to *dst - // using OpenGL. - // - // NOTE: Seems the byte order here *is* important! - switch (texturebpp) - { - case 16: // *src has depth of 16 bpp -/* - According to information on the SDL mailinglist and on internet, the following - rgba masks should be the ones to use. But somehow the screen gets f*cked up and - the RGB colours are incorrect (at least in Virtual Jaguar/SDL). - - Compile with -DOPENGL_16BPP_CORRECT_RGBA to use this RGBA values. -*/ -#ifdef OPENGL_16BPP_CORRECT_RGBA - rmask = 0x7C00; - gmask = 0x03E0; - bmask = 0x001F; - amask = 0x0000; -#else - rmask = 0x0000; - gmask = 0x0000; - bmask = 0x0000; - amask = 0x0000; -#endif - break; - case 24: // *src has depth of 24 bpp - #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x00FF0000; - gmask = 0x0000FF00; - bmask = 0x000000FF; - amask = 0x00000000; // IMPORTANT! 24 bpp doesn't use Alpha (at least in our case). - #else - rmask = 0x000000FF; - gmask = 0x0000FF00; - bmask = 0x00FF0000; - amask = 0x00000000; // IMPORTANT! 24 bpp doesn't use Alpha (at least in our case). - #endif - break; - case 32: //*src has depth of 32 bpp - default: //which is also the default. - #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xFF000000; - gmask = 0x00FF0000; - bmask = 0x0000FF00; - amask = 0x000000FF; - #else - rmask = 0x000000FF; - gmask = 0x0000FF00; - bmask = 0x00FF0000; - amask = 0xFF000000; - #endif - break; - } - - // Creating SDL_Surface texture based upon the above settings. - overlay = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask); - - // Setting up the texture coordinates. - overlayCoord[0] = 0.0f; - overlayCoord[1] = 0.0f; - overlayCoord[2] = (GLfloat)(dst->w) / overlay->w; - overlayCoord[3] = (GLfloat)(dst->h) / overlay->h; - - // create a RGB(A) texture for the texture surface - glGenTextures(1, &overlayID); - glBindTexture(GL_TEXTURE_2D, overlayID); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - // Setting texture mode. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - - // Generate the texture using the above information. - switch (texturebpp) - { - case 16: - // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels. - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, overlay->w, overlay->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - break; - case 24: - // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels. - // - // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp. - // If you use Alpha. Use textures with a depth of 32bpp. - // 24bpp textures are SLOW and avoid them at all costs! - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, overlay->w, overlay->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - break; - case 32: - default: - // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels. - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, overlay->w, overlay->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - break; - } -} - -void * sdlemuGetOverlayPixels(void) -{ - return overlay->pixels; -} - -Uint32 sdlemuGetOverlayWidthInPixels(void) -{ - return overlay->pitch / 4; -} - -void sdlemuEnableOverlay(void) -{ - showOverlay = 1; -} - -void sdlemuDisableOverlay(void) -{ - showOverlay = 0; -} - -void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int src_bpp) -{ - // Local variables. - int w , h; // w and h contain the width and height of the OpenGL texture. - Uint32 rmask, gmask, bmask, amask; // Needed for creating RGBA masks. - int bpp; - - // Delete old texture (if allocated). Useful when there is a screen resize. - if (texture) - SDL_FreeSurface(texture); - - // Texture width/height should be power of 2 of the SDL_Surface *src when using OpenGL. - // So, find the largest power of two that will contain both the width and height - w = power_of_two(src->w); - h = power_of_two(src->h); - - printf("OpenGL - Texture size : %d x %d\n", w, h); - - // Setting bpp based upon src_bpp. - bpp = src_bpp; - - // We allow the developer to set its own texture bpp. But if the value is NULL or - // not equal to 16, 24 or 32, we make the texturebpp the same as the BPP from src. - if (bpp == 16 || bpp == 24 || bpp == 32) - texturebpp = bpp; - else - texturebpp = src->format->BitsPerPixel; - - printf("OpenGL - Texture depth : %d bpp\n", texturebpp); - - // Now were are going to create a SDL_Surface named texture. This will be our surface - // which will function as a buffer between the SDL_Surface *src and SDL_Surface *dst. - // This buffer is needed because we need to convert the SDL_Surface *src to an OpenGL - // texture with a depth of 16, 24 or 32 bpp, before we can blit the pixels to *dst - // using OpenGL. - // - // NOTE: Seems the byte order here *is* important! - switch (texturebpp) - { - case 16: // *src has depth of 16 bpp -/* - According to information on the SDL mailinglist and on internet, the following - rgba masks should be the ones to use. But somehow the screen gets f*cked up and - the RGB colours are incorrect (at least in Virtual Jaguar/SDL). - - Compile with -DOPENGL_16BPP_CORRECT_RGBA to use this RGBA values. -*/ -#ifdef OPENGL_16BPP_CORRECT_RGBA - rmask = 0x7C00; - gmask = 0x03E0; - bmask = 0x001F; - amask = 0x0000; -#else - rmask = 0x0000; - gmask = 0x0000; - bmask = 0x0000; - amask = 0x0000; -#endif - break; - case 24: // *src has depth of 24 bpp - #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x00FF0000; - gmask = 0x0000FF00; - bmask = 0x000000FF; - amask = 0x00000000; // IMPORTANT! 24 bpp doesn't use Alpha (at least in our case). - #else - rmask = 0x000000FF; - gmask = 0x0000FF00; - bmask = 0x00FF0000; - amask = 0x00000000; // IMPORTANT! 24 bpp doesn't use Alpha (at least in our case). - #endif - break; - case 32: //*src has depth of 32 bpp - default: //which is also the default. - #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xFF000000; - gmask = 0x00FF0000; - bmask = 0x0000FF00; - amask = 0x000000FF; - #else - rmask = 0x000000FF; - gmask = 0x0000FF00; - bmask = 0x00FF0000; - amask = 0xFF000000; - #endif - break; - } - - // Creating SDL_Surface texture based upon the above settings. - texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask); - - // Setting up OpenGL - glDisable(GL_FOG); - glDisable(GL_LIGHTING); - glDisable(GL_CULL_FACE); - glDisable(GL_DEPTH_TEST); -// glDisable(GL_BLEND); - glEnable(GL_BLEND); - glDisable(GL_NORMALIZE); - glDisable(GL_ALPHA_TEST); - glEnable(GL_TEXTURE_2D); -// glBlendFunc(GL_SRC_ALPHA, GL_ONE); -// glBlendFunc(GL_ONE, GL_SRC_ALPHA); -//This works, but in a wrong way... -// glBlendFunc(GL_ONE, GL_ONE); - - // Definitely needed for screen resolution larger then the *src. - // This way we can have automatic scaling functionality. - glViewport(0, 0, dst->w, dst->h); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(0.0, (GLdouble)dst->w, (GLdouble)dst->h, 0.0, 0.0, 1.0); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - // Setting up the texture coordinates. - texcoord[0] = 0.0f; - texcoord[1] = 0.0f; - texcoord[2] = (GLfloat)(src->w) / texture->w; - texcoord[3] = (GLfloat)(src->h) / texture->h; - - // create a RGB(A) texture for the texture surface - glGenTextures(1, &texid); - glBindTexture(GL_TEXTURE_2D, texid); - - // Setting up the OpenGL Filters. These filters are important when we/you - // want to scale the texture. - if (filter) - { - // Textures are rendered in best quality. - printf("OpenGL filters: enabled\n"); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } - else - { - // Textures are rendered in normal quality. - printf("OpenGL filters: disabled\n"); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - - // Setting texture mode. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - - // Generate the texture using the above information. - switch (texturebpp) - { - case 16: - // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels. - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - break; - case 24: - // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels. - // - // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp. - // If you use Alpha. Use textures with a depth of 32bpp. - // 24bpp textures are SLOW and avoid them at all costs! - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - break; - case 32: - default: - // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels. - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - break; - } -} diff --git a/src/sdlemu_opengl.h b/src/sdlemu_opengl.h deleted file mode 100755 index 22e0f9a..0000000 --- a/src/sdlemu_opengl.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SDLEMU library - Free sdl related functions library - * Copyrigh(c) 1999-2002 sdlemu development crew - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __SDLEMU_OPENGL_H__ -#define __SDLEMU_OPENGL_H__ - -#include "SDL.h" -#include "SDL_opengl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void sdlemu_init_opengl(SDL_Surface * src, SDL_Surface * dst, int texturetype, int filter, int src_bpp); -void sdlemu_draw_texture(SDL_Surface * dst, SDL_Surface * src, int texturetype); -void sdlemu_close_opengl(void); -void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int src_bpp); -void * sdlemuGetOverlayPixels(void); -Uint32 sdlemuGetOverlayWidthInPixels(void); -void sdlemuEnableOverlay(void); -void sdlemuDisableOverlay(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/settings.cpp b/src/settings.cpp index 841b961..be7bd3f 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -15,20 +15,23 @@ #include #include -#include "SDL.h" +#include #include "sdlemu_config.h" #include "log.h" using namespace std; + // Global variables Settings settings; + // Private function prototypes static void CheckForTrailingSlash(char * path); + // // Load Apple2's settings // @@ -51,49 +54,49 @@ void LoadSettings(void) settings.autoStateSaving = sdlemu_getval_bool("autoSaveState", true); // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, * - settings.p1KeyBindings[0] = sdlemu_getval_int("p1k_up", SDLK_UP); - settings.p1KeyBindings[1] = sdlemu_getval_int("p1k_down", SDLK_DOWN); - settings.p1KeyBindings[2] = sdlemu_getval_int("p1k_left", SDLK_LEFT); - settings.p1KeyBindings[3] = sdlemu_getval_int("p1k_right", SDLK_RIGHT); - settings.p1KeyBindings[4] = sdlemu_getval_int("p1k_c", SDLK_z); - settings.p1KeyBindings[5] = sdlemu_getval_int("p1k_b", SDLK_x); - settings.p1KeyBindings[6] = sdlemu_getval_int("p1k_a", SDLK_c); - settings.p1KeyBindings[7] = sdlemu_getval_int("p1k_option", SDLK_QUOTE); - settings.p1KeyBindings[8] = sdlemu_getval_int("p1k_pause", SDLK_RETURN); - settings.p1KeyBindings[9] = sdlemu_getval_int("p1k_0", SDLK_KP0); - settings.p1KeyBindings[10] = sdlemu_getval_int("p1k_1", SDLK_KP1); - settings.p1KeyBindings[11] = sdlemu_getval_int("p1k_2", SDLK_KP2); - settings.p1KeyBindings[12] = sdlemu_getval_int("p1k_3", SDLK_KP3); - settings.p1KeyBindings[13] = sdlemu_getval_int("p1k_4", SDLK_KP4); - settings.p1KeyBindings[14] = sdlemu_getval_int("p1k_5", SDLK_KP5); - settings.p1KeyBindings[15] = sdlemu_getval_int("p1k_6", SDLK_KP6); - settings.p1KeyBindings[16] = sdlemu_getval_int("p1k_7", SDLK_KP7); - settings.p1KeyBindings[17] = sdlemu_getval_int("p1k_8", SDLK_KP8); - settings.p1KeyBindings[18] = sdlemu_getval_int("p1k_9", SDLK_KP9); - settings.p1KeyBindings[19] = sdlemu_getval_int("p1k_pound", SDLK_KP_DIVIDE); - settings.p1KeyBindings[20] = sdlemu_getval_int("p1k_star", SDLK_KP_MULTIPLY); - - settings.p2KeyBindings[0] = sdlemu_getval_int("p2k_up", SDLK_UP); - settings.p2KeyBindings[1] = sdlemu_getval_int("p2k_down", SDLK_DOWN); - settings.p2KeyBindings[2] = sdlemu_getval_int("p2k_left", SDLK_LEFT); - settings.p2KeyBindings[3] = sdlemu_getval_int("p2k_right", SDLK_RIGHT); - settings.p2KeyBindings[4] = sdlemu_getval_int("p2k_c", SDLK_z); - settings.p2KeyBindings[5] = sdlemu_getval_int("p2k_b", SDLK_x); - settings.p2KeyBindings[6] = sdlemu_getval_int("p2k_a", SDLK_c); - settings.p2KeyBindings[7] = sdlemu_getval_int("p2k_option", SDLK_QUOTE); - settings.p2KeyBindings[8] = sdlemu_getval_int("p2k_pause", SDLK_RETURN); - settings.p2KeyBindings[9] = sdlemu_getval_int("p2k_0", SDLK_KP0); - settings.p2KeyBindings[10] = sdlemu_getval_int("p2k_1", SDLK_KP1); - settings.p2KeyBindings[11] = sdlemu_getval_int("p2k_2", SDLK_KP2); - settings.p2KeyBindings[12] = sdlemu_getval_int("p2k_3", SDLK_KP3); - settings.p2KeyBindings[13] = sdlemu_getval_int("p2k_4", SDLK_KP4); - settings.p2KeyBindings[14] = sdlemu_getval_int("p2k_5", SDLK_KP5); - settings.p2KeyBindings[15] = sdlemu_getval_int("p2k_6", SDLK_KP6); - settings.p2KeyBindings[16] = sdlemu_getval_int("p2k_7", SDLK_KP7); - settings.p2KeyBindings[17] = sdlemu_getval_int("p2k_8", SDLK_KP8); - settings.p2KeyBindings[18] = sdlemu_getval_int("p2k_9", SDLK_KP9); - settings.p2KeyBindings[19] = sdlemu_getval_int("p2k_pound", SDLK_KP_DIVIDE); - settings.p2KeyBindings[20] = sdlemu_getval_int("p2k_star", SDLK_KP_MULTIPLY); + settings.p1KeyBindings[0] = sdlemu_getval_int("p1k_up", SDL_SCANCODE_UP); + settings.p1KeyBindings[1] = sdlemu_getval_int("p1k_down", SDL_SCANCODE_DOWN); + settings.p1KeyBindings[2] = sdlemu_getval_int("p1k_left", SDL_SCANCODE_LEFT); + settings.p1KeyBindings[3] = sdlemu_getval_int("p1k_right", SDL_SCANCODE_RIGHT); + settings.p1KeyBindings[4] = sdlemu_getval_int("p1k_c", SDL_SCANCODE_Z); + settings.p1KeyBindings[5] = sdlemu_getval_int("p1k_b", SDL_SCANCODE_X); + settings.p1KeyBindings[6] = sdlemu_getval_int("p1k_a", SDL_SCANCODE_C); + settings.p1KeyBindings[7] = sdlemu_getval_int("p1k_option", SDL_SCANCODE_APOSTROPHE); + settings.p1KeyBindings[8] = sdlemu_getval_int("p1k_pause", SDL_SCANCODE_RETURN); + settings.p1KeyBindings[9] = sdlemu_getval_int("p1k_0", SDL_SCANCODE_KP_0); + settings.p1KeyBindings[10] = sdlemu_getval_int("p1k_1", SDL_SCANCODE_KP_1); + settings.p1KeyBindings[11] = sdlemu_getval_int("p1k_2", SDL_SCANCODE_KP_2); + settings.p1KeyBindings[12] = sdlemu_getval_int("p1k_3", SDL_SCANCODE_KP_3); + settings.p1KeyBindings[13] = sdlemu_getval_int("p1k_4", SDL_SCANCODE_KP_4); + settings.p1KeyBindings[14] = sdlemu_getval_int("p1k_5", SDL_SCANCODE_KP_5); + settings.p1KeyBindings[15] = sdlemu_getval_int("p1k_6", SDL_SCANCODE_KP_6); + settings.p1KeyBindings[16] = sdlemu_getval_int("p1k_7", SDL_SCANCODE_KP_7); + settings.p1KeyBindings[17] = sdlemu_getval_int("p1k_8", SDL_SCANCODE_KP_8); + settings.p1KeyBindings[18] = sdlemu_getval_int("p1k_9", SDL_SCANCODE_KP_9); + settings.p1KeyBindings[19] = sdlemu_getval_int("p1k_pound", SDL_SCANCODE_KP_DIVIDE); + settings.p1KeyBindings[20] = sdlemu_getval_int("p1k_star", SDL_SCANCODE_KP_MULTIPLY); + + settings.p2KeyBindings[0] = sdlemu_getval_int("p2k_up", SDL_SCANCODE_UP); + settings.p2KeyBindings[1] = sdlemu_getval_int("p2k_down", SDL_SCANCODE_DOWN); + settings.p2KeyBindings[2] = sdlemu_getval_int("p2k_left", SDL_SCANCODE_LEFT); + settings.p2KeyBindings[3] = sdlemu_getval_int("p2k_right", SDL_SCANCODE_RIGHT); + settings.p2KeyBindings[4] = sdlemu_getval_int("p2k_c", SDL_SCANCODE_Z); + settings.p2KeyBindings[5] = sdlemu_getval_int("p2k_b", SDL_SCANCODE_X); + settings.p2KeyBindings[6] = sdlemu_getval_int("p2k_a", SDL_SCANCODE_C); + settings.p2KeyBindings[7] = sdlemu_getval_int("p2k_option", SDL_SCANCODE_APOSTROPHE); + settings.p2KeyBindings[8] = sdlemu_getval_int("p2k_pause", SDL_SCANCODE_RETURN); + settings.p2KeyBindings[9] = sdlemu_getval_int("p2k_0", SDL_SCANCODE_KP_0); + settings.p2KeyBindings[10] = sdlemu_getval_int("p2k_1", SDL_SCANCODE_KP_1); + settings.p2KeyBindings[11] = sdlemu_getval_int("p2k_2", SDL_SCANCODE_KP_2); + settings.p2KeyBindings[12] = sdlemu_getval_int("p2k_3", SDL_SCANCODE_KP_3); + settings.p2KeyBindings[13] = sdlemu_getval_int("p2k_4", SDL_SCANCODE_KP_4); + settings.p2KeyBindings[14] = sdlemu_getval_int("p2k_5", SDL_SCANCODE_KP_5); + settings.p2KeyBindings[15] = sdlemu_getval_int("p2k_6", SDL_SCANCODE_KP_6); + settings.p2KeyBindings[16] = sdlemu_getval_int("p2k_7", SDL_SCANCODE_KP_7); + settings.p2KeyBindings[17] = sdlemu_getval_int("p2k_8", SDL_SCANCODE_KP_8); + settings.p2KeyBindings[18] = sdlemu_getval_int("p2k_9", SDL_SCANCODE_KP_9); + settings.p2KeyBindings[19] = sdlemu_getval_int("p2k_pound", SDL_SCANCODE_KP_DIVIDE); + settings.p2KeyBindings[20] = sdlemu_getval_int("p2k_star", SDL_SCANCODE_KP_MULTIPLY); strcpy(settings.BIOSPath, sdlemu_getval_string("BIOSROM", "./ROMs/apple2.rom")); strcpy(settings.disksPath, sdlemu_getval_string("disks", "./disks")); @@ -103,6 +106,7 @@ void LoadSettings(void) CheckForTrailingSlash(settings.disksPath); } + // // Save Apple2's settings // @@ -110,6 +114,7 @@ void SaveSettings(void) { } + // // Check path for a trailing slash, and append if not present // @@ -119,3 +124,4 @@ static void CheckForTrailingSlash(char * path) if (path[strlen(path) - 1] != '/') strcat(path, "/"); // NOTE: Possible buffer overflow } + diff --git a/src/settings.h b/src/settings.h index 1fcca61..2a698f9 100755 --- a/src/settings.h +++ b/src/settings.h @@ -12,26 +12,26 @@ #else #include // for MAX_PATH on MinGW/Darwin #endif -#include "types.h" +#include // Settings struct struct Settings { bool useJoystick; - int32 joyport; // Joystick port + int32_t joyport; // Joystick port bool hardwareTypeNTSC; // Set to false for PAL bool fullscreen; bool useOpenGL; - uint32 glFilter; - uint32 frameSkip; - uint32 renderType; + uint32_t glFilter; + uint32_t frameSkip; + uint32_t renderType; bool autoStateSaving; // Auto-state loading/saving on entry/exit // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, * - uint16 p1KeyBindings[21]; - uint16 p2KeyBindings[21]; + uint16_t p1KeyBindings[21]; + uint16_t p2KeyBindings[21]; // Paths @@ -58,3 +58,4 @@ void SaveSettings(void); extern Settings settings; #endif // __SETTINGS_H__ + diff --git a/src/sound.cpp b/src/sound.cpp index 2988486..cd153df 100755 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -23,7 +23,7 @@ #include "sound.h" #include // For memset, memcpy -#include +#include #include "log.h" // Useful defines @@ -63,15 +63,15 @@ static SDL_AudioSpec desired, obtained; static bool soundInitialized = false; static bool speakerState = false; -static int16 soundBuffer[SOUND_BUFFER_SIZE]; -static uint32 soundBufferPos; -static uint64 lastToggleCycles; +static int16_t soundBuffer[SOUND_BUFFER_SIZE]; +static uint32_t soundBufferPos; +static uint64_t lastToggleCycles; static SDL_cond * conditional = NULL; static SDL_mutex * mutex = NULL; static SDL_mutex * mutex2 = NULL; -static int16 sample; -static uint8 ampPtr = 14; // Start with -16 - +16 -static int16 amplitude[17] = { 0, 1, 2, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, +static int16_t sample; +static uint8_t ampPtr = 14; // Start with -16 - +16 +static int16_t amplitude[17] = { 0, 1, 2, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767 }; #ifdef WRITE_OUT_WAVE static FILE * fp = NULL; @@ -162,30 +162,30 @@ static void SDLSoundCallback(void * userdata, Uint8 * buffer8, int length8) SDL_mutexP(mutex2); // Recast this as a 16-bit type... - int16 * buffer = (int16 *)buffer8; - uint32 length = (uint32)length8 / 2; + int16_t * buffer = (int16_t *)buffer8; + uint32_t length = (uint32_t)length8 / 2; if (soundBufferPos < length) // The sound buffer is starved... { - for(uint32 i=0; i // Global variables (exported) @@ -17,11 +17,11 @@ void SoundInit(void); void SoundDone(void); -void ToggleSpeaker(uint64 elapsedCycles); -//void AddToSoundTimeBase(uint64 cycles); -void AdjustLastToggleCycles(uint64 elapsedCycles); +void ToggleSpeaker(uint64_t elapsedCycles); +//void AddToSoundTimeBase(uint64_t cycles); +void AdjustLastToggleCycles(uint64_t elapsedCycles); void VolumeUp(void); void VolumeDown(void); -uint8 GetVolume(void); +uint8_t GetVolume(void); #endif // __SOUND_H__ diff --git a/src/timing.cpp b/src/timing.cpp index e93ee1a..11ae234 100755 --- a/src/timing.cpp +++ b/src/timing.cpp @@ -40,18 +40,18 @@ struct Event //let's try +1... nope. static Event eventList[EVENT_LIST_SIZE]; -static uint32 nextEvent; +static uint32_t nextEvent; void InitializeEventList(void) { - for(uint32 i=0; i // Note that these are NTSC timings: @@ -17,9 +17,9 @@ //#define HORIZ_PERIOD_IN_USEC 63.5555 #define M6502_CYCLE_IN_USEC 0.9765625 -//#define USEC_TO_RISC_CYCLES(u) (uint32)(((u) / RISC_CYCLE_IN_USEC) + 0.5) -//#define USEC_TO_M68K_CYCLES(u) (uint32)(((u) / M68K_CYCLE_IN_USEC) + 0.5) -#define USEC_TO_M6502_CYCLES(u) ((uint32)(((u) / M6502_CYCLE_IN_USEC) + 0.5)) +//#define USEC_TO_RISC_CYCLES(u) (uint32_t)(((u) / RISC_CYCLE_IN_USEC) + 0.5) +//#define USEC_TO_M68K_CYCLES(u) (uint32_t)(((u) / M68K_CYCLE_IN_USEC) + 0.5) +#define USEC_TO_M6502_CYCLES(u) ((uint32_t)(((u) / M6502_CYCLE_IN_USEC) + 0.5)) void InitializeEventList(void); void SetCallbackTime(void (* callback)(void), double time); diff --git a/src/types.h b/src/types.h deleted file mode 100755 index 13386d0..0000000 --- a/src/types.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Fundamental variable types -// by James L. Hammons -// - -#ifndef __TYPES_H__ -#define __TYPES_H__ - -// This should be portable, since it's part of the C99 standard...! - -#include - -typedef uint8_t uint8; -typedef int8_t int8; -typedef uint16_t uint16; -typedef int16_t int16; -typedef uint32_t uint32; -typedef int32_t int32; -typedef uint64_t uint64; -typedef int64_t int64; - -#endif // __TYPES_H__ diff --git a/src/v65c02.cpp b/src/v65c02.cpp index b103187..5ef1709 100755 --- a/src/v65c02.cpp +++ b/src/v65c02.cpp @@ -38,9 +38,9 @@ #define SET_N(r) (regs.cc = ((r) & 0x80 ? regs.cc | FLAG_N : regs.cc & ~FLAG_N)) //Not sure that this code is computing the carry correctly... Investigate! [Seems to be] -#define SET_C_ADD(a,b) (regs.cc = ((uint8)(b) > (uint8)(~(a)) ? regs.cc | FLAG_C : regs.cc & ~FLAG_C)) -//#define SET_C_SUB(a,b) (regs.cc = ((uint8)(b) >= (uint8)(a) ? regs.cc | FLAG_C : regs.cc & ~FLAG_C)) -#define SET_C_CMP(a,b) (regs.cc = ((uint8)(b) >= (uint8)(a) ? regs.cc | FLAG_C : regs.cc & ~FLAG_C)) +#define SET_C_ADD(a,b) (regs.cc = ((uint8_t)(b) > (uint8_t)(~(a)) ? regs.cc | FLAG_C : regs.cc & ~FLAG_C)) +//#define SET_C_SUB(a,b) (regs.cc = ((uint8_t)(b) >= (uint8_t)(a) ? regs.cc | FLAG_C : regs.cc & ~FLAG_C)) +#define SET_C_CMP(a,b) (regs.cc = ((uint8_t)(b) >= (uint8_t)(a) ? regs.cc | FLAG_C : regs.cc & ~FLAG_C)) #define SET_ZN(r) SET_N(r); SET_Z(r) #define SET_ZNC_ADD(a,b,r) SET_N(r); SET_Z(r); SET_C_ADD(a,b) //#define SET_ZNC_SUB(a,b,r) SET_N(r); SET_Z(r); SET_C_SUB(a,b) @@ -74,15 +74,15 @@ #define READ_IND_ZP_Y regs.RdMem(EA_IND_ZP_Y) #define READ_IND_ZP regs.RdMem(EA_IND_ZP) -#define READ_IMM_WB(v) uint16 addr = EA_IMM; v = regs.RdMem(addr) -#define READ_ZP_WB(v) uint16 addr = EA_ZP; v = regs.RdMem(addr) -#define READ_ZP_X_WB(v) uint16 addr = EA_ZP_X; v = regs.RdMem(addr) -#define READ_ABS_WB(v) uint16 addr = EA_ABS; v = regs.RdMem(addr) -#define READ_ABS_X_WB(v) uint16 addr = EA_ABS_X; v = regs.RdMem(addr) -#define READ_ABS_Y_WB(v) uint16 addr = EA_ABS_Y; v = regs.RdMem(addr) -#define READ_IND_ZP_X_WB(v) uint16 addr = EA_IND_ZP_X; v = regs.RdMem(addr) -#define READ_IND_ZP_Y_WB(v) uint16 addr = EA_IND_ZP_Y; v = regs.RdMem(addr) -#define READ_IND_ZP_WB(v) uint16 addr = EA_IND_ZP; v = regs.RdMem(addr) +#define READ_IMM_WB(v) uint16_t addr = EA_IMM; v = regs.RdMem(addr) +#define READ_ZP_WB(v) uint16_t addr = EA_ZP; v = regs.RdMem(addr) +#define READ_ZP_X_WB(v) uint16_t addr = EA_ZP_X; v = regs.RdMem(addr) +#define READ_ABS_WB(v) uint16_t addr = EA_ABS; v = regs.RdMem(addr) +#define READ_ABS_X_WB(v) uint16_t addr = EA_ABS_X; v = regs.RdMem(addr) +#define READ_ABS_Y_WB(v) uint16_t addr = EA_ABS_Y; v = regs.RdMem(addr) +#define READ_IND_ZP_X_WB(v) uint16_t addr = EA_IND_ZP_X; v = regs.RdMem(addr) +#define READ_IND_ZP_Y_WB(v) uint16_t addr = EA_IND_ZP_Y; v = regs.RdMem(addr) +#define READ_IND_ZP_WB(v) uint16_t addr = EA_IND_ZP; v = regs.RdMem(addr) #define WRITE_BACK(d) regs.WrMem(addr, (d)) @@ -94,7 +94,7 @@ static V65C02REGS regs; //Also this doesn't take into account the extra cycle it takes when an indirect fetch //(ABS, ABS X/Y, ZP) crosses a page boundary, or extra cycle for BCD add/subtract... #warning "Cycle counts are not accurate--!!! FIX !!!" -static uint8 CPUCycles[256] = { +static uint8_t CPUCycles[256] = { #if 0 7, 6, 1, 1, 5, 3, 5, 1, 3, 2, 2, 1, 6, 4, 6, 1, 2, 5, 5, 1, 5, 4, 6, 1, 2, 4, 2, 1, 6, 4, 6, 1, @@ -131,7 +131,7 @@ static uint8 CPUCycles[256] = { 2, 5, 5, 2, 4, 4, 6, 2, 2, 4, 4, 2, 4, 4, 6, 2 }; #endif -static uint8 _6502Cycles[256] = { +static uint8_t _6502Cycles[256] = { 7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6, 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 6, 7, 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 2, 6, 6, @@ -149,7 +149,7 @@ static uint8 _6502Cycles[256] = { 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 6, 7 }; -static uint8 _65C02Cycles[256] = { +static uint8_t _65C02Cycles[256] = { 7, 6, 2, 2, 5, 3, 5, 2, 3, 2, 2, 2, 6, 4, 6, 2, 2, 5, 5, 2, 5, 4, 6, 2, 2, 4, 2, 2, 6, 4, 6, 2, 6, 6, 2, 2, 3, 3, 5, 2, 4, 2, 2, 2, 4, 2, 6, 2, @@ -712,24 +712,24 @@ static uint8 _65C02Cycles[256] = { // Private function prototypes -static uint16 RdMemW(uint16); -static uint16 FetchMemW(uint16 addr); +static uint16_t RdMemW(uint16_t); +static uint16_t FetchMemW(uint16_t addr); // -// Read a uint16 out of 65C02 memory (big endian format) +// Read a uint16_t out of 65C02 memory (big endian format) // -static inline uint16 RdMemW(uint16 address) +static inline uint16_t RdMemW(uint16_t address) { - return (uint16)(regs.RdMem(address + 1) << 8) | regs.RdMem(address + 0); + return (uint16_t)(regs.RdMem(address + 1) << 8) | regs.RdMem(address + 0); } // -// Read a uint16 out of 65C02 memory (big endian format) and increment PC +// Read a uint16_t out of 65C02 memory (big endian format) and increment PC // -static inline uint16 FetchMemW(uint16 address) +static inline uint16_t FetchMemW(uint16_t address) { regs.pc += 2; - return (uint16)(regs.RdMem(address + 1) << 8) | regs.RdMem(address + 0); + return (uint16_t)(regs.RdMem(address + 1) << 8) | regs.RdMem(address + 0); } @@ -760,7 +760,7 @@ ADC Immediate ADC #Oper 69 2 2 //This is non-optimal, but it works--optimize later. :-) #define OP_ADC_HANDLER(m) \ - uint16 sum = (uint16)regs.a + (m) + (uint16)(regs.cc & FLAG_C); \ + uint16_t sum = (uint16_t)regs.a + (m) + (uint16_t)(regs.cc & FLAG_C); \ \ if (regs.cc & FLAG_D) \ { \ @@ -780,55 +780,55 @@ ADC Immediate ADC #Oper 69 2 2 static void Op69(void) // ADC # { - uint16 m = READ_IMM; + uint16_t m = READ_IMM; OP_ADC_HANDLER(m); } static void Op65(void) // ADC ZP { - uint16 m = READ_ZP; + uint16_t m = READ_ZP; OP_ADC_HANDLER(m); } static void Op75(void) // ADC ZP, X { - uint16 m = READ_ZP_X; + uint16_t m = READ_ZP_X; OP_ADC_HANDLER(m); } static void Op6D(void) // ADC ABS { - uint16 m = READ_ABS; + uint16_t m = READ_ABS; OP_ADC_HANDLER(m); } static void Op7D(void) // ADC ABS, X { - uint16 m = READ_ABS_X; + uint16_t m = READ_ABS_X; OP_ADC_HANDLER(m); } static void Op79(void) // ADC ABS, Y { - uint16 m = READ_ABS_Y; + uint16_t m = READ_ABS_Y; OP_ADC_HANDLER(m); } static void Op61(void) // ADC (ZP, X) { - uint16 m = READ_IND_ZP_X; + uint16_t m = READ_IND_ZP_X; OP_ADC_HANDLER(m); } static void Op71(void) // ADC (ZP), Y { - uint16 m = READ_IND_ZP_Y; + uint16_t m = READ_IND_ZP_Y; OP_ADC_HANDLER(m); } static void Op72(void) // ADC (ZP) { - uint16 m = READ_IND_ZP; + uint16_t m = READ_IND_ZP; OP_ADC_HANDLER(m); } @@ -852,55 +852,55 @@ Absolute,Y AND Abs,Y 39 3 4 static void Op29(void) // AND # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_AND_HANDLER(m); } static void Op25(void) // AND ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_AND_HANDLER(m); } static void Op35(void) // AND ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_AND_HANDLER(m); } static void Op2D(void) // AND ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_AND_HANDLER(m); } static void Op3D(void) // AND ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_AND_HANDLER(m); } static void Op39(void) // AND ABS, Y { - uint8 m = READ_ABS_Y; + uint8_t m = READ_ABS_Y; OP_AND_HANDLER(m); } static void Op21(void) // AND (ZP, X) { - uint8 m = READ_IND_ZP_X; + uint8_t m = READ_IND_ZP_X; OP_AND_HANDLER(m); } static void Op31(void) // AND (ZP), Y { - uint8 m = READ_IND_ZP_Y; + uint8_t m = READ_IND_ZP_Y; OP_AND_HANDLER(m); } static void Op32(void) // AND (ZP) { - uint8 m = READ_IND_ZP; + uint8_t m = READ_IND_ZP; OP_AND_HANDLER(m); } @@ -914,7 +914,7 @@ Absolute,X ASL Abs,X 1E 3 7 /*static void Op78(void) // LSL ABS { - uint8 tmp; uint16 addr; + uint8_t tmp; uint16_t addr; addr = FetchW(); tmp = regs.RdMem(addr); (tmp&0x80 ? regs.cc |= 0x01 : regs.cc &= 0xFE); // Shift hi bit into Carry @@ -938,7 +938,7 @@ static void Op0A(void) // ASL A static void Op06(void) // ASL ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_ASL_HANDLER(m); WRITE_BACK(m); @@ -946,7 +946,7 @@ static void Op06(void) // ASL ZP static void Op16(void) // ASL ZP, X { - uint8 m; + uint8_t m; READ_ZP_X_WB(m); OP_ASL_HANDLER(m); WRITE_BACK(m); @@ -954,7 +954,7 @@ static void Op16(void) // ASL ZP, X static void Op0E(void) // ASL ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_ASL_HANDLER(m); WRITE_BACK(m); @@ -962,7 +962,7 @@ static void Op0E(void) // ASL ABS static void Op1E(void) // ASL ABS, X { - uint8 m; + uint8_t m; READ_ABS_X_WB(m); OP_ASL_HANDLER(m); WRITE_BACK(m); @@ -991,7 +991,7 @@ BBS7 Relative BBS7 Oper FF 2 2 static void Op0F(void) // BBR0 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x01)) regs.pc += m; @@ -999,7 +999,7 @@ static void Op0F(void) // BBR0 static void Op1F(void) // BBR1 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x02)) regs.pc += m; @@ -1007,7 +1007,7 @@ static void Op1F(void) // BBR1 static void Op2F(void) // BBR2 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x04)) regs.pc += m; @@ -1015,7 +1015,7 @@ static void Op2F(void) // BBR2 static void Op3F(void) // BBR3 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x08)) regs.pc += m; @@ -1023,7 +1023,7 @@ static void Op3F(void) // BBR3 static void Op4F(void) // BBR4 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x10)) regs.pc += m; @@ -1031,7 +1031,7 @@ static void Op4F(void) // BBR4 static void Op5F(void) // BBR5 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x20)) regs.pc += m; @@ -1039,7 +1039,7 @@ static void Op5F(void) // BBR5 static void Op6F(void) // BBR6 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x40)) regs.pc += m; @@ -1047,7 +1047,7 @@ static void Op6F(void) // BBR6 static void Op7F(void) // BBR7 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.a & 0x80)) regs.pc += m; @@ -1055,7 +1055,7 @@ static void Op7F(void) // BBR7 static void Op8F(void) // BBS0 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x01) regs.pc += m; @@ -1063,7 +1063,7 @@ static void Op8F(void) // BBS0 static void Op9F(void) // BBS1 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x02) regs.pc += m; @@ -1071,7 +1071,7 @@ static void Op9F(void) // BBS1 static void OpAF(void) // BBS2 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x04) regs.pc += m; @@ -1079,7 +1079,7 @@ static void OpAF(void) // BBS2 static void OpBF(void) // BBS3 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x08) regs.pc += m; @@ -1087,7 +1087,7 @@ static void OpBF(void) // BBS3 static void OpCF(void) // BBS4 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x10) regs.pc += m; @@ -1095,7 +1095,7 @@ static void OpCF(void) // BBS4 static void OpDF(void) // BBS5 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x20) regs.pc += m; @@ -1103,7 +1103,7 @@ static void OpDF(void) // BBS5 static void OpEF(void) // BBS6 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x40) regs.pc += m; @@ -1111,7 +1111,7 @@ static void OpEF(void) // BBS6 static void OpFF(void) // BBS7 { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.a & 0x80) regs.pc += m; @@ -1127,7 +1127,7 @@ BEQ Relative BEQ Oper F0 2 2 #define HANDLE_BRANCH_TAKEN(m) \ { \ - uint16 oldpc = regs.pc; \ + uint16_t oldpc = regs.pc; \ regs.pc += m; \ regs.clock++; \ if ((oldpc ^ regs.pc) & 0xFF00) \ @@ -1138,7 +1138,7 @@ BEQ Relative BEQ Oper F0 2 2 static void Op90(void) // BCC { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.cc & FLAG_C)) HANDLE_BRANCH_TAKEN(m) @@ -1147,7 +1147,7 @@ static void Op90(void) // BCC static void OpB0(void) // BCS { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.cc & FLAG_C) HANDLE_BRANCH_TAKEN(m) @@ -1156,7 +1156,7 @@ static void OpB0(void) // BCS static void OpF0(void) // BEQ { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.cc & FLAG_Z) HANDLE_BRANCH_TAKEN(m) @@ -1178,39 +1178,39 @@ Absolute,X BIT Abs,X 3C 3 4 Z flag is set appropriately. */ #define OP_BIT_HANDLER(m) \ - int8 result = regs.a & (m); \ + int8_t result = regs.a & (m); \ regs.cc &= ~(FLAG_N | FLAG_V); \ regs.cc |= ((m) & 0xC0); \ SET_Z(result) static void Op89(void) // BIT # { - int8 m = READ_IMM; - int8 result = regs.a & m; + int8_t m = READ_IMM; + int8_t result = regs.a & m; SET_Z(result); } static void Op24(void) // BIT ZP { - int8 m = READ_ZP; + int8_t m = READ_ZP; OP_BIT_HANDLER(m); } static void Op34(void) // BIT ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_BIT_HANDLER(m); } static void Op2C(void) // BIT ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_BIT_HANDLER(m); } static void Op3C(void) // BIT ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_BIT_HANDLER(m); } @@ -1225,7 +1225,7 @@ BRA Relative BRA Oper 80 2 3 static void Op30(void) // BMI { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.cc & FLAG_N) HANDLE_BRANCH_TAKEN(m) @@ -1234,7 +1234,7 @@ static void Op30(void) // BMI static void OpD0(void) // BNE { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.cc & FLAG_Z)) HANDLE_BRANCH_TAKEN(m) @@ -1243,7 +1243,7 @@ static void OpD0(void) // BNE static void Op10(void) // BPL { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.cc & FLAG_N)) HANDLE_BRANCH_TAKEN(m) @@ -1252,7 +1252,7 @@ static void Op10(void) // BPL static void Op80(void) // BRA { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; HANDLE_BRANCH_TAKEN(m) // regs.pc += m; } @@ -1282,7 +1282,7 @@ BVS Relative BVS Oper 70 2 2 static void Op50(void) // BVC { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (!(regs.cc & FLAG_V)) HANDLE_BRANCH_TAKEN(m) @@ -1291,7 +1291,7 @@ static void Op50(void) // BVC static void Op70(void) // BVS { - int16 m = (int16)(int8)READ_IMM; + int16_t m = (int16_t)(int8_t)READ_IMM; if (regs.cc & FLAG_V) HANDLE_BRANCH_TAKEN(m) @@ -1375,60 +1375,60 @@ Compare sets flags as if a subtraction had been carried out. If the value in the */ #define OP_CMP_HANDLER(m) \ - uint8 result = regs.a - (m); \ + uint8_t result = regs.a - (m); \ SET_ZNC_CMP(m, regs.a, result) static void OpC9(void) // CMP # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_CMP_HANDLER(m); } static void OpC5(void) // CMP ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_CMP_HANDLER(m); } static void OpD5(void) // CMP ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_CMP_HANDLER(m); } static void OpCD(void) // CMP ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_CMP_HANDLER(m); } static void OpDD(void) // CMP ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_CMP_HANDLER(m); } static void OpD9(void) // CMP ABS, Y { - uint8 m = READ_ABS_Y; + uint8_t m = READ_ABS_Y; OP_CMP_HANDLER(m); } static void OpC1(void) // CMP (ZP, X) { - uint8 m = READ_IND_ZP_X; + uint8_t m = READ_IND_ZP_X; OP_CMP_HANDLER(m); } static void OpD1(void) // CMP (ZP), Y { - uint8 m = READ_IND_ZP_Y; + uint8_t m = READ_IND_ZP_Y; OP_CMP_HANDLER(m); } static void OpD2(void) // CMP (ZP) { - uint8 m = READ_IND_ZP; + uint8_t m = READ_IND_ZP; OP_CMP_HANDLER(m); } @@ -1441,24 +1441,24 @@ Absolute CPX Abs EC 3 4 // CPX opcodes #define OP_CPX_HANDLER(m) \ - uint8 result = regs.x - (m); \ + uint8_t result = regs.x - (m); \ SET_ZNC_CMP(m, regs.x, result) static void OpE0(void) // CPX # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_CPX_HANDLER(m); } static void OpE4(void) // CPX ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_CPX_HANDLER(m); } static void OpEC(void) // CPX ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_CPX_HANDLER(m); } @@ -1471,24 +1471,24 @@ Absolute CPY Abs CC 3 4 // CPY opcodes #define OP_CPY_HANDLER(m) \ - uint8 result = regs.y - (m); \ + uint8_t result = regs.y - (m); \ SET_ZNC_CMP(m, regs.y, result) static void OpC0(void) // CPY # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_CPY_HANDLER(m); } static void OpC4(void) // CPY ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_CPY_HANDLER(m); } static void OpCC(void) // CPY ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_CPY_HANDLER(m); } @@ -1517,7 +1517,7 @@ Absolute,X DEC Abs,X DE 3 7 static void OpC6(void) // DEC ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_DEC_HANDLER(m); WRITE_BACK(m); @@ -1525,7 +1525,7 @@ static void OpC6(void) // DEC ZP static void OpD6(void) // DEC ZP, X { - uint8 m; + uint8_t m; READ_ZP_X_WB(m); OP_DEC_HANDLER(m); WRITE_BACK(m); @@ -1533,7 +1533,7 @@ static void OpD6(void) // DEC ZP, X static void OpCE(void) // DEC ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_DEC_HANDLER(m); WRITE_BACK(m); @@ -1541,7 +1541,7 @@ static void OpCE(void) // DEC ABS static void OpDE(void) // DEC ABS, X { - uint8 m; + uint8_t m; READ_ABS_X_WB(m); OP_DEC_HANDLER(m); WRITE_BACK(m); @@ -1601,55 +1601,55 @@ Absolute,Y EOR Abs,Y 59 3 4 static void Op49(void) // EOR # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_EOR_HANDLER(m); } static void Op45(void) // EOR ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_EOR_HANDLER(m); } static void Op55(void) // EOR ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_EOR_HANDLER(m); } static void Op4D(void) // EOR ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_EOR_HANDLER(m); } static void Op5D(void) // EOR ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_EOR_HANDLER(m); } static void Op59(void) // EOR ABS, Y { - uint8 m = READ_ABS_Y; + uint8_t m = READ_ABS_Y; OP_EOR_HANDLER(m); } static void Op41(void) // EOR (ZP, X) { - uint8 m = READ_IND_ZP_X; + uint8_t m = READ_IND_ZP_X; OP_EOR_HANDLER(m); } static void Op51(void) // EOR (ZP), Y { - uint8 m = READ_IND_ZP_Y; + uint8_t m = READ_IND_ZP_Y; OP_EOR_HANDLER(m); } static void Op52(void) // EOR (ZP) { - uint8 m = READ_IND_ZP; + uint8_t m = READ_IND_ZP; OP_EOR_HANDLER(m); } @@ -1678,7 +1678,7 @@ Absolute,X INC Abs,X FE 3 7 static void OpE6(void) // INC ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_INC_HANDLER(m); WRITE_BACK(m); @@ -1686,7 +1686,7 @@ static void OpE6(void) // INC ZP static void OpF6(void) // INC ZP, X { - uint8 m; + uint8_t m; READ_ZP_X_WB(m); OP_INC_HANDLER(m); WRITE_BACK(m); @@ -1694,7 +1694,7 @@ static void OpF6(void) // INC ZP, X static void OpEE(void) // INC ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_INC_HANDLER(m); WRITE_BACK(m); @@ -1702,7 +1702,7 @@ static void OpEE(void) // INC ABS static void OpFE(void) // INC ABS, X { - uint8 m; + uint8_t m; READ_ABS_X_WB(m); OP_INC_HANDLER(m); WRITE_BACK(m); @@ -1743,7 +1743,7 @@ static void Op4C(void) // JMP ABS static void Op6C(void) // JMP (ABS) { -// uint16 addr = RdMemW(regs.pc); +// uint16_t addr = RdMemW(regs.pc); //#ifdef __DEBUG__ //WriteLog("\n[JMP ABS]: addr fetched = %04X, bytes at %04X = %02X %02X (RdMemw=%04X)\n", // addr, addr, regs.RdMem(addr), regs.RdMem(addr+1), RdMemW(addr)); @@ -1764,7 +1764,7 @@ JSR Absolute JSR Abs 20 3 6 //This is not jumping to the correct address... !!! FIX !!! [DONE] static void Op20(void) // JSR { - uint16 addr = RdMemW(regs.pc); + uint16_t addr = RdMemW(regs.pc); regs.pc++; // Since it pushes return address - 1... regs.WrMem(0x0100 + regs.sp--, regs.pc >> 8); regs.WrMem(0x0100 + regs.sp--, regs.pc & 0xFF); @@ -1791,55 +1791,55 @@ Absolute,Y LDA Abs,Y B9 3 4 static void OpA9(void) // LDA # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_LDA_HANDLER(m); } static void OpA5(void) // LDA ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_LDA_HANDLER(m); } static void OpB5(void) // LDA ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_LDA_HANDLER(m); } static void OpAD(void) // LDA ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_LDA_HANDLER(m); } static void OpBD(void) // LDA ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_LDA_HANDLER(m); } static void OpB9(void) // LDA ABS, Y { - uint8 m = READ_ABS_Y; + uint8_t m = READ_ABS_Y; OP_LDA_HANDLER(m); } static void OpA1(void) // LDA (ZP, X) { - uint8 m = READ_IND_ZP_X; + uint8_t m = READ_IND_ZP_X; OP_LDA_HANDLER(m); } static void OpB1(void) // LDA (ZP), Y { - uint8 m = READ_IND_ZP_Y; + uint8_t m = READ_IND_ZP_Y; OP_LDA_HANDLER(m); } static void OpB2(void) // LDA (ZP) { - uint8 m = READ_IND_ZP; + uint8_t m = READ_IND_ZP; OP_LDA_HANDLER(m); } @@ -1859,31 +1859,31 @@ Absolute,Y LDX Abs,Y BE 3 4 static void OpA2(void) // LDX # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_LDX_HANDLER(m); } static void OpA6(void) // LDX ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_LDX_HANDLER(m); } static void OpB6(void) // LDX ZP, Y { - uint8 m = READ_ZP_Y; + uint8_t m = READ_ZP_Y; OP_LDX_HANDLER(m); } static void OpAE(void) // LDX ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_LDX_HANDLER(m); } static void OpBE(void) // LDX ABS, Y { - uint8 m = READ_ABS_Y; + uint8_t m = READ_ABS_Y; OP_LDX_HANDLER(m); } @@ -1903,31 +1903,31 @@ Absolute,Y LDY Abs,X BC 3 4 static void OpA0(void) // LDY # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_LDY_HANDLER(m); } static void OpA4(void) // LDY ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_LDY_HANDLER(m); } static void OpB4(void) // LDY ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_LDY_HANDLER(m); } static void OpAC(void) // LDY ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_LDY_HANDLER(m); } static void OpBC(void) // LDY ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_LDY_HANDLER(m); } @@ -1953,7 +1953,7 @@ static void Op4A(void) // LSR A static void Op46(void) // LSR ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_LSR_HANDLER(m); WRITE_BACK(m); @@ -1961,7 +1961,7 @@ static void Op46(void) // LSR ZP static void Op56(void) // LSR ZP, X { - uint8 m; + uint8_t m; READ_ZP_X_WB(m); OP_LSR_HANDLER(m); WRITE_BACK(m); @@ -1969,7 +1969,7 @@ static void Op56(void) // LSR ZP, X static void Op4E(void) // LSR ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_LSR_HANDLER(m); WRITE_BACK(m); @@ -1977,7 +1977,7 @@ static void Op4E(void) // LSR ABS static void Op5E(void) // LSR ABS, X { - uint8 m; + uint8_t m; READ_ABS_X_WB(m); OP_LSR_HANDLER(m); WRITE_BACK(m); @@ -2011,55 +2011,55 @@ Absolute,Y ORA Abs,Y 19 3 4 static void Op09(void) // ORA # { - uint8 m = READ_IMM; + uint8_t m = READ_IMM; OP_ORA_HANDLER(m); } static void Op05(void) // ORA ZP { - uint8 m = READ_ZP; + uint8_t m = READ_ZP; OP_ORA_HANDLER(m); } static void Op15(void) // ORA ZP, X { - uint8 m = READ_ZP_X; + uint8_t m = READ_ZP_X; OP_ORA_HANDLER(m); } static void Op0D(void) // ORA ABS { - uint8 m = READ_ABS; + uint8_t m = READ_ABS; OP_ORA_HANDLER(m); } static void Op1D(void) // ORA ABS, X { - uint8 m = READ_ABS_X; + uint8_t m = READ_ABS_X; OP_ORA_HANDLER(m); } static void Op19(void) // ORA ABS, Y { - uint8 m = READ_ABS_Y; + uint8_t m = READ_ABS_Y; OP_ORA_HANDLER(m); } static void Op01(void) // ORA (ZP, X) { - uint8 m = READ_IND_ZP_X; + uint8_t m = READ_IND_ZP_X; OP_ORA_HANDLER(m); } static void Op11(void) // ORA (ZP), Y { - uint8 m = READ_IND_ZP_Y; + uint8_t m = READ_IND_ZP_Y; OP_ORA_HANDLER(m); } static void Op12(void) // ORA (ZP) { - uint8 m = READ_IND_ZP; + uint8_t m = READ_IND_ZP; OP_ORA_HANDLER(m); } @@ -2143,7 +2143,7 @@ The bit set and clear instructions have the form xyyy0111, where x is 0 to clear static void Op07(void) // RMB0 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xFE; WRITE_BACK(m); @@ -2151,7 +2151,7 @@ static void Op07(void) // RMB0 ZP static void Op17(void) // RMB1 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xFD; WRITE_BACK(m); @@ -2159,7 +2159,7 @@ static void Op17(void) // RMB1 ZP static void Op27(void) // RMB2 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xFB; WRITE_BACK(m); @@ -2167,7 +2167,7 @@ static void Op27(void) // RMB2 ZP static void Op37(void) // RMB3 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xF7; WRITE_BACK(m); @@ -2175,7 +2175,7 @@ static void Op37(void) // RMB3 ZP static void Op47(void) // RMB4 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xEF; WRITE_BACK(m); @@ -2183,7 +2183,7 @@ static void Op47(void) // RMB4 ZP static void Op57(void) // RMB5 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xDF; WRITE_BACK(m); @@ -2191,7 +2191,7 @@ static void Op57(void) // RMB5 ZP static void Op67(void) // RMB6 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0xBF; WRITE_BACK(m); @@ -2199,7 +2199,7 @@ static void Op67(void) // RMB6 ZP static void Op77(void) // RMB7 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m &= 0x7F; WRITE_BACK(m); @@ -2216,7 +2216,7 @@ Absolute,X ROL Abs,X 3E 3 7 // ROL opcodes #define OP_ROL_HANDLER(m) \ - uint8 tmp = regs.cc & 0x01; \ + uint8_t tmp = regs.cc & 0x01; \ regs.cc = ((m) & 0x80 ? regs.cc | FLAG_C : regs.cc & ~FLAG_C); \ (m) = ((m) << 1) | tmp; \ SET_ZN((m)) @@ -2228,7 +2228,7 @@ static void Op2A(void) // ROL A static void Op26(void) // ROL ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_ROL_HANDLER(m); WRITE_BACK(m); @@ -2236,7 +2236,7 @@ static void Op26(void) // ROL ZP static void Op36(void) // ROL ZP, X { - uint8 m; + uint8_t m; READ_ZP_X_WB(m); OP_ROL_HANDLER(m); WRITE_BACK(m); @@ -2244,7 +2244,7 @@ static void Op36(void) // ROL ZP, X static void Op2E(void) // ROL ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_ROL_HANDLER(m); WRITE_BACK(m); @@ -2252,7 +2252,7 @@ static void Op2E(void) // ROL ABS static void Op3E(void) // ROL ABS, X { - uint8 m; + uint8_t m; READ_ABS_X_WB(m); OP_ROL_HANDLER(m); WRITE_BACK(m); @@ -2269,7 +2269,7 @@ Absolute,X ROR Abs,X 7E 3 7 // ROR opcodes #define OP_ROR_HANDLER(m) \ - uint8 tmp = (regs.cc & 0x01) << 7; \ + uint8_t tmp = (regs.cc & 0x01) << 7; \ regs.cc = ((m) & 0x01 ? regs.cc | FLAG_C : regs.cc & ~FLAG_C); \ (m) = ((m) >> 1) | tmp; \ SET_ZN((m)) @@ -2281,7 +2281,7 @@ static void Op6A(void) // ROR A static void Op66(void) // ROR ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_ROR_HANDLER(m); WRITE_BACK(m); @@ -2289,7 +2289,7 @@ static void Op66(void) // ROR ZP static void Op76(void) // ROR ZP, X { - uint8 m; + uint8_t m; READ_ZP_X_WB(m); OP_ROR_HANDLER(m); WRITE_BACK(m); @@ -2297,7 +2297,7 @@ static void Op76(void) // ROR ZP, X static void Op6E(void) // ROR ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_ROR_HANDLER(m); WRITE_BACK(m); @@ -2305,7 +2305,7 @@ static void Op6E(void) // ROR ABS static void Op7E(void) // ROR ABS, X { - uint8 m; + uint8_t m; READ_ABS_X_WB(m); OP_ROR_HANDLER(m); WRITE_BACK(m); @@ -2322,7 +2322,7 @@ static void Op40(void) // RTI //I can't find *any* verification that this is the case. // regs.cc &= ~FLAG_I; regs.pc = regs.RdMem(0x0100 + ++regs.sp); - regs.pc |= (uint16)(regs.RdMem(0x0100 + ++regs.sp)) << 8; + regs.pc |= (uint16_t)(regs.RdMem(0x0100 + ++regs.sp)) << 8; } /* @@ -2332,7 +2332,7 @@ RTS Implied RTS 60 1 6 static void Op60(void) // RTS { regs.pc = regs.RdMem(0x0100 + ++regs.sp); - regs.pc |= (uint16)(regs.RdMem(0x0100 + ++regs.sp)) << 8; + regs.pc |= (uint16_t)(regs.RdMem(0x0100 + ++regs.sp)) << 8; regs.pc++; // Since it pushes return address - 1... //printf("*** RTS: PC = $%04X, SP= $1%02X\n", regs.pc, regs.sp); //fflush(stdout); @@ -2355,7 +2355,7 @@ Absolute,Y SBC Abs,Y F9 3 4 //This is non-optimal, but it works--optimize later. :-) //This is correct except for the BCD handling... !!! FIX !!! [Possibly DONE] #define OP_SBC_HANDLER(m) \ - uint16 sum = (uint16)regs.a - (m) - (uint16)((regs.cc & FLAG_C) ^ 0x01); \ + uint16_t sum = (uint16_t)regs.a - (m) - (uint16_t)((regs.cc & FLAG_C) ^ 0x01); \ \ if (regs.cc & FLAG_D) \ { \ @@ -2385,55 +2385,55 @@ Fixed. :-) static void OpE9(void) // SBC # { - uint16 m = READ_IMM; + uint16_t m = READ_IMM; OP_SBC_HANDLER(m); } static void OpE5(void) // SBC ZP { - uint16 m = READ_ZP; + uint16_t m = READ_ZP; OP_SBC_HANDLER(m); } static void OpF5(void) // SBC ZP, X { - uint16 m = READ_ZP_X; + uint16_t m = READ_ZP_X; OP_SBC_HANDLER(m); } static void OpED(void) // SBC ABS { - uint16 m = READ_ABS; + uint16_t m = READ_ABS; OP_SBC_HANDLER(m); } static void OpFD(void) // SBC ABS, X { - uint16 m = READ_ABS_X; + uint16_t m = READ_ABS_X; OP_SBC_HANDLER(m); } static void OpF9(void) // SBC ABS, Y { - uint16 m = READ_ABS_Y; + uint16_t m = READ_ABS_Y; OP_SBC_HANDLER(m); } static void OpE1(void) // SBC (ZP, X) { - uint16 m = READ_IND_ZP_X; + uint16_t m = READ_IND_ZP_X; OP_SBC_HANDLER(m); } static void OpF1(void) // SBC (ZP), Y { - uint16 m = READ_IND_ZP_Y; + uint16_t m = READ_IND_ZP_Y; OP_SBC_HANDLER(m); } static void OpF2(void) // SBC (ZP) { - uint16 m = READ_IND_ZP; + uint16_t m = READ_IND_ZP; OP_SBC_HANDLER(m); } @@ -2476,7 +2476,7 @@ The bit set and clear instructions have the form xyyy0111, where x is 0 to clear static void Op87(void) // SMB0 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x01; WRITE_BACK(m); @@ -2484,7 +2484,7 @@ static void Op87(void) // SMB0 ZP static void Op97(void) // SMB1 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x02; WRITE_BACK(m); @@ -2492,7 +2492,7 @@ static void Op97(void) // SMB1 ZP static void OpA7(void) // SMB2 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x04; WRITE_BACK(m); @@ -2500,7 +2500,7 @@ static void OpA7(void) // SMB2 ZP static void OpB7(void) // SMB3 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x08; WRITE_BACK(m); @@ -2508,7 +2508,7 @@ static void OpB7(void) // SMB3 ZP static void OpC7(void) // SMB4 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x10; WRITE_BACK(m); @@ -2516,7 +2516,7 @@ static void OpC7(void) // SMB4 ZP static void OpD7(void) // SMB5 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x20; WRITE_BACK(m); @@ -2524,7 +2524,7 @@ static void OpD7(void) // SMB5 ZP static void OpE7(void) // SMB6 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x40; WRITE_BACK(m); @@ -2532,7 +2532,7 @@ static void OpE7(void) // SMB6 ZP static void OpF7(void) // SMB7 ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); m |= 0x80; WRITE_BACK(m); @@ -2699,7 +2699,7 @@ Absolute TRB Abs 1C 3 6 static void Op14(void) // TRB ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_TRB_HANDLER(m); WRITE_BACK(m); @@ -2707,7 +2707,7 @@ static void Op14(void) // TRB ZP static void Op1C(void) // TRB ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_TRB_HANDLER(m); WRITE_BACK(m); @@ -2726,7 +2726,7 @@ Absolute TSB Abs 0C 3 6 static void Op04(void) // TSB ZP { - uint8 m; + uint8_t m; READ_ZP_WB(m); OP_TSB_HANDLER(m); WRITE_BACK(m); @@ -2734,7 +2734,7 @@ static void Op04(void) // TSB ZP static void Op0C(void) // TSB ABS { - uint8 m; + uint8_t m; READ_ABS_WB(m); OP_TSB_HANDLER(m); WRITE_BACK(m); @@ -2810,11 +2810,11 @@ void (* exec_op[256])() = { // // Internal "memcpy" (so we don't have to link with any external libraries!) // -static void myMemcpy(void * dst, void * src, uint32 size) +static void myMemcpy(void * dst, void * src, uint32_t size) { - uint8 * d = (uint8 *)dst, * s = (uint8 *)src; + uint8_t * d = (uint8_t *)dst, * s = (uint8_t *)src; - for(uint32 i=0; i 0xFFFFFFFF) wraparound = true; */ - uint64 endCycles = regs.clock + (uint64)cycles; + uint64_t endCycles = regs.clock + (uint64_t)cycles; while (regs.clock < endCycles) { @@ -2928,7 +2928,7 @@ if (regs.pc == 0x2000) if (dumpDis) Decode65C02(regs.pc); #endif - uint8 opcode = regs.RdMem(regs.pc++); + uint8_t opcode = regs.RdMem(regs.pc++); //if (!(regs.cpuFlags & V65C02_STATE_ILLEGAL_INST)) //instCount[opcode]++; @@ -3030,7 +3030,7 @@ WriteLog("\n*** IRQ ***\n\n"); // // Get the clock of the currently executing CPU // -uint64 GetCurrentV65C02Clock(void) +uint64_t GetCurrentV65C02Clock(void) { return regs.clock; } diff --git a/src/v65c02.h b/src/v65c02.h index c880331..145e659 100755 --- a/src/v65c02.h +++ b/src/v65c02.h @@ -8,7 +8,7 @@ #ifndef __V65C02_H__ #define __V65C02_H__ -#include "types.h" +#include // Useful defines @@ -31,17 +31,17 @@ struct V65C02REGS { - uint16 pc; // 65C02 PC register - uint8 cc; // 65C02 Condition Code register - uint8 sp; // 65C02 System stack pointer (bound to $01xx) - uint8 a; // 65C02 A register - uint8 x; // 65C02 X index register - uint8 y; // 65C02 Y register -// uint32 clock; // 65C02 clock (@ 1 MHz, wraps at 71.5 minutes) - uint64 clock; // 65C02 clock (@ 1 MHz, wraps at 570842 years) - uint8 (* RdMem)(uint16); // Address of BYTE read routine - void (* WrMem)(uint16, uint8); // Address of BYTE write routine - uint16 cpuFlags; // v65C02 IRQ/RESET flags + uint16_t pc; // 65C02 PC register + uint8_t cc; // 65C02 Condition Code register + uint8_t sp; // 65C02 System stack pointer (bound to $01xx) + uint8_t a; // 65C02 A register + uint8_t x; // 65C02 X index register + uint8_t y; // 65C02 Y register +// uint32_t clock; // 65C02 clock (@ 1 MHz, wraps at 71.5 minutes) + uint64_t clock; // 65C02 clock (@ 1 MHz, wraps at 570842 years) + uint8_t (* RdMem)(uint16_t); // Address of BYTE read routine + void (* WrMem)(uint16_t, uint8_t); // Address of BYTE write routine + uint16_t cpuFlags; // v65C02 IRQ/RESET flags }; // Global variables (exported) @@ -50,7 +50,7 @@ extern bool dumpDis; // Function prototypes -void Execute65C02(V65C02REGS *, uint32); // Function to execute 65C02 instructions -uint64 GetCurrentV65C02Clock(void); // Get the clock of the currently executing CPU +void Execute65C02(V65C02REGS *, uint32_t); // Function to execute 65C02 instructions +uint64_t GetCurrentV65C02Clock(void); // Get the clock of the currently executing CPU #endif // __V65C02_H__ diff --git a/src/video.cpp b/src/video.cpp index 76abe71..fbd2262 100755 --- a/src/video.cpp +++ b/src/video.cpp @@ -12,347 +12,88 @@ // #include "video.h" - -//#include +#include #include // Why??? (for memset, etc... Lazy!) Dunno why, but this just strikes me as wrong... #include -#include "sdlemu_opengl.h" #include "log.h" #include "settings.h" -#include "icon.h" - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN -#define MASK_R 0xFF000000 -#define MASK_G 0x00FF0000 -#define MASK_B 0x0000FF00 -#define MASK_A 0x000000FF -#else -#define MASK_R 0x000000FF -#define MASK_G 0x0000FF00 -#define MASK_B 0x00FF0000 -#define MASK_A 0xFF000000 -#endif -//#define TEST_ALPHA_BLENDING // Exported global variables (actually, these are LOCAL global variables, EXPORTED...) -SDL_Surface * surface, * mainSurface, * someAlphaSurface; -Uint32 mainSurfaceFlags; -//uint32 scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT]; -uint32 * scrBuffer = NULL, * mainScrBuffer = NULL; -SDL_Joystick * joystick; +static SDL_Window * sdlWindow = NULL; +static SDL_Renderer * sdlRenderer = NULL; +static SDL_Texture * sdlTexture = NULL; +uint32_t scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32_t)]; + // // Prime SDL and create surfaces // bool InitVideo(void) { - // Set up SDL library - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE | SDL_INIT_EVENTTHREAD) < 0) + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE) != 0) { WriteLog("Video: Could not initialize the SDL library: %s\n", SDL_GetError()); return false; } - //Set icon (mainly for Win32 target--though seems to work under KDE as well...!) - SDL_Surface * iconSurf = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32, 128, - MASK_R, MASK_G, MASK_B, MASK_A); - SDL_WM_SetIcon(iconSurf, NULL); - SDL_FreeSurface(iconSurf); - - // Get proper info about the platform we're running on... - const SDL_VideoInfo * info = SDL_GetVideoInfo(); + int retVal = SDL_CreateWindowAndRenderer(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT * 2, SDL_WINDOW_OPENGL, &sdlWindow, &sdlRenderer); - if (!info) + if (retVal != 0) { - WriteLog("Video: SDL is unable to get the video info: %s\n", SDL_GetError()); + WriteLog("Video: Could not window and/or renderer: %s\n", SDL_GetError()); return false; } - if (settings.useOpenGL) - { - mainSurfaceFlags = SDL_HWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF | SDL_OPENGL; - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - } - else - { - mainSurfaceFlags = SDL_DOUBLEBUF; - - if (info->hw_available) - { - mainSurfaceFlags = SDL_HWSURFACE | SDL_HWPALETTE; - WriteLog("Video: Hardware available...\n"); - } + // Make the scaled rendering look smoother. + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); +// SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); + SDL_RenderSetLogicalSize(sdlRenderer, VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT); - if (info->blit_hw) - { - mainSurfaceFlags |= SDL_HWACCEL; - WriteLog("Video: Hardware blit available...\n"); - } - } - - if (settings.fullscreen) - mainSurfaceFlags |= SDL_FULLSCREEN; - - // Create the primary SDL display (32 BPP) - if (!settings.useOpenGL) - mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 32, mainSurfaceFlags); - else -// mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT * 2, 32, mainSurfaceFlags); -// mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT * 2, 32, mainSurfaceFlags); - mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 32, mainSurfaceFlags); - - if (mainSurface == NULL) - { - WriteLog("Video: SDL is unable to set the video mode: %s\n", SDL_GetError()); - return false; - } - - SDL_WM_SetCaption("Apple 2 SDL", "Apple 2 SDL"); - - // Create the secondary SDL display (32 BPP) that we use directly - surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 32, - MASK_R, MASK_G, MASK_B, MASK_A); -#if 0 -WriteLog("Video: Created secondary surface with attributes:\n\n"); -WriteLog("\tWidth, height: %u x %u\n", surface->w, surface->h); -WriteLog("\t Pitch: %u\n", surface->pitch); -WriteLog("\t Palette: %08X\n", surface->format->palette); -WriteLog("\t BPP: %u\n", surface->format->BitsPerPixel); -WriteLog("\t BytesPP: %u\n", surface->format->BytesPerPixel); -WriteLog("\t RMask: %08X\n", surface->format->Rmask); -WriteLog("\t GMask: %08X\n", surface->format->Gmask); -WriteLog("\t BMask: %08X\n", surface->format->Bmask); -WriteLog("\t AMask: %08X\n", surface->format->Amask); -WriteLog("\n"); -#endif - - if (surface == NULL) - { - WriteLog("Video: Could not create secondary SDL surface: %s\n", SDL_GetError()); - return false; - } - - if (settings.useOpenGL) - sdlemu_init_opengl(surface, mainSurface, 1 /*method*/, settings.glFilter /*texture type (linear, nearest)*/, - 0 /* Automatic bpp selection based upon src */); - - // Initialize Joystick support under SDL -/* if (settings.useJoystick) - { - if (SDL_NumJoysticks() <= 0) - { - settings.useJoystick = false; - WriteLog("Video: No joystick(s) or joypad(s) detected on your system. Using keyboard...\n"); - } - else - { - if ((joystick = SDL_JoystickOpen(settings.joyport)) == 0) - { - settings.useJoystick = false; - WriteLog("Video: Unable to open a Joystick on port: %d\n", (int)settings.joyport); - } - else - WriteLog("Video: Using: %s\n", SDL_JoystickName(settings.joyport)); - } - }//*/ - - // Set up the scrBuffer - scrBuffer = (uint32 *)surface->pixels; // Kludge--And shouldn't have to lock since it's a software surface... -//needed? Dunno. Mebbe an SDL function instead? -// memset(scrBuffer, 0x00, VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32)); - // Set up the mainScrBuffer - mainScrBuffer = (uint32 *)mainSurface->pixels; // May need to lock... - -#ifdef TEST_ALPHA_BLENDING -//Here's some code to test alpha blending... -//Well whaddya know, it works. :-) - someAlphaSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 30, 30, 32, - MASK_R, MASK_G, MASK_B, MASK_A); - - for(int i=0; i<30; i++) - { - for(int j=0; j<30; j++) - { - uint32 color = (uint32)(((double)(i * j) / (29.0 * 29.0)) * 255.0); - color = (color << 24) | 0x00FF00FF; - ((uint32 *)someAlphaSurface->pixels)[(j * 30) + i] = color; - } - } -//End test code -#endif + sdlTexture = SDL_CreateTexture(sdlRenderer, + SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STREAMING, + VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT); WriteLog("Video: Successfully initialized.\n"); return true; } + // // Free various SDL components // void VideoDone(void) { - WriteLog("Video: Shutting down OpenGL...\n"); - if (settings.useOpenGL) - sdlemu_close_opengl(); - -// WriteLog("Video: Shutting down joystick....\n"); -// SDL_JoystickClose(joystick); - WriteLog("Video: Freeing 'surface'...\n"); - SDL_FreeSurface(surface); -#warning "The problem is here: Doing the SDL_Quit function causes a double free. !!! FIX !!!" -#warning "Some googling suggests that it may be the thread component causing the trouble." -#if 0 -*** glibc detected *** ./apple2: double free or corruption (!prev): 0x08239480 *** -======= Backtrace: ========= -/lib/libc.so.6[0xb7c96572] -/lib/libc.so.6[0xb7c97cc3] -/lib/libc.so.6(cfree+0x6d)[0xb7c9afed] -/usr/lib/dri/radeon_dri.so(_mesa_free+0x1d)[0xb6edefbd] -/usr/lib/dri/radeon_dri.so(_mesa_delete_texture_image+0x41)[0xb6efc6b1] -/usr/lib/dri/radeon_dri.so(_mesa_delete_texture_object+0x75)[0xb6f032d5] -/usr/lib/dri/radeon_dri.so[0xb6e898fd] -/usr/lib/dri/radeon_dri.so[0xb6eab379] -/usr/lib/dri/radeon_dri.so(_mesa_HashDeleteAll+0x66)[0xb6ecb236] -/usr/lib/dri/radeon_dri.so[0xb6eabb76] -/usr/lib/dri/radeon_dri.so(_mesa_free_context_data+0x1d1)[0xb6eac8e1] -/usr/lib/dri/radeon_dri.so(_mesa_destroy_context+0x26)[0xb6eac976] -/usr/lib/dri/radeon_dri.so(radeonDestroyContext+0x13b)[0xb6e7b97b] -/usr/lib/dri/radeon_dri.so[0xb6e779c7] -//usr//lib/opengl/xorg-x11/lib/libGL.so.1[0xb7dc3e0c] -//usr//lib/opengl/xorg-x11/lib/libGL.so.1[0xb7d9ec75] -/usr/lib/libSDL-1.2.so.0[0xb7f488d2] -/usr/lib/libSDL-1.2.so.0[0xb7f4cb67] -/usr/lib/libSDL-1.2.so.0[0xb7f4cda7] -/usr/lib/libSDL-1.2.so.0(SDL_VideoQuit+0x4e)[0xb7f3af6e] -/usr/lib/libSDL-1.2.so.0(SDL_QuitSubSystem+0x5b)[0xb7f0e5cb] -/usr/lib/libSDL-1.2.so.0(SDL_Quit+0x1e)[0xb7f0e66e] -./apple2[0x806b3e5] -./apple2[0x806be81] -/lib/libc.so.6(__libc_start_main+0xe1)[0xb7c3da51] -./apple2[0x804a541] -#endif -// WriteLog("Video: Shutting down SDL subsystems...\n"); -// SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_EVENTTHREAD); WriteLog("Video: Shutting down SDL...\n"); SDL_Quit(); WriteLog("Video: Done.\n"); } + // // Render the screen buffer to the primary screen surface // -//void RenderBackbuffer(void) void RenderScreenBuffer(void) { -//WriteLog("Video: Blitting a %u x %u surface to the main surface...\n", surface->w, surface->h); -//Don't need this crapola--why have a separate buffer just to copy it to THIS -//buffer in order to copy it to the main screen? That's what *I* thought! -/* if (SDL_MUSTLOCK(surface)) - while (SDL_LockSurface(surface) < 0) - SDL_Delay(10); - - memcpy(surface->pixels, scrBuffer, VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32)); - - if (SDL_MUSTLOCK(surface)) - SDL_UnlockSurface(surface);//*/ -#ifdef TEST_ALPHA_BLENDING -SDL_Rect dstRect = { 100, 100, 30, 30 }; -SDL_BlitSurface(someAlphaSurface, NULL, surface, &dstRect); -#endif - - if (settings.useOpenGL) - sdlemu_draw_texture(mainSurface, surface, 1/*1=GL_QUADS*/); - else - { -// SDL_Rect rect = { 0, 0, surface->w, surface->h }; -// SDL_BlitSurface(surface, &rect, mainSurface, &rect); - SDL_BlitSurface(surface, NULL, mainSurface, NULL); - SDL_Flip(mainSurface); - } + SDL_UpdateTexture(sdlTexture, NULL, scrBuffer, VIRTUAL_SCREEN_WIDTH * sizeof(Uint32)); + SDL_RenderClear(sdlRenderer); + SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL); + SDL_RenderPresent(sdlRenderer); } -// Is this even necessary? (Could call SDL_Flip directly...) -void FlipMainScreen(void) -{ -#ifdef TEST_ALPHA_BLENDING -SDL_Rect dstRect = { 100, 100, 30, 30 }; -SDL_BlitSurface(someAlphaSurface, NULL, mainSurface, &dstRect); -#endif - if (settings.useOpenGL) - sdlemu_draw_texture(mainSurface, surface, 1/*1=GL_QUADS*/); - else - SDL_Flip(mainSurface); -} - -/* -// -// Resize the main SDL screen & scrBuffer -// -void ResizeScreen(uint32 width, uint32 height) -{ - char window_title[256]; - - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 16, - 0x7C00, 0x03E0, 0x001F, 0); - - if (surface == NULL) - { - WriteLog("Video: Could not create primary SDL surface: %s", SDL_GetError()); - exit(1); - } - - if (settings.useOpenGL) - // This seems to work well for resizing (i.e., changes in the pixel width)... - sdlemu_resize_texture(surface, mainSurface, settings.glFilter); - else - { - mainSurface = SDL_SetVideoMode(width, height, 16, mainSurfaceFlags); - - if (mainSurface == NULL) - { - WriteLog("Video: SDL is unable to set the video mode: %s\n", SDL_GetError()); - exit(1); - } - } - - sWriteLog(window_title, "Virtual Jaguar (%i x %i)", (int)width, (int)height); - SDL_WM_SetCaption(window_title, window_title); - - // This seems to work well for resizing (i.e., changes in the pixel width)... -// if (settings.useOpenGL) -// sdlemu_resize_texture(surface, mainSurface); -}*/ - -/* // // Fullscreen <-> window switching // -//NOTE: This does *NOT* work with OpenGL rendering! !!! FIX !!! -void ToggleFullscreen(void) +void ToggleFullScreen(void) { settings.fullscreen = !settings.fullscreen; - mainSurfaceFlags &= ~SDL_FULLSCREEN; - if (settings.fullscreen) - mainSurfaceFlags |= SDL_FULLSCREEN; + int retVal = SDL_SetWindowFullscreen(sdlWindow, (settings.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)); + SDL_ShowCursor(settings.fullscreen ? 0 : 1); - if (!settings.useOpenGL) - mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 32, mainSurfaceFlags); - else -// mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT * 2, 32, mainSurfaceFlags); -// mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT * 2, 32, mainSurfaceFlags); - mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 32, mainSurfaceFlags); -// mainSurface = SDL_SetVideoMode(tom_width, tom_height, 16, mainSurfaceFlags); - - if (mainSurface == NULL) - { - WriteLog("Video: SDL is unable to set the video mode: %s\n", SDL_GetError()); - exit(1); - } - - SDL_WM_SetCaption("Apple 2 SDL", "Apple 2 SDL"); + if (retVal != 0) + WriteLog("Video::ToggleFullScreen: SDL error = %s\n", SDL_GetError()); } -//*/ + diff --git a/src/video.h b/src/video.h index 027ee64..60c87ef 100755 --- a/src/video.h +++ b/src/video.h @@ -5,8 +5,7 @@ #ifndef __VIDEO_H__ #define __VIDEO_H__ -#include // For SDL_Surface -#include "types.h" // For uint32 +#include // For uint32_t //#define VIRTUAL_SCREEN_WIDTH 280 #define VIRTUAL_SCREEN_WIDTH 560 @@ -15,19 +14,13 @@ bool InitVideo(void); void VideoDone(void); -//void RenderBackbuffer(void); void RenderScreenBuffer(void); -void FlipMainScreen(void); -//void ResizeScreen(uint32 width, uint32 height); -//uint32 GetSDLScreenPitch(void); -//void ToggleFullscreen(void); +void ToggleFullScreen(void); // Exported crap -//extern uint32 scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT]; -extern uint32 * scrBuffer; -extern uint32 * mainScrBuffer; -extern SDL_Surface * surface; -extern SDL_Surface * mainSurface; +extern uint32_t scrBuffer[]; +extern uint32_t mainScrBuffer[]; #endif // __VIDEO_H__ +