From 31391e090c0a5de9c7c4c7e17e9ecb1e0dcbeb3d Mon Sep 17 00:00:00 2001 From: Dorian Wouters Date: Fri, 29 Jul 2016 11:07:11 +0200 Subject: [PATCH] Kill common/Types.h, replace its old typedefs w/ standard types Fix includes in files using standard int types Fix wxWidgets UI includes Silence some unused variable warnings in GBA-arm.cpp macros --- CMakeLists.txt | 1 - src/System.h | 26 +- src/Util.cpp | 100 ++--- src/Util.h | 6 +- src/common/Patch.cpp | 24 +- src/common/Patch.h | 2 +- src/common/Types.h | 33 -- src/common/ffmpeg.cpp | 2 +- src/common/ffmpeg.h | 10 +- src/filters/2xSaI.cpp | 292 +++++++------- src/filters/admame.cpp | 46 +-- src/filters/bilinear.cpp | 252 ++++++------ src/filters/hq/asm/hq3x_16.asm | 4 +- src/filters/hq/asm/hq3x_32.asm | 4 +- src/filters/hq2x.cpp | 72 ++-- src/filters/interframe.cpp | 110 +++--- src/filters/interp.h | 56 +-- src/filters/pixel.cpp | 56 +-- src/filters/scanline.cpp | 92 ++--- src/filters/simpleFilter.cpp | 58 +-- src/filters/xbrzfilter.cpp | 10 +- src/gb/gb.h | 2 +- src/gb/gbCheats.cpp | 2 +- src/gb/gbCheats.h | 2 +- src/gb/gbCodes.h | 14 +- src/gb/gbGlobals.cpp | 4 +- src/gb/gbGlobals.h | 2 + src/gba/CheatSearch.cpp | 36 +- src/gba/Cheats.cpp | 36 +- src/gba/GBA-arm.cpp | 17 +- src/gba/GBA-thumb.cpp | 536 +++++++++++++------------- src/gba/GBA.cpp | 4 +- src/gba/GBA.h | 2 + src/gba/GBALink.cpp | 298 +++++++------- src/gba/GBALink.h | 22 +- src/gba/GBASockClient.cpp | 10 +- src/gba/GBASockClient.h | 6 +- src/gba/Globals.cpp | 176 ++++----- src/gba/Globals.h | 177 +++++---- src/gba/Mode0.cpp | 102 ++--- src/gba/Mode1.cpp | 112 +++--- src/gba/Mode2.cpp | 96 ++--- src/gba/Mode3.cpp | 70 ++-- src/gba/Mode4.cpp | 70 ++-- src/gba/Mode5.cpp | 70 ++-- src/gba/RTC.cpp | 36 +- src/gba/RTC.h | 8 +- src/gba/Sound.cpp | 42 +- src/gba/Sound.h | 8 +- src/gba/Sram.cpp | 6 +- src/gba/bios.cpp | 10 +- src/gba/bios.h | 2 +- src/gba/debugger-expr-yacc.cpp | 14 +- src/gba/debugger-expr.y | 14 +- src/gba/gbafilter.cpp | 14 +- src/gba/remote.cpp | 320 +++++++-------- src/gba/remote.h | 57 ++- src/gtk/filters.cpp | 54 +-- src/gtk/filters.h | 6 +- src/gtk/screenarea-cairo.cpp | 12 +- src/gtk/screenarea-cairo.h | 2 +- src/gtk/screenarea-opengl.cpp | 4 +- src/gtk/screenarea-opengl.h | 2 +- src/gtk/screenarea.cpp | 16 +- src/gtk/screenarea.h | 6 +- src/gtk/system.cpp | 16 +- src/gtk/window.cpp | 4 +- src/gtk/window.h | 6 +- src/libretro/SoundRetro.cpp | 2 +- src/libretro/SoundRetro.h | 2 +- src/libretro/UtilRetro.cpp | 2 +- src/libretro/libretro.cpp | 24 +- src/sdl/SDL.cpp | 70 ++-- src/sdl/debugger.cpp | 204 +++++----- src/sdl/debugger.h | 2 +- src/sdl/exprNode.cpp | 8 +- src/sdl/exprNode.h | 4 +- src/sdl/filters.cpp | 156 ++++---- src/sdl/filters.h | 6 +- src/sdl/text.cpp | 30 +- src/sdl/text.h | 2 +- src/win32/BitmapControl.cpp | 2 +- src/win32/BitmapControl.h | 6 +- src/win32/BugReport.cpp | 10 +- src/win32/ColorButton.cpp | 2 +- src/win32/ColorButton.h | 4 +- src/win32/ColorControl.cpp | 2 +- src/win32/ColorControl.h | 4 +- src/win32/Direct3D.cpp | 30 +- src/win32/DirectInput.cpp | 6 +- src/win32/DirectSound.cpp | 4 +- src/win32/Disassemble.cpp | 6 +- src/win32/Disassemble.h | 2 +- src/win32/GBACheats.cpp | 18 +- src/win32/GBACheats.h | 8 +- src/win32/GBCheatsDlg.cpp | 26 +- src/win32/GBCheatsDlg.h | 8 +- src/win32/GBColorDlg.cpp | 10 +- src/win32/GBColorDlg.h | 4 +- src/win32/GBDisassemble.cpp | 8 +- src/win32/GBDisassemble.h | 4 +- src/win32/GBMapView.cpp | 84 ++-- src/win32/GBMapView.h | 4 +- src/win32/GBMemoryViewerDlg.cpp | 24 +- src/win32/GBMemoryViewerDlg.h | 6 +- src/win32/GBOamView.cpp | 76 ++-- src/win32/GBOamView.h | 2 +- src/win32/GBPaletteView.cpp | 4 +- src/win32/GBPrinterDlg.cpp | 58 +-- src/win32/GBPrinterDlg.h | 6 +- src/win32/GBTileView.cpp | 70 ++-- src/win32/GBTileView.h | 4 +- src/win32/IOViewer.cpp | 6 +- src/win32/IOViewerRegs.h | 6 +- src/win32/Input.h | 2 +- src/win32/MainWndFile.cpp | 2 +- src/win32/MainWndOptions.cpp | 4 +- src/win32/MainWndTools.cpp | 2 +- src/win32/MapView.cpp | 132 +++---- src/win32/MapView.h | 12 +- src/win32/MemoryViewer.cpp | 20 +- src/win32/MemoryViewer.h | 16 +- src/win32/MemoryViewerAddressSize.cpp | 6 +- src/win32/MemoryViewerAddressSize.h | 8 +- src/win32/MemoryViewerDlg.cpp | 22 +- src/win32/MemoryViewerDlg.h | 6 +- src/win32/OamView.cpp | 76 ++-- src/win32/OamView.h | 6 +- src/win32/OpenAL.cpp | 4 +- src/win32/OpenGL.cpp | 12 +- src/win32/PaletteView.cpp | 4 +- src/win32/PaletteViewControl.cpp | 26 +- src/win32/PaletteViewControl.h | 6 +- src/win32/RomInfo.cpp | 10 +- src/win32/RomInfo.h | 8 +- src/win32/TileView.cpp | 74 ++-- src/win32/TileView.h | 6 +- src/win32/VBA.cpp | 134 +++---- src/win32/VBA.h | 6 +- src/win32/VBA.rc | 2 +- src/win32/WavWriter.cpp | 16 +- src/win32/WavWriter.h | 2 +- src/win32/XAudio2.cpp | 4 +- src/win32/ZoomControl.cpp | 4 +- src/win32/ZoomControl.h | 4 +- src/win32/rpi.cpp | 30 +- src/win32/rpi.h | 2 +- src/wx/cmdevents.cpp | 14 +- src/wx/drawing.h | 2 + src/wx/dsound.cpp | 4 +- src/wx/filters.h | 102 ++--- src/wx/gfxviewers.cpp | 210 +++++----- src/wx/guiinit.cpp | 64 +-- src/wx/ioregs.h | 6 +- src/wx/openal.cpp | 4 +- src/wx/opts.h | 2 +- src/wx/panel.cpp | 24 +- src/wx/sys.cpp | 72 ++-- src/wx/viewers.cpp | 78 ++-- src/wx/viewsupt.cpp | 24 +- src/wx/viewsupt.h | 26 +- src/wx/widgets/wx/wxmisc.h | 2 + src/wx/wxvbam.h | 30 +- src/wx/xaudio2.cpp | 4 +- 164 files changed, 3067 insertions(+), 3076 deletions(-) delete mode 100644 src/common/Types.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 746edd40..4318c6b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,7 +274,6 @@ SET(HDR_MAIN src/common/Port.h src/common/SoundDriver.h src/common/SoundSDL.h - src/common/Types.h ) if(ENABLE_FFMPEG) diff --git a/src/System.h b/src/System.h index 9d682fba..adb0d876 100644 --- a/src/System.h +++ b/src/System.h @@ -1,6 +1,8 @@ #ifndef SYSTEM_H #define SYSTEM_H -#include "common/Types.h" + +#include + #ifndef __LIBRETRO__ #include #endif @@ -22,9 +24,9 @@ struct EmulatedSystem { bool (*emuWriteBattery)(const char *); #ifdef __LIBRETRO__ // load state - bool (*emuReadState)(const u8 *, unsigned); + bool (*emuReadState)(const uint8_t *, unsigned); // load state - unsigned (*emuWriteState)(u8 *, unsigned); + unsigned (*emuWriteState)(uint8_t *, unsigned); #else // load state bool (*emuReadState)(const char *); @@ -49,25 +51,25 @@ struct EmulatedSystem { extern void log(const char *, ...); extern bool systemPauseOnFrame(); -extern void systemGbPrint(u8 *, int, int, int, int, int); +extern void systemGbPrint(uint8_t *, int, int, int, int, int); extern void systemScreenCapture(int); extern void systemDrawScreen(); // updates the joystick data extern bool systemReadJoypads(); // return information about the given joystick, -1 for default joystick -extern u32 systemReadJoypad(int); -extern u32 systemGetClock(); +extern uint32_t systemReadJoypad(int); +extern uint32_t systemGetClock(); extern void systemMessage(int, const char *, ...); extern void systemSetTitle(const char *); extern SoundDriver *systemSoundInit(); -extern void systemOnWriteDataToSoundBuffer(const u16 *finalWave, int length); +extern void systemOnWriteDataToSoundBuffer(const uint16_t *finalWave, int length); extern void systemOnSoundShutdown(); extern void systemScreenMessage(const char *); extern void systemUpdateMotionSensor(); extern int systemGetSensorX(); extern int systemGetSensorY(); extern int systemGetSensorZ(); -extern u8 systemGetSensorDarkness(); +extern uint8_t systemGetSensorDarkness(); extern void systemCartridgeRumble(bool); extern void systemPossibleCartridgeRumble(bool); extern void updateRumbleFrame(); @@ -80,11 +82,11 @@ extern void Sm60FPS_Init(); extern bool Sm60FPS_CanSkipFrame(); extern void Sm60FPS_Sleep(); extern void DbgMsg(const char *msg, ...); -extern void (*dbgOutput)(const char *s, u32 addr); +extern void (*dbgOutput)(const char *s, uint32_t addr); extern void (*dbgSignal)(int sig, int number); -extern u16 systemColorMap16[0x10000]; -extern u32 systemColorMap32[0x10000]; -extern u16 systemGbPalette[24]; +extern uint16_t systemColorMap16[0x10000]; +extern uint32_t systemColorMap32[0x10000]; +extern uint16_t systemGbPalette[24]; extern int systemRedShift; extern int systemGreenShift; extern int systemBlueShift; diff --git a/src/Util.cpp b/src/Util.cpp index b5dc04c9..dc2135b2 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -46,8 +46,8 @@ extern int systemRedShift; extern int systemGreenShift; extern int systemBlueShift; -extern u16 systemColorMap16[0x10000]; -extern u32 systemColorMap32[0x10000]; +extern uint16_t systemColorMap16[0x10000]; +extern uint32_t systemColorMap32[0x10000]; static int(ZEXPORT *utilGzWriteFunc)(gzFile, const voidp, unsigned int) = NULL; static int(ZEXPORT *utilGzReadFunc)(gzFile, voidp, unsigned int) = NULL; @@ -64,17 +64,17 @@ bool FileExists(const char *filename) #endif } -void utilReadScreenPixels(u8 *dest, int w, int h) +void utilReadScreenPixels(uint8_t *dest, int w, int h) { - u8 *b = dest; + uint8_t *b = dest; int sizeX = w; int sizeY = h; switch (systemColorDepth) { case 16: { - u16 *p = (u16 *)(pix + (w + 2) * 2); // skip first black line + uint16_t *p = (uint16_t *)(pix + (w + 2) * 2); // skip first black line for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u16 v = *p++; + uint16_t v = *p++; *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G @@ -85,7 +85,7 @@ void utilReadScreenPixels(u8 *dest, int w, int h) } } break; case 24: { - u8 *pixU8 = (u8 *)pix; + uint8_t *pixU8 = (uint8_t *)pix; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { if (systemRedShift < systemBlueShift) { @@ -105,10 +105,10 @@ void utilReadScreenPixels(u8 *dest, int w, int h) } } break; case 32: { - u32 *pixU32 = (u32 *)(pix + 4 * (w + 1)); + uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1)); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 v = *pixU32++; + uint32_t v = *pixU32++; *b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R @@ -119,10 +119,10 @@ void utilReadScreenPixels(u8 *dest, int w, int h) } } -bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) +bool utilWritePNGFile(const char *fileName, int w, int h, uint8_t *pix) { #ifndef NO_PNG - u8 writeBuffer[512 * 3]; + uint8_t writeBuffer[512 * 3]; FILE *fp = fopen(fileName, "wb"); @@ -165,17 +165,17 @@ bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) png_write_info(png_ptr, info_ptr); - u8 *b = writeBuffer; + uint8_t *b = writeBuffer; int sizeX = w; int sizeY = h; switch (systemColorDepth) { case 16: { - u16 *p = (u16 *)(pix + (w + 2) * 2); // skip first black line + uint16_t *p = (uint16_t *)(pix + (w + 2) * 2); // skip first black line for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u16 v = *p++; + uint16_t v = *p++; *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G @@ -189,7 +189,7 @@ bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) } } break; case 24: { - u8 *pixU8 = (u8 *)pix; + uint8_t *pixU8 = (uint8_t *)pix; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { if (systemRedShift < systemBlueShift) { @@ -212,10 +212,10 @@ bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) } } break; case 32: { - u32 *pixU32 = (u32 *)(pix + 4 * (w + 1)); + uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1)); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 v = *pixU32++; + uint32_t v = *pixU32++; *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G @@ -242,7 +242,7 @@ bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) #endif } -void utilPutDword(u8 *p, u32 value) +void utilPutDword(uint8_t *p, uint32_t value) { *p++ = value & 255; *p++ = (value >> 8) & 255; @@ -250,15 +250,15 @@ void utilPutDword(u8 *p, u32 value) *p = (value >> 24) & 255; } -void utilPutWord(u8 *p, u16 value) +void utilPutWord(uint8_t *p, uint16_t value) { *p++ = value & 255; *p = (value >> 8) & 255; } -bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) +bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix) { - u8 writeBuffer[512 * 3]; + uint8_t writeBuffer[512 * 3]; FILE *fp = fopen(fileName, "wb"); @@ -268,29 +268,29 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - // u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + // uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + w * h * 3; + uint32_t fsz = sizeof(bmpheader) + w * h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x36); utilPutDword(bmpheader.headersize, 0x28); @@ -302,17 +302,17 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8 *b = writeBuffer; + uint8_t *b = writeBuffer; int sizeX = w; int sizeY = h; switch (systemColorDepth) { case 16: { - u16 *p = (u16 *)(pix + (w + 2) * (h)*2); // skip first black line + uint16_t *p = (uint16_t *)(pix + (w + 2) * (h)*2); // skip first black line for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u16 v = *p++; + uint16_t v = *p++; *b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G @@ -327,7 +327,7 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) } } break; case 24: { - u8 *pixU8 = (u8 *)pix + 3 * w * (h - 1); + uint8_t *pixU8 = (uint8_t *)pix + 3 * w * (h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { if (systemRedShift > systemBlueShift) { @@ -351,10 +351,10 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) } } break; case 32: { - u32 *pixU32 = (u32 *)(pix + 4 * (w + 1) * (h)); + uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1) * (h)); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 v = *pixU32++; + uint32_t v = *pixU32++; *b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G @@ -544,7 +544,7 @@ static int utilGetSize(int size) return res; } -u8 *utilLoad(const char *file, bool (*accept)(const char *), u8 *data, int &size) +uint8_t *utilLoad(const char *file, bool (*accept)(const char *), uint8_t *data, int &size) { // find image file char buffer[2048]; @@ -573,11 +573,11 @@ u8 *utilLoad(const char *file, bool (*accept)(const char *), u8 *data, int &size if (size == 0) size = fileSize; - u8 *image = data; + uint8_t *image = data; if (image == NULL) { // allocate buffer memory if none was passed to the function - image = (u8 *)malloc(utilGetSize(size)); + image = (uint8_t *)malloc(utilGetSize(size)); if (image == NULL) { fex_close(fe); systemMessage(MSG_OUT_OF_MEMORY, @@ -751,14 +751,14 @@ long utilGzMemTell(gzFile file) void utilGBAFindSave(const int size) { - u32 *p = (u32 *)&rom[0]; - u32 *end = (u32 *)(&rom[0] + size); + uint32_t *p = (uint32_t *)&rom[0]; + uint32_t *end = (uint32_t *)(&rom[0] + size); int detectedSaveType = 0; int flashSize = 0x10000; bool rtcFound = false; while (p < end) { - u32 d = READ32LE(p); + uint32_t d = READ32LE(p); if (d == 0x52504545) { if (memcmp(p, "EEPROM_", 7) == 0) { diff --git a/src/Util.h b/src/Util.h index 37cdeb03..2cf0646a 100644 --- a/src/Util.h +++ b/src/Util.h @@ -13,9 +13,9 @@ typedef struct { bool FileExists(const char *filename); -void utilReadScreenPixels(u8 *dest, int w, int h); -bool utilWritePNGFile(const char *, int, int, u8 *); -bool utilWriteBMPFile(const char *, int, int, u8 *); +void utilReadScreenPixels(uint8_t *dest, int w, int h); +bool utilWritePNGFile(const char *, int, int, uint8_t *); +bool utilWriteBMPFile(const char *, int, int, uint8_t *); void utilApplyIPS(const char *ips, uint8_t **rom, int *size); bool utilIsGBAImage(const char *); bool utilIsGBImage(const char *); diff --git a/src/common/Patch.cpp b/src/common/Patch.cpp index 291ac824..e055f716 100644 --- a/src/common/Patch.cpp +++ b/src/common/Patch.cpp @@ -62,9 +62,9 @@ static int readInt3(FILE* f) return c + (res << 8); } -static s64 readInt4(FILE* f) +static int64_t readInt4(FILE* f) { - s64 tmp, res = 0; + int64_t tmp, res = 0; int c; for (int i = 0; i < 4; i++) { @@ -78,9 +78,9 @@ static s64 readInt4(FILE* f) return res; } -static s64 readInt8(FILE* f) +static int64_t readInt8(FILE* f) { - s64 tmp, res = 0; + int64_t tmp, res = 0; int c; for (int i = 0; i < 8; i++) { @@ -94,9 +94,9 @@ static s64 readInt8(FILE* f) return res; } -static s64 readVarPtr(FILE* f) +static int64_t readVarPtr(FILE* f) { - s64 offset = 0, shift = 1; + int64_t offset = 0, shift = 1; for (;;) { int c = fgetc(f); if (c == EOF) @@ -191,7 +191,7 @@ static bool patchApplyIPS(const char* patchname, uint8_t** r, int* s) static bool patchApplyUPS(const char* patchname, uint8_t** rom, int* size) { - s64 srcCRC, dstCRC, patchCRC; + int64_t srcCRC, dstCRC, patchCRC; FILE* f = fopen(patchname, "rb"); if (!f) @@ -231,9 +231,9 @@ static bool patchApplyUPS(const char* patchname, uint8_t** rom, int* size) crc = crc32(crc, *rom, *size); fseeko64(f, 4, SEEK_SET); - s64 dataSize; - s64 srcSize = readVarPtr(f); - s64 dstSize = readVarPtr(f); + int64_t dataSize; + int64_t srcSize = readVarPtr(f); + int64_t dstSize = readVarPtr(f); if (crc == srcCRC) { if (srcSize != *size) { @@ -257,14 +257,14 @@ static bool patchApplyUPS(const char* patchname, uint8_t** rom, int* size) *size = dataSize; } - s64 relative = 0; + int64_t relative = 0; uint8_t* mem; while (ftello64(f) < patchSize - 12) { relative += readVarPtr(f); if (relative > dataSize) continue; mem = *rom + relative; - for (s64 i = relative; i < dataSize; i++) { + for (int64_t i = relative; i < dataSize; i++) { int x = fgetc(f); relative++; if (!x) diff --git a/src/common/Patch.h b/src/common/Patch.h index 1e69eb4f..2d35d4d3 100644 --- a/src/common/Patch.h +++ b/src/common/Patch.h @@ -1,7 +1,7 @@ #ifndef PATCH_H #define PATCH_H -#include "Types.h" +#include bool applyPatch(const char *patchname, uint8_t **rom, int *size); diff --git a/src/common/Types.h b/src/common/Types.h deleted file mode 100644 index d8bd4c13..00000000 --- a/src/common/Types.h +++ /dev/null @@ -1,33 +0,0 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 2008 VBA-M development team - -// 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -#ifndef __VBA_TYPES_H__ -#define __VBA_TYPES_H__ - -#include - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -#endif // __VBA_TYPES_H__ diff --git a/src/common/ffmpeg.cpp b/src/common/ffmpeg.cpp index 02ff564f..ae1c2750 100644 --- a/src/common/ffmpeg.cpp +++ b/src/common/ffmpeg.cpp @@ -129,7 +129,7 @@ MediaRet MediaRecorder::setup_sound_stream(const char *fname, AVOutputFormat *fm ctx = aud_st->codec; ctx->codec_id = fmt->audio_codec; ctx->codec_type = AVMEDIA_TYPE_AUDIO; - // Some encoders don't like s16 (SAMPLE_FMT_S16) + // Some encoders don't like int16_t (SAMPLE_FMT_S16) ctx->sample_fmt = codec->sample_fmts[0]; // This was changed in the initial ffmpeg 3.0 update, // but shouldn't (as far as I'm aware) cause problems with older versions diff --git a/src/common/ffmpeg.h b/src/common/ffmpeg.h index 6455eda7..a8c9ac64 100644 --- a/src/common/ffmpeg.h +++ b/src/common/ffmpeg.h @@ -14,8 +14,6 @@ // is the code to find the available formats & associated extensions for // the file dialog. -#include "../common/Types.h" - // return codes // probably ought to put in own namespace, but this is good enough enum MediaRet { @@ -47,10 +45,10 @@ class MediaRecorder // add a frame of video; width+height+depth already given // assumes a 1-pixel border on top & right // always assumes being passed 1/60th of a second of video - MediaRet AddFrame(const u8 *vid); + MediaRet AddFrame(const uint8_t *vid); // add a frame of audio; uses current sample rate to know length // always assumes being passed 1/60th of a second of audio. - MediaRet AddFrame(const u16 *aud); + MediaRet AddFrame(const uint16_t *aud); private: static bool did_init; @@ -66,8 +64,8 @@ class MediaRecorder #endif priv_AVFormatContext *oc; priv_AVStream *vid_st, *aud_st; - u8 *audio_buf, *video_buf; - u16 *audio_buf2; + uint8_t *audio_buf, *video_buf; + uint16_t *audio_buf2; int frame_len, sample_len, in_audio_buf2; int linesize, pixsize; priv_PixelFormat pixfmt; diff --git a/src/filters/2xSaI.cpp b/src/filters/2xSaI.cpp index 5dbe2870..62e51055 100644 --- a/src/filters/2xSaI.cpp +++ b/src/filters/2xSaI.cpp @@ -6,38 +6,38 @@ extern "C" { #ifdef MMX - void _2xSaILine (u8 *srcPtr, u8 *deltaPtr, u32 srcPitch, - u32 width, u8 *dstPtr, u32 dstPitch); - void _2xSaISuperEagleLine (u8 *srcPtr, u8 *deltaPtr, - u32 srcPitch, u32 width, - u8 *dstPtr, u32 dstPitch); - void _2xSaISuper2xSaILine (u8 *srcPtr, u8 *deltaPtr, - u32 srcPitch, u32 width, - u8 *dstPtr, u32 dstPitch); - void Init_2xSaIMMX (u32 BitFormat); - void BilinearMMX (u16 * A, u16 * B, u16 * C, u16 * D, - u16 * dx, u16 * dy, u8 *dP); - void BilinearMMXGrid0 (u16 * A, u16 * B, u16 * C, u16 * D, - u16 * dx, u16 * dy, u8 *dP); - void BilinearMMXGrid1 (u16 * A, u16 * B, u16 * C, u16 * D, - u16 * dx, u16 * dy, u8 *dP); + void _2xSaILine (uint8_t *srcPtr, uint8_t *deltaPtr, uint32_t srcPitch, + uint32_t width, uint8_t *dstPtr, uint32_t dstPitch); + void _2xSaISuperEagleLine (uint8_t *srcPtr, uint8_t *deltaPtr, + uint32_t srcPitch, uint32_t width, + uint8_t *dstPtr, uint32_t dstPitch); + void _2xSaISuper2xSaILine (uint8_t *srcPtr, uint8_t *deltaPtr, + uint32_t srcPitch, uint32_t width, + uint8_t *dstPtr, uint32_t dstPitch); + void Init_2xSaIMMX (uint32_t BitFormat); + void BilinearMMX (uint16_t * A, uint16_t * B, uint16_t * C, uint16_t * D, + uint16_t * dx, uint16_t * dy, uint8_t *dP); + void BilinearMMXGrid0 (uint16_t * A, uint16_t * B, uint16_t * C, uint16_t * D, + uint16_t * dx, uint16_t * dy, uint8_t *dP); + void BilinearMMXGrid1 (uint16_t * A, uint16_t * B, uint16_t * C, uint16_t * D, + uint16_t * dx, uint16_t * dy, uint8_t *dP); void EndMMX (); bool cpu_mmx = 1; #endif } -static u32 colorMask = 0xF7DEF7DE; -static u32 lowPixelMask = 0x08210821; -static u32 qcolorMask = 0xE79CE79C; -static u32 qlowpixelMask = 0x18631863; -static u32 redblueMask = 0xF81F; -static u32 greenMask = 0x7E0; +static uint32_t colorMask = 0xF7DEF7DE; +static uint32_t lowPixelMask = 0x08210821; +static uint32_t qcolorMask = 0xE79CE79C; +static uint32_t qlowpixelMask = 0x18631863; +static uint32_t redblueMask = 0xF81F; +static uint32_t greenMask = 0x7E0; -u32 qRGB_COLOR_MASK[2] = { 0xF7DEF7DE, 0xF7DEF7DE }; +uint32_t qRGB_COLOR_MASK[2] = { 0xF7DEF7DE, 0xF7DEF7DE }; extern void hq2x_init(unsigned); -int Init_2xSaI(u32 BitFormat) +int Init_2xSaI(uint32_t BitFormat) { if(systemColorDepth == 16) { if (BitFormat == 565) { @@ -81,8 +81,8 @@ int Init_2xSaI(u32 BitFormat) return 1; } -static inline int GetResult1 (u32 A, u32 B, u32 C, u32 D, - u32 /* E */) +static inline int GetResult1 (uint32_t A, uint32_t B, uint32_t C, uint32_t D, + uint32_t /* E */) { int x = 0; int y = 0; @@ -103,8 +103,8 @@ static inline int GetResult1 (u32 A, u32 B, u32 C, u32 D, return r; } -static inline int GetResult2 (u32 A, u32 B, u32 C, u32 D, - u32 /* E */) +static inline int GetResult2 (uint32_t A, uint32_t B, uint32_t C, uint32_t D, + uint32_t /* E */) { int x = 0; int y = 0; @@ -125,7 +125,7 @@ static inline int GetResult2 (u32 A, u32 B, u32 C, u32 D, return r; } -static inline int GetResult (u32 A, u32 B, u32 C, u32 D) +static inline int GetResult (uint32_t A, uint32_t B, uint32_t C, uint32_t D) { int x = 0; int y = 0; @@ -146,7 +146,7 @@ static inline int GetResult (u32 A, u32 B, u32 C, u32 D) return r; } -static inline u32 INTERPOLATE (u32 A, u32 B) +static inline uint32_t INTERPOLATE (uint32_t A, uint32_t B) { if (A != B) { return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + @@ -155,20 +155,20 @@ static inline u32 INTERPOLATE (u32 A, u32 B) return A; } -static inline u32 Q_INTERPOLATE (u32 A, u32 B, u32 C, u32 D) +static inline uint32_t Q_INTERPOLATE (uint32_t A, uint32_t B, uint32_t C, uint32_t D) { - register u32 x = ((A & qcolorMask) >> 2) + + register uint32_t x = ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2); - register u32 y = (A & qlowpixelMask) + + register uint32_t y = (A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask); y = (y >> 2) & qlowpixelMask; return x + y; } -static inline int GetResult1_32 (u32 A, u32 B, u32 C, u32 D, - u32 /* E */) +static inline int GetResult1_32 (uint32_t A, uint32_t B, uint32_t C, uint32_t D, + uint32_t /* E */) { int x = 0; int y = 0; @@ -189,8 +189,8 @@ static inline int GetResult1_32 (u32 A, u32 B, u32 C, u32 D, return r; } -static inline int GetResult2_32 (u32 A, u32 B, u32 C, u32 D, - u32 /* E */) +static inline int GetResult2_32 (uint32_t A, uint32_t B, uint32_t C, uint32_t D, + uint32_t /* E */) { int x = 0; int y = 0; @@ -219,14 +219,14 @@ static inline int GetResult2_32 (u32 A, u32 B, u32 C, u32 D, #define RED_MASK555 0x7C007C00 #define GREEN_MASK555 0x03E003E0 -void Super2xSaI (u8 *srcPtr, u32 srcPitch, - u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, +void Super2xSaI (uint8_t *srcPtr, uint32_t srcPitch, + uint8_t *deltaPtr, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u16 *bP; - u8 *dP; - u32 inc_bP; - u32 Nextline = srcPitch >> 1; + uint16_t *bP; + uint8_t *dP; + uint32_t inc_bP; + uint32_t Nextline = srcPitch >> 1; #ifdef MMX if (cpu_mmx) { for (; height; height--) { @@ -242,15 +242,15 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, inc_bP = 1; for (; height; height--) { - bP = (u16 *) srcPtr; - dP = (u8 *) dstPtr; + bP = (uint16_t *) srcPtr; + dP = (uint8_t *) dstPtr; - for (u32 finish = width; finish; finish -= inc_bP) { - u32 color4, color5, color6; - u32 color1, color2, color3; - u32 colorA0, colorA1, colorA2, colorA3, + for (uint32_t finish = width; finish; finish -= inc_bP) { + uint32_t color4, color5, color6; + uint32_t color1, color2, color3; + uint32_t colorA0, colorA1, colorA2, colorA3, colorB0, colorB1, colorB2, colorB3, colorS1, colorS2; - u32 product1a, product1b, product2a, product2b; + uint32_t product1a, product1b, product2a, product2b; //--------------------------------------- B1 B2 // 4 5 6 S2 @@ -349,11 +349,11 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, product2a = product2a | (product2b << 16); #endif - *((u32 *) dP) = product1a; - *((u32 *) (dP + dstPitch)) = product2a; + *((uint32_t *) dP) = product1a; + *((uint32_t *) (dP + dstPitch)) = product2a; bP += inc_bP; - dP += sizeof (u32); + dP += sizeof (uint32_t); } // end of for ( finish= width etc..) srcPtr += srcPitch; @@ -363,26 +363,26 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, } } -void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, - u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, +void Super2xSaI32 (uint8_t *srcPtr, uint32_t srcPitch, + uint8_t * /* deltaPtr */, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u32 *bP; - u32 *dP; - u32 inc_bP; - u32 Nextline = srcPitch >> 2; + uint32_t *bP; + uint32_t *dP; + uint32_t inc_bP; + uint32_t Nextline = srcPitch >> 2; inc_bP = 1; for (; height; height--) { - bP = (u32 *) srcPtr; - dP = (u32 *) dstPtr; + bP = (uint32_t *) srcPtr; + dP = (uint32_t *) dstPtr; - for (u32 finish = width; finish; finish -= inc_bP) { - u32 color4, color5, color6; - u32 color1, color2, color3; - u32 colorA0, colorA1, colorA2, colorA3, + for (uint32_t finish = width; finish; finish -= inc_bP) { + uint32_t color4, color5, color6; + uint32_t color1, color2, color3; + uint32_t colorA0, colorA1, colorA2, colorA3, colorB0, colorB1, colorB2, colorB3, colorS1, colorS2; - u32 product1a, product1b, product2a, product2b; + uint32_t product1a, product1b, product2a, product2b; //--------------------------------------- B1 B2 // 4 5 6 S2 @@ -487,13 +487,13 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, } // endof: for (; height; height--) } -void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, - u8 *dstPtr, u32 dstPitch, int width, int height) +void SuperEagle (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *dP; - u16 *bP; - u16 *xP; - u32 inc_bP; + uint8_t *dP; + uint16_t *bP; + uint16_t *xP; + uint32_t inc_bP; #ifdef MMX if (cpu_mmx) { @@ -509,17 +509,17 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, { inc_bP = 1; - u32 Nextline = srcPitch >> 1; + uint32_t Nextline = srcPitch >> 1; for (; height; height--) { - bP = (u16 *) srcPtr; - xP = (u16 *) deltaPtr; + bP = (uint16_t *) srcPtr; + xP = (uint16_t *) deltaPtr; dP = dstPtr; - for (u32 finish = width; finish; finish -= inc_bP) { - u32 color4, color5, color6; - u32 color1, color2, color3; - u32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2; - u32 product1a, product1b, product2a, product2b; + for (uint32_t finish = width; finish; finish -= inc_bP) { + uint32_t color4, color5, color6; + uint32_t color1, color2, color3; + uint32_t colorA1, colorA2, colorB1, colorB2, colorS1, colorS2; + uint32_t product1a, product1b, product2a, product2b; colorB1 = *(bP - Nextline); colorB2 = *(bP - Nextline + 1); @@ -618,13 +618,13 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, product2a = product2a | (product2b << 16); #endif - *((u32 *) dP) = product1a; - *((u32 *) (dP + dstPitch)) = product2a; + *((uint32_t *) dP) = product1a; + *((uint32_t *) (dP + dstPitch)) = product2a; *xP = color5; bP += inc_bP; xP += inc_bP; - dP += sizeof (u32); + dP += sizeof (uint32_t); } // end of for ( finish= width etc..) srcPtr += srcPitch; @@ -634,27 +634,27 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } } -void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, - u8 *dstPtr, u32 dstPitch, int width, int height) +void SuperEagle32 (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u32 *dP; - u32 *bP; - u32 *xP; - u32 inc_bP; + uint32_t *dP; + uint32_t *bP; + uint32_t *xP; + uint32_t inc_bP; inc_bP = 1; - u32 Nextline = srcPitch >> 2; + uint32_t Nextline = srcPitch >> 2; for (; height; height--) { - bP = (u32 *) srcPtr; - xP = (u32 *) deltaPtr; - dP = (u32 *)dstPtr; - for (u32 finish = width; finish; finish -= inc_bP) { - u32 color4, color5, color6; - u32 color1, color2, color3; - u32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2; - u32 product1a, product1b, product2a, product2b; + bP = (uint32_t *) srcPtr; + xP = (uint32_t *) deltaPtr; + dP = (uint32_t *)dstPtr; + for (uint32_t finish = width; finish; finish -= inc_bP) { + uint32_t color4, color5, color6; + uint32_t color1, color2, color3; + uint32_t colorA1, colorA2, colorB1, colorB2, colorS1, colorS2; + uint32_t product1a, product1b, product2a, product2b; colorB1 = *(bP - Nextline); colorB2 = *(bP - Nextline + 1); @@ -762,12 +762,12 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } // endof: for (height; height; height--) } -void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, - u8 *dstPtr, u32 dstPitch, int width, int height) +void _2xSaI (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *dP; - u16 *bP; - u32 inc_bP; + uint8_t *dP; + uint16_t *bP; + uint32_t inc_bP; #ifdef MMX if (cpu_mmx) { @@ -782,21 +782,21 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, { inc_bP = 1; - u32 Nextline = srcPitch >> 1; + uint32_t Nextline = srcPitch >> 1; for (; height; height--) { - bP = (u16 *) srcPtr; + bP = (uint16_t *) srcPtr; dP = dstPtr; - for (u32 finish = width; finish; finish -= inc_bP) { + for (uint32_t finish = width; finish; finish -= inc_bP) { - register u32 colorA, colorB; - u32 colorC, colorD, + register uint32_t colorA, colorB; + uint32_t colorC, colorD, colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP; - u32 product, product1, product2; + uint32_t product, product1, product2; //--------------------------------------- // Map of the pixels: I|E F|J @@ -922,11 +922,11 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, product = colorA | (product << 16); product1 = product1 | (product2 << 16); #endif - *((s32 *) dP) = product; - *((u32 *) (dP + dstPitch)) = product1; + *((int32_t *) dP) = product; + *((uint32_t *) (dP + dstPitch)) = product1; bP += inc_bP; - dP += sizeof (u32); + dP += sizeof (uint32_t); } // end of for ( finish= width etc..) srcPtr += srcPitch; @@ -936,27 +936,27 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } } -void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void _2xSaI32 (uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u32 *dP; - u32 *bP; - u32 inc_bP = 1; + uint32_t *dP; + uint32_t *bP; + uint32_t inc_bP = 1; - u32 Nextline = srcPitch >> 2; + uint32_t Nextline = srcPitch >> 2; for (; height; height--) { - bP = (u32 *) srcPtr; - dP = (u32 *) dstPtr; + bP = (uint32_t *) srcPtr; + dP = (uint32_t *) dstPtr; - for (u32 finish = width; finish; finish -= inc_bP) { - register u32 colorA, colorB; - u32 colorC, colorD, + for (uint32_t finish = width; finish; finish -= inc_bP) { + register uint32_t colorA, colorB; + uint32_t colorC, colorD, colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP; - u32 product, product1, product2; + uint32_t product, product1, product2; //--------------------------------------- // Map of the pixels: I|E F|J @@ -1089,7 +1089,7 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } // endof: for (height; height; height--) } -static u32 Bilinear (u32 A, u32 B, u32 x) +static uint32_t Bilinear (uint32_t A, uint32_t B, uint32_t x) { unsigned long areaA, areaB; unsigned long result; @@ -1108,8 +1108,8 @@ static u32 Bilinear (u32 A, u32 B, u32 x) return (result & redblueMask) | ((result >> 16) & greenMask); } -static u32 Bilinear4 (u32 A, u32 B, u32 C, u32 D, u32 x, - u32 y) +static uint32_t Bilinear4 (uint32_t A, uint32_t B, uint32_t C, uint32_t D, uint32_t x, + uint32_t y) { unsigned long areaA, areaB, areaC, areaD; unsigned long result, xy; @@ -1133,21 +1133,21 @@ static u32 Bilinear4 (u32 A, u32 B, u32 C, u32 D, u32 x, return (result & redblueMask) | ((result >> 16) & greenMask); } -void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, - u32 dstWidth, u32 dstHeight, int width, int height) +void Scale_2xSaI (uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, + uint32_t dstWidth, uint32_t dstHeight, int width, int height) { - u8 *dP; - u16 *bP; + uint8_t *dP; + uint16_t *bP; - u32 w; - u32 h; - u32 dw; - u32 dh; - u32 hfinish; - u32 wfinish; + uint32_t w; + uint32_t h; + uint32_t dw; + uint32_t dh; + uint32_t hfinish; + uint32_t wfinish; - u32 Nextline = srcPitch >> 1; + uint32_t Nextline = srcPitch >> 1; wfinish = (width - 1) << 16; // convert to fixed point dw = wfinish / (dstWidth - 1); @@ -1155,21 +1155,21 @@ void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dh = hfinish / (dstHeight - 1); for (h = 0; h < hfinish; h += dh) { - u32 y1, y2; + uint32_t y1, y2; y1 = h & 0xffff; // fraction part of fixed point - bP = (u16 *) (srcPtr + ((h >> 16) * srcPitch)); + bP = (uint16_t *) (srcPtr + ((h >> 16) * srcPitch)); dP = dstPtr; y2 = 0x10000 - y1; w = 0; for (; w < wfinish;) { - u32 A, B, C, D; - u32 E, F, G, H; - u32 I, J, K, L; - u32 x1, x2, a1, f1, f2; - u32 position, product1; + uint32_t A, B, C, D; + uint32_t E, F, G, H; + uint32_t I, J, K, L; + uint32_t x1, x2, a1, f1, f2; + uint32_t position, product1; position = w >> 16; A = bP[position]; // current pixel @@ -1268,7 +1268,7 @@ void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } //end First Pixel - *(u32 *) dP = product1; + *(uint32_t *) dP = product1; dP += 2; w += dw; } diff --git a/src/filters/admame.cpp b/src/filters/admame.cpp index 87e32011..d6661e3c 100644 --- a/src/filters/admame.cpp +++ b/src/filters/admame.cpp @@ -41,7 +41,7 @@ extern "C" bool cpu_mmx; #endif -static void internal_scale2x_16_def(u16 *dst, const u16* src0, const u16* src1, const u16* src2, unsigned count) { +static void internal_scale2x_16_def(uint16_t *dst, const uint16_t* src0, const uint16_t* src1, const uint16_t* src2, unsigned count) { /* first pixel */ dst[0] = src1[0]; if (src1[1] == src0[0] && src2[0] != src0[0]) @@ -79,10 +79,10 @@ static void internal_scale2x_16_def(u16 *dst, const u16* src0, const u16* src1, dst[1] = src1[0]; } -static void internal_scale2x_32_def(u32* dst, - const u32* src0, - const u32* src1, - const u32* src2, +static void internal_scale2x_32_def(uint32_t* dst, + const uint32_t* src0, + const uint32_t* src1, + const uint32_t* src2, unsigned count) { /* first pixel */ @@ -123,7 +123,7 @@ static void internal_scale2x_32_def(u32* dst, } #ifdef MMX -static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* src1, const u16* src2, unsigned count) { +static void internal_scale2x_16_mmx_single(uint16_t* dst, const uint16_t* src0, const uint16_t* src1, const uint16_t* src2, unsigned count) { /* always do the first and last run */ count -= 2*4; @@ -505,7 +505,7 @@ static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* #endif } -static void internal_scale2x_32_mmx_single(u32* dst, const u32* src0, const u32* src1, const u32* src2, unsigned count) { +static void internal_scale2x_32_mmx_single(uint32_t* dst, const uint32_t* src0, const uint32_t* src1, const uint32_t* src2, unsigned count) { /* always do the first and last run */ count -= 2*2; @@ -886,28 +886,28 @@ label1: #endif } -static void internal_scale2x_16_mmx(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count) { +static void internal_scale2x_16_mmx(uint16_t* dst0, uint16_t* dst1, const uint16_t* src0, const uint16_t* src1, const uint16_t* src2, unsigned count) { // assert( count >= 2*4 ); internal_scale2x_16_mmx_single(dst0, src0, src1, src2, count); internal_scale2x_16_mmx_single(dst1, src2, src1, src0, count); } -static void internal_scale2x_32_mmx(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count) { +static void internal_scale2x_32_mmx(uint32_t* dst0, uint32_t* dst1, const uint32_t* src0, const uint32_t* src1, const uint32_t* src2, unsigned count) { // assert( count >= 2*2 ); internal_scale2x_32_mmx_single(dst0, src0, src1, src2, count); internal_scale2x_32_mmx_single(dst1, src2, src1, src0, count); } #endif -void AdMame2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void AdMame2x(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u16 *dst0 = (u16 *)dstPtr; - u16 *dst1 = dst0 + (dstPitch >> 1); + uint16_t *dst0 = (uint16_t *)dstPtr; + uint16_t *dst1 = dst0 + (dstPitch >> 1); - u16 *src0 = (u16 *)srcPtr; - u16 *src1 = src0 + (srcPitch >> 1); - u16 *src2 = src1 + (srcPitch >> 1); + uint16_t *src0 = (uint16_t *)srcPtr; + uint16_t *src1 = src0 + (srcPitch >> 1); + uint16_t *src2 = src1 + (srcPitch >> 1); #ifdef MMX if(cpu_mmx) { internal_scale2x_16_mmx(dst0, dst1, src0, src0, src1, width); @@ -954,15 +954,15 @@ void AdMame2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, #endif } -void AdMame2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void AdMame2x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u32 *dst0 = (u32 *)dstPtr; - u32 *dst1 = dst0 + (dstPitch >> 2); + uint32_t *dst0 = (uint32_t *)dstPtr; + uint32_t *dst1 = dst0 + (dstPitch >> 2); - u32 *src0 = (u32 *)srcPtr; - u32 *src1 = src0 + (srcPitch >> 2); - u32 *src2 = src1 + (srcPitch >> 2); + uint32_t *src0 = (uint32_t *)srcPtr; + uint32_t *src1 = src0 + (srcPitch >> 2); + uint32_t *src2 = src1 + (srcPitch >> 2); #ifdef MMX if(cpu_mmx) { internal_scale2x_32_mmx(dst0, dst1, src0, src0, src1, width); diff --git a/src/filters/bilinear.cpp b/src/filters/bilinear.cpp index e2f9d1b7..2d9d6fc3 100644 --- a/src/filters/bilinear.cpp +++ b/src/filters/bilinear.cpp @@ -10,19 +10,19 @@ ((g) >> 3) << systemGreenShift |\ ((b) >> 3) << systemBlueShift\ -static void fill_rgb_row_16(u16 *from, int src_width, u8 *row, int width) +static void fill_rgb_row_16(uint16_t *from, int src_width, uint8_t *row, int width) { - u8 *copy_start = row + src_width*3; - u8 *all_stop = row + width*3; + uint8_t *copy_start = row + src_width*3; + uint8_t *all_stop = row + width*3; while (row < copy_start) { - u16 color = *from++; + uint16_t color = *from++; *row++ = ((color >> systemRedShift) & 0x1f) << 3; *row++ = ((color >> systemGreenShift) & 0x1f) << 3; *row++ = ((color >> systemBlueShift) & 0x1f) << 3; } // any remaining elements to be written to 'row' are a replica of the // preceding pixel - u8 *p = row-3; + uint8_t *p = row-3; while (row < all_stop) { // we're guaranteed three elements per pixel; could unroll the loop // further, especially with a Duff's Device, but the gains would be @@ -33,19 +33,19 @@ static void fill_rgb_row_16(u16 *from, int src_width, u8 *row, int width) } } -static void fill_rgb_row_32(u32 *from, int src_width, u8 *row, int width) +static void fill_rgb_row_32(uint32_t *from, int src_width, uint8_t *row, int width) { - u8 *copy_start = row + src_width*3; - u8 *all_stop = row + width*3; + uint8_t *copy_start = row + src_width*3; + uint8_t *all_stop = row + width*3; while (row < copy_start) { - u32 color = *from++; + uint32_t color = *from++; *row++ = ((color >> systemRedShift) & 0x1f) << 3; *row++ = ((color >> systemGreenShift) & 0x1f) << 3; *row++ = ((color >> systemBlueShift) & 0x1f) << 3; } // any remaining elements to be written to 'row' are a replica of the // preceding pixel - u8 *p = row-3; + uint8_t *p = row-3; while (row < all_stop) { // we're guaranteed three elements per pixel; could unroll the loop // further, especially with a Duff's Device, but the gains would be @@ -56,24 +56,24 @@ static void fill_rgb_row_32(u32 *from, int src_width, u8 *row, int width) } } -void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Bilinear(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 row_cur[3*322]; - u8 row_next[3*322]; - u8 *rgb_row_cur = row_cur; - u8 *rgb_row_next = row_next; + uint8_t row_cur[3*322]; + uint8_t row_next[3*322]; + uint8_t *rgb_row_cur = row_cur; + uint8_t *rgb_row_next = row_next; - u16 *to = (u16 *)dstPtr; - u16 *to_odd = (u16 *)(dstPtr + dstPitch); + uint16_t *to = (uint16_t *)dstPtr; + uint16_t *to_odd = (uint16_t *)(dstPtr + dstPitch); int from_width = width; - u16 *from = (u16 *)srcPtr; + uint16_t *from = (uint16_t *)srcPtr; fill_rgb_row_16(from, from_width, rgb_row_cur, width+1); for(int y = 0; y < height; y++) { - u16 *from_orig = from; - u16 *to_orig = to; + uint16_t *from_orig = from; + uint16_t *to_orig = to; if (y+1 < height) fill_rgb_row_16(from+width+2, from_width, rgb_row_next, @@ -86,21 +86,21 @@ void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // pixel is 'a', then in what follows 'b' is the src pixel to the // right, 'c' is the src pixel below, and 'd' is the src pixel to // the right and down - u8 *cur_row = rgb_row_cur; - u8 *next_row = rgb_row_next; - u8 *ar = cur_row++; - u8 *ag = cur_row++; - u8 *ab = cur_row++; - u8 *cr = next_row++; - u8 *cg = next_row++; - u8 *cb = next_row++; + uint8_t *cur_row = rgb_row_cur; + uint8_t *next_row = rgb_row_next; + uint8_t *ar = cur_row++; + uint8_t *ag = cur_row++; + uint8_t *ab = cur_row++; + uint8_t *cr = next_row++; + uint8_t *cg = next_row++; + uint8_t *cb = next_row++; for(int x=0; x < width; x++) { - u8 *br = cur_row++; - u8 *bg = cur_row++; - u8 *bb = cur_row++; - u8 *dr = next_row++; - u8 *dg = next_row++; - u8 *db = next_row++; + uint8_t *br = cur_row++; + uint8_t *bg = cur_row++; + uint8_t *bb = cur_row++; + uint8_t *dr = next_row++; + uint8_t *dg = next_row++; + uint8_t *db = next_row++; // upper left pixel in quad: just copy it in *to++ = RGB(*ar, *ag, *ab); @@ -127,36 +127,36 @@ void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // the "next" rgb row becomes the current; the old current rgb row is // recycled and serves as the new "next" row - u8 *temp; + uint8_t *temp; temp = rgb_row_cur; rgb_row_cur = rgb_row_next; rgb_row_next = temp; // update the pointers for start of next pair of lines - from = (u16 *)((u8 *)from_orig + srcPitch); - to = (u16 *)((u8 *)to_orig + (dstPitch << 1)); - to_odd = (u16 *)((u8 *)to + dstPitch); + from = (uint16_t *)((uint8_t *)from_orig + srcPitch); + to = (uint16_t *)((uint8_t *)to_orig + (dstPitch << 1)); + to_odd = (uint16_t *)((uint8_t *)to + dstPitch); } } -void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void BilinearPlus(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 row_cur[3*322]; - u8 row_next[3*322]; - u8 *rgb_row_cur = row_cur; - u8 *rgb_row_next = row_next; + uint8_t row_cur[3*322]; + uint8_t row_next[3*322]; + uint8_t *rgb_row_cur = row_cur; + uint8_t *rgb_row_next = row_next; - u16 *to = (u16 *)dstPtr; - u16 *to_odd = (u16 *)(dstPtr + dstPitch); + uint16_t *to = (uint16_t *)dstPtr; + uint16_t *to_odd = (uint16_t *)(dstPtr + dstPitch); int from_width = width; - u16 *from = (u16 *)srcPtr; + uint16_t *from = (uint16_t *)srcPtr; fill_rgb_row_16(from, from_width, rgb_row_cur, width+1); for(int y = 0; y < height; y++) { - u16 *from_orig = from; - u16 *to_orig = to; + uint16_t *from_orig = from; + uint16_t *to_orig = to; if (y+1 < height) fill_rgb_row_16(from+width+2, from_width, rgb_row_next, @@ -169,21 +169,21 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // pixel is 'a', then in what follows 'b' is the src pixel to the // right, 'c' is the src pixel below, and 'd' is the src pixel to // the right and down - u8 *cur_row = rgb_row_cur; - u8 *next_row = rgb_row_next; - u8 *ar = cur_row++; - u8 *ag = cur_row++; - u8 *ab = cur_row++; - u8 *cr = next_row++; - u8 *cg = next_row++; - u8 *cb = next_row++; + uint8_t *cur_row = rgb_row_cur; + uint8_t *next_row = rgb_row_next; + uint8_t *ar = cur_row++; + uint8_t *ag = cur_row++; + uint8_t *ab = cur_row++; + uint8_t *cr = next_row++; + uint8_t *cg = next_row++; + uint8_t *cb = next_row++; for(int x=0; x < width; x++) { - u8 *br = cur_row++; - u8 *bg = cur_row++; - u8 *bb = cur_row++; - u8 *dr = next_row++; - u8 *dg = next_row++; - u8 *db = next_row++; + uint8_t *br = cur_row++; + uint8_t *bg = cur_row++; + uint8_t *bb = cur_row++; + uint8_t *dr = next_row++; + uint8_t *dg = next_row++; + uint8_t *db = next_row++; // upper left pixel in quad: just copy it in //*to++ = manip.rgb(*ar, *ag, *ab); @@ -221,37 +221,37 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // the "next" rgb row becomes the current; the old current rgb row is // recycled and serves as the new "next" row - u8 *temp; + uint8_t *temp; temp = rgb_row_cur; rgb_row_cur = rgb_row_next; rgb_row_next = temp; // update the pointers for start of next pair of lines - from = (u16 *)((u8 *)from_orig + srcPitch); - to = (u16 *)((u8 *)to_orig + (dstPitch << 1)); - to_odd = (u16 *)((u8 *)to + dstPitch); + from = (uint16_t *)((uint8_t *)from_orig + srcPitch); + to = (uint16_t *)((uint8_t *)to_orig + (dstPitch << 1)); + to_odd = (uint16_t *)((uint8_t *)to + dstPitch); } } -void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Bilinear32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 row_cur[3*322]; - u8 row_next[3*322]; - u8 *rgb_row_cur = row_cur; - u8 *rgb_row_next = row_next; + uint8_t row_cur[3*322]; + uint8_t row_next[3*322]; + uint8_t *rgb_row_cur = row_cur; + uint8_t *rgb_row_next = row_next; - u32 *to = (u32 *)dstPtr; - u32 *to_odd = (u32 *)(dstPtr + dstPitch); + uint32_t *to = (uint32_t *)dstPtr; + uint32_t *to_odd = (uint32_t *)(dstPtr + dstPitch); int from_width = width; - u32 *from = (u32 *)srcPtr; + uint32_t *from = (uint32_t *)srcPtr; fill_rgb_row_32(from, from_width, rgb_row_cur, width+1); for(int y = 0; y < height; y++) { - u32 *from_orig = from; - u32 *to_orig = to; + uint32_t *from_orig = from; + uint32_t *to_orig = to; if (y+1 < height) fill_rgb_row_32(from+width+1, from_width, rgb_row_next, @@ -264,21 +264,21 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // pixel is 'a', then in what follows 'b' is the src pixel to the // right, 'c' is the src pixel below, and 'd' is the src pixel to // the right and down - u8 *cur_row = rgb_row_cur; - u8 *next_row = rgb_row_next; - u8 *ar = cur_row++; - u8 *ag = cur_row++; - u8 *ab = cur_row++; - u8 *cr = next_row++; - u8 *cg = next_row++; - u8 *cb = next_row++; + uint8_t *cur_row = rgb_row_cur; + uint8_t *next_row = rgb_row_next; + uint8_t *ar = cur_row++; + uint8_t *ag = cur_row++; + uint8_t *ab = cur_row++; + uint8_t *cr = next_row++; + uint8_t *cg = next_row++; + uint8_t *cb = next_row++; for(int x=0; x < width; x++) { - u8 *br = cur_row++; - u8 *bg = cur_row++; - u8 *bb = cur_row++; - u8 *dr = next_row++; - u8 *dg = next_row++; - u8 *db = next_row++; + uint8_t *br = cur_row++; + uint8_t *bg = cur_row++; + uint8_t *bb = cur_row++; + uint8_t *dr = next_row++; + uint8_t *dg = next_row++; + uint8_t *db = next_row++; // upper left pixel in quad: just copy it in *to++ = RGB(*ar, *ag, *ab); @@ -305,37 +305,37 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // the "next" rgb row becomes the current; the old current rgb row is // recycled and serves as the new "next" row - u8 *temp; + uint8_t *temp; temp = rgb_row_cur; rgb_row_cur = rgb_row_next; rgb_row_next = temp; // update the pointers for start of next pair of lines - from = (u32 *)((u8 *)from_orig + srcPitch); - to = (u32 *)((u8 *)to_orig + (dstPitch << 1)); - to_odd = (u32 *)((u8 *)to + dstPitch); + from = (uint32_t *)((uint8_t *)from_orig + srcPitch); + to = (uint32_t *)((uint8_t *)to_orig + (dstPitch << 1)); + to_odd = (uint32_t *)((uint8_t *)to + dstPitch); } } -void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void BilinearPlus32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 row_cur[3*322]; - u8 row_next[3*322]; - u8 *rgb_row_cur = row_cur; - u8 *rgb_row_next = row_next; + uint8_t row_cur[3*322]; + uint8_t row_next[3*322]; + uint8_t *rgb_row_cur = row_cur; + uint8_t *rgb_row_next = row_next; - u32 *to = (u32 *)dstPtr; - u32 *to_odd = (u32 *)(dstPtr + dstPitch); + uint32_t *to = (uint32_t *)dstPtr; + uint32_t *to_odd = (uint32_t *)(dstPtr + dstPitch); int from_width = width; - u32 *from = (u32 *)srcPtr; + uint32_t *from = (uint32_t *)srcPtr; fill_rgb_row_32(from, from_width, rgb_row_cur, width+1); for(int y = 0; y < height; y++) { - u32 *from_orig = from; - u32 *to_orig = to; + uint32_t *from_orig = from; + uint32_t *to_orig = to; if (y+1 < height) fill_rgb_row_32(from+width+1, from_width, rgb_row_next, @@ -348,21 +348,21 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // pixel is 'a', then in what follows 'b' is the src pixel to the // right, 'c' is the src pixel below, and 'd' is the src pixel to // the right and down - u8 *cur_row = rgb_row_cur; - u8 *next_row = rgb_row_next; - u8 *ar = cur_row++; - u8 *ag = cur_row++; - u8 *ab = cur_row++; - u8 *cr = next_row++; - u8 *cg = next_row++; - u8 *cb = next_row++; + uint8_t *cur_row = rgb_row_cur; + uint8_t *next_row = rgb_row_next; + uint8_t *ar = cur_row++; + uint8_t *ag = cur_row++; + uint8_t *ab = cur_row++; + uint8_t *cr = next_row++; + uint8_t *cg = next_row++; + uint8_t *cb = next_row++; for(int x=0; x < width; x++) { - u8 *br = cur_row++; - u8 *bg = cur_row++; - u8 *bb = cur_row++; - u8 *dr = next_row++; - u8 *dg = next_row++; - u8 *db = next_row++; + uint8_t *br = cur_row++; + uint8_t *bg = cur_row++; + uint8_t *bb = cur_row++; + uint8_t *dr = next_row++; + uint8_t *dg = next_row++; + uint8_t *db = next_row++; // upper left pixel in quad: just copy it in //*to++ = manip.rgb(*ar, *ag, *ab); @@ -400,15 +400,15 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // the "next" rgb row becomes the current; the old current rgb row is // recycled and serves as the new "next" row - u8 *temp; + uint8_t *temp; temp = rgb_row_cur; rgb_row_cur = rgb_row_next; rgb_row_next = temp; // update the pointers for start of next pair of lines - from = (u32 *)((u8 *)from_orig + srcPitch); - to = (u32 *)((u8 *)to_orig + (dstPitch << 1)); - to_odd = (u32 *)((u8 *)to + dstPitch); + from = (uint32_t *)((uint8_t *)from_orig + srcPitch); + to = (uint32_t *)((uint8_t *)to_orig + (dstPitch << 1)); + to_odd = (uint32_t *)((uint8_t *)to + dstPitch); } } diff --git a/src/filters/hq/asm/hq3x_16.asm b/src/filters/hq/asm/hq3x_16.asm index 85f0160b..41cff33f 100644 --- a/src/filters/hq/asm/hq3x_16.asm +++ b/src/filters/hq/asm/hq3x_16.asm @@ -2362,7 +2362,7 @@ NEWSYM hq3x_16 mov [edi+ebx*2],eax mov [edi+ebx*2+4],dx jmp .loopx_end -..@cross8 +..@crosint8_t mov edx,eax shl eax,16 or eax,edx @@ -2526,6 +2526,6 @@ FuncTable FuncTable2 dd ..@cross0, ..@cross1, ..@cross2, ..@flag0, dd ..@cross4, ..@flag0, ..@flag0, ..@flag0, - dd ..@cross8, ..@flag0, ..@flag0, ..@flag0, + dd ..@crosint8_t, ..@flag0, ..@flag0, ..@flag0, dd ..@flag0, ..@flag0, ..@flag0, ..@flag0 diff --git a/src/filters/hq/asm/hq3x_32.asm b/src/filters/hq/asm/hq3x_32.asm index ff52eb20..3bd2f1f3 100644 --- a/src/filters/hq/asm/hq3x_32.asm +++ b/src/filters/hq/asm/hq3x_32.asm @@ -2393,7 +2393,7 @@ NEWSYM hq3x_32 mov [edi+ebx*2+4],eax mov [edi+ebx*2+8],edx jmp .loopx_end -..@cross8 +..@crosint8_t mov ecx,[ebp-w8] mov edx,eax shl edx,2 @@ -2570,6 +2570,6 @@ FuncTable FuncTable2 dd ..@cross0, ..@cross1, ..@cross2, ..@crossN, dd ..@cross4, ..@crossN, ..@crossN, ..@crossN, - dd ..@cross8, ..@crossN, ..@crossN, ..@crossN, + dd ..@crosint8_t, ..@crossN, ..@crossN, ..@crossN, dd ..@crossN, ..@crossN, ..@crossN, ..@crossN diff --git a/src/filters/hq2x.cpp b/src/filters/hq2x.cpp index 33dd3bc1..67a5cb5e 100644 --- a/src/filters/hq2x.cpp +++ b/src/filters/hq2x.cpp @@ -37,14 +37,14 @@ * This effect is a rewritten implementation of the hq2x effect made by Maxim Stepin */ -static void hq2x_16_def(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count) +static void hq2x_16_def(uint16_t* dst0, uint16_t* dst1, const uint16_t* src0, const uint16_t* src1, const uint16_t* src2, unsigned count) { unsigned i; for(i=0;i> 1); + uint16_t *dst0 = (uint16_t *)dstPtr; + uint16_t *dst1 = dst0 + (dstPitch >> 1); - u16 *src0 = (u16 *)srcPtr; - u16 *src1 = src0 + (srcPitch >> 1); - u16 *src2 = src1 + (srcPitch >> 1); + uint16_t *src0 = (uint16_t *)srcPtr; + uint16_t *src1 = src0 + (srcPitch >> 1); + uint16_t *src2 = src1 + (srcPitch >> 1); hq2x_16_def(dst0, dst1, src0, src0, src1, width); @@ -513,15 +513,15 @@ void hq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, hq2x_16_def(dst0, dst1, src0, src1, src1, width); } -void hq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void hq2x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u32 *dst0 = (u32 *)dstPtr; - u32 *dst1 = dst0 + (dstPitch >> 2); + uint32_t *dst0 = (uint32_t *)dstPtr; + uint32_t *dst1 = dst0 + (dstPitch >> 2); - u32 *src0 = (u32 *)srcPtr; - u32 *src1 = src0 + (srcPitch >> 2); - u32 *src2 = src1 + (srcPitch >> 2); + uint32_t *src0 = (uint32_t *)srcPtr; + uint32_t *src1 = src0 + (srcPitch >> 2); + uint32_t *src2 = src1 + (srcPitch >> 2); hq2x_32_def(dst0, dst1, src0, src0, src1, width); int count = height; @@ -541,15 +541,15 @@ void hq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, hq2x_32_def(dst0, dst1, src0, src1, src1, width); } -void lq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void lq2x(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u16 *dst0 = (u16 *)dstPtr; - u16 *dst1 = dst0 + (dstPitch >> 1); + uint16_t *dst0 = (uint16_t *)dstPtr; + uint16_t *dst1 = dst0 + (dstPitch >> 1); - u16 *src0 = (u16 *)srcPtr; - u16 *src1 = src0 + (srcPitch >> 1); - u16 *src2 = src1 + (srcPitch >> 1); + uint16_t *src0 = (uint16_t *)srcPtr; + uint16_t *src1 = src0 + (srcPitch >> 1); + uint16_t *src2 = src1 + (srcPitch >> 1); lq2x_16_def(dst0, dst1, src0, src0, src1, width); @@ -570,15 +570,15 @@ void lq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, lq2x_16_def(dst0, dst1, src0, src1, src1, width); } -void lq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void lq2x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u32 *dst0 = (u32 *)dstPtr; - u32 *dst1 = dst0 + (dstPitch >> 2); + uint32_t *dst0 = (uint32_t *)dstPtr; + uint32_t *dst1 = dst0 + (dstPitch >> 2); - u32 *src0 = (u32 *)srcPtr; - u32 *src1 = src0 + (srcPitch >> 2); - u32 *src2 = src1 + (srcPitch >> 2); + uint32_t *src0 = (uint32_t *)srcPtr; + uint32_t *src1 = src0 + (srcPitch >> 2); + uint32_t *src2 = src1 + (srcPitch >> 2); lq2x_32_def(dst0, dst1, src0, src0, src1, width); int count = height; diff --git a/src/filters/interframe.cpp b/src/filters/interframe.cpp index b72b78df..407be592 100644 --- a/src/filters/interframe.cpp +++ b/src/filters/interframe.cpp @@ -12,20 +12,20 @@ extern "C" bool cpu_mmx; Incorporated into vba by Anthony Di Franco */ -static u8 *frm1 = NULL; -static u8 *frm2 = NULL; -static u8 *frm3 = NULL; +static uint8_t *frm1 = NULL; +static uint8_t *frm2 = NULL; +static uint8_t *frm3 = NULL; extern int RGB_LOW_BITS_MASK; -extern u32 qRGB_COLOR_MASK[2]; +extern uint32_t qRGB_COLOR_MASK[2]; static void Init() { - frm1 = (u8 *)calloc(322*242,4); + frm1 = (uint8_t *)calloc(322*242,4); // 1 frame ago - frm2 = (u8 *)calloc(322*242,4); + frm2 = (uint8_t *)calloc(322*242,4); // 2 frames ago - frm3 = (u8 *)calloc(322*242,4); + frm3 = (uint8_t *)calloc(322*242,4); // 3 frames ago } @@ -41,12 +41,12 @@ void InterframeCleanup() } #ifdef MMX -static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +static void SmartIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { - u16 *src0 = (u16 *)srcPtr + starty * srcPitch / 2; - u16 *src1 = (u16 *)frm1 + srcPitch * starty / 2; - u16 *src2 = (u16 *)frm2 + srcPitch * starty / 2; - u16 *src3 = (u16 *)frm3 + srcPitch * starty / 2; + uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2; + uint16_t *src1 = (uint16_t *)frm1 + srcPitch * starty / 2; + uint16_t *src2 = (uint16_t *)frm2 + srcPitch * starty / 2; + uint16_t *src3 = (uint16_t *)frm3 + srcPitch * starty / 2; int count = width >> 2; @@ -152,14 +152,14 @@ static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, int hei } /* Swap buffers around */ - u8 *temp = frm1; + uint8_t *temp = frm1; frm1 = frm3; frm3 = frm2; frm2 = temp; } #endif -void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { if(frm1 == NULL) { Init(); @@ -171,19 +171,19 @@ void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } #endif - u16 colorMask = ~RGB_LOW_BITS_MASK; + uint16_t colorMask = ~RGB_LOW_BITS_MASK; - u16 *src0 = (u16 *)srcPtr + starty * srcPitch / 2; - u16 *src1 = (u16 *)frm1 + srcPitch * starty / 2; - u16 *src2 = (u16 *)frm2 + srcPitch * starty / 2; - u16 *src3 = (u16 *)frm3 + srcPitch * starty / 2; + uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2; + uint16_t *src1 = (uint16_t *)frm1 + srcPitch * starty / 2; + uint16_t *src2 = (uint16_t *)frm2 + srcPitch * starty / 2; + uint16_t *src3 = (uint16_t *)frm3 + srcPitch * starty / 2; int sPitch = srcPitch >> 1; int pos = 0; for (int j = 0; j < height; j++) for (int i = 0; i < sPitch; i++) { - u16 color = src0[pos]; + uint16_t color = src0[pos]; src0[pos] = (src1[pos] != src2[pos]) && (src3[pos] != color) && @@ -195,24 +195,24 @@ void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } /* Swap buffers around */ - u8 *temp = frm1; + uint8_t *temp = frm1; frm1 = frm3; frm3 = frm2; frm2 = temp; } -void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int height) +void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height) { SmartIB(srcPtr, srcPitch, width, 0, height); } #ifdef MMX -static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +static void SmartIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { - u32 *src0 = (u32 *)srcPtr + starty * srcPitch / 4; - u32 *src1 = (u32 *)frm1 + starty * srcPitch / 4; - u32 *src2 = (u32 *)frm2 + starty * srcPitch / 4; - u32 *src3 = (u32 *)frm3 + starty * srcPitch / 4; + uint32_t *src0 = (uint32_t *)srcPtr + starty * srcPitch / 4; + uint32_t *src1 = (uint32_t *)frm1 + starty * srcPitch / 4; + uint32_t *src2 = (uint32_t *)frm2 + starty * srcPitch / 4; + uint32_t *src3 = (uint32_t *)frm3 + starty * srcPitch / 4; int count = width >> 1; @@ -318,14 +318,14 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, int h src3++; } /* Swap buffers around */ - u8 *temp = frm1; + uint8_t *temp = frm1; frm1 = frm3; frm3 = frm2; frm2 = temp; } #endif -void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { if(frm1 == NULL) { Init(); @@ -337,19 +337,19 @@ void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } #endif - u32 *src0 = (u32 *)srcPtr + starty * srcPitch / 4; - u32 *src1 = (u32 *)frm1 + starty * srcPitch / 4; - u32 *src2 = (u32 *)frm2 + starty * srcPitch / 4; - u32 *src3 = (u32 *)frm3 + starty * srcPitch / 4; + uint32_t *src0 = (uint32_t *)srcPtr + starty * srcPitch / 4; + uint32_t *src1 = (uint32_t *)frm1 + starty * srcPitch / 4; + uint32_t *src2 = (uint32_t *)frm2 + starty * srcPitch / 4; + uint32_t *src3 = (uint32_t *)frm3 + starty * srcPitch / 4; - u32 colorMask = 0xfefefe; + uint32_t colorMask = 0xfefefe; int sPitch = srcPitch >> 2; int pos = 0; for (int j = 0; j < height; j++) for (int i = 0; i < sPitch; i++) { - u32 color = src0[pos]; + uint32_t color = src0[pos]; src0[pos] = (src1[pos] != src2[pos]) && (src3[pos] != color) && @@ -361,22 +361,22 @@ void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } /* Swap buffers around */ - u8 *temp = frm1; + uint8_t *temp = frm1; frm1 = frm3; frm3 = frm2; frm2 = temp; } -void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int height) +void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height) { SmartIB32(srcPtr, srcPitch, width, 0, height); } #ifdef MMX -static void MotionBlurIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +static void MotionBlurIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { - u16 *src0 = (u16 *)srcPtr + starty * srcPitch / 2; - u16 *src1 = (u16 *)frm1 + starty * srcPitch / 2; + uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2; + uint16_t *src1 = (uint16_t *)frm1 + starty * srcPitch / 2; int count = width >> 2; @@ -441,7 +441,7 @@ static void MotionBlurIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, in } #endif -void MotionBlurIB(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { if(frm1 == NULL) { Init(); @@ -454,17 +454,17 @@ void MotionBlurIB(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } #endif - u16 colorMask = ~RGB_LOW_BITS_MASK; + uint16_t colorMask = ~RGB_LOW_BITS_MASK; - u16 *src0 = (u16 *)srcPtr + starty * srcPitch / 2; - u16 *src1 = (u16 *)frm1 + starty * srcPitch / 2; + uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2; + uint16_t *src1 = (uint16_t *)frm1 + starty * srcPitch / 2; int sPitch = srcPitch >> 1; int pos = 0; for (int j = 0; j < height; j++) for (int i = 0; i < sPitch; i++) { - u16 color = src0[pos]; + uint16_t color = src0[pos]; src0[pos] = (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)); src1[pos] = color; @@ -472,16 +472,16 @@ void MotionBlurIB(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } } -void MotionBlurIB(u8 *srcPtr, u32 srcPitch, int width, int height) +void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height) { MotionBlurIB(srcPtr, srcPitch, width, 0, height); } #ifdef MMX -static void MotionBlurIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +static void MotionBlurIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { - u32 *src0 = (u32 *)srcPtr + starty * srcPitch / 4; - u32 *src1 = (u32 *)frm1 + starty * srcPitch / 4; + uint32_t *src0 = (uint32_t *)srcPtr + starty * srcPitch / 4; + uint32_t *src1 = (uint32_t *)frm1 + starty * srcPitch / 4; int count = width >> 1; @@ -546,7 +546,7 @@ static void MotionBlurIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int starty, } #endif -void MotionBlurIB32(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) +void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) { if(frm1 == NULL) { Init(); @@ -559,17 +559,17 @@ void MotionBlurIB32(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } #endif - u32 *src0 = (u32 *)srcPtr + starty * srcPitch / 4; - u32 *src1 = (u32 *)frm1 + starty * srcPitch / 4; + uint32_t *src0 = (uint32_t *)srcPtr + starty * srcPitch / 4; + uint32_t *src1 = (uint32_t *)frm1 + starty * srcPitch / 4; - u32 colorMask = 0xfefefe; + uint32_t colorMask = 0xfefefe; int sPitch = srcPitch >> 2; int pos = 0; for (int j = 0; j < height; j++) for (int i = 0; i < sPitch; i++) { - u32 color = src0[pos]; + uint32_t color = src0[pos]; src0[pos] = (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)); src1[pos] = color; @@ -577,7 +577,7 @@ void MotionBlurIB32(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) } } -void MotionBlurIB32(u8 *srcPtr, u32 srcPitch, int width, int height) +void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height) { MotionBlurIB32(srcPtr, srcPitch, width, 0, height); } diff --git a/src/filters/interp.h b/src/filters/interp.h index 0a269847..0b2b7bba 100644 --- a/src/filters/interp.h +++ b/src/filters/interp.h @@ -50,7 +50,7 @@ static unsigned interp_bits_per_pixel; #define INTERP_16_MASK_1(v) (v & interp_mask[0]) #define INTERP_16_MASK_2(v) (v & interp_mask[1]) -static inline u16 interp_16_521(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_521(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 5 + INTERP_16_MASK_1(p2) * 2 + INTERP_16_MASK_1(p3) * 1) / @@ -60,7 +60,7 @@ static inline u16 interp_16_521(u16 p1, u16 p2, u16 p3) 8); } -static inline u16 interp_16_332(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_332(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 3 + INTERP_16_MASK_1(p2) * 3 + INTERP_16_MASK_1(p3) * 2) / @@ -70,7 +70,7 @@ static inline u16 interp_16_332(u16 p1, u16 p2, u16 p3) 8); } -static inline u16 interp_16_611(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_611(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1( (INTERP_16_MASK_1(p1) * 6 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 8) | @@ -78,13 +78,13 @@ static inline u16 interp_16_611(u16 p1, u16 p2, u16 p3) (INTERP_16_MASK_2(p1) * 6 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 8); } -static inline u16 interp_16_71(u16 p1, u16 p2) +static inline uint16_t interp_16_71(uint16_t p1, uint16_t p2) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 7 + INTERP_16_MASK_1(p2)) / 8) | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) * 7 + INTERP_16_MASK_2(p2)) / 8); } -static inline u16 interp_16_211(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_211(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1( (INTERP_16_MASK_1(p1) * 2 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 4) | @@ -92,7 +92,7 @@ static inline u16 interp_16_211(u16 p1, u16 p2, u16 p3) (INTERP_16_MASK_2(p1) * 2 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 4); } -static inline u16 interp_16_772(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_772(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1( ((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2)) * 7 + INTERP_16_MASK_1(p3) * 2) / @@ -102,19 +102,19 @@ static inline u16 interp_16_772(u16 p1, u16 p2, u16 p3) 16); } -static inline u16 interp_16_11(u16 p1, u16 p2) +static inline uint16_t interp_16_11(uint16_t p1, uint16_t p2) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2)) / 2) | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2)) / 2); } -static inline u16 interp_16_31(u16 p1, u16 p2) +static inline uint16_t interp_16_31(uint16_t p1, uint16_t p2) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 3 + INTERP_16_MASK_1(p2)) / 4) | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) * 3 + INTERP_16_MASK_2(p2)) / 4); } -static inline u16 interp_16_1411(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_1411(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1( (INTERP_16_MASK_1(p1) * 14 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 16) | @@ -122,7 +122,7 @@ static inline u16 interp_16_1411(u16 p1, u16 p2, u16 p3) (INTERP_16_MASK_2(p1) * 14 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 16); } -static inline u16 interp_16_431(u16 p1, u16 p2, u16 p3) +static inline uint16_t interp_16_431(uint16_t p1, uint16_t p2, uint16_t p3) { return INTERP_16_MASK_1( (INTERP_16_MASK_1(p1) * 4 + INTERP_16_MASK_1(p2) * 3 + INTERP_16_MASK_1(p3)) / @@ -132,19 +132,19 @@ static inline u16 interp_16_431(u16 p1, u16 p2, u16 p3) 8); } -static inline u16 interp_16_53(u16 p1, u16 p2) +static inline uint16_t interp_16_53(uint16_t p1, uint16_t p2) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 5 + INTERP_16_MASK_1(p2) * 3) / 8) | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) * 5 + INTERP_16_MASK_2(p2) * 3) / 8); } -static inline u16 interp_16_151(u16 p1, u16 p2) +static inline uint16_t interp_16_151(uint16_t p1, uint16_t p2) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 15 + INTERP_16_MASK_1(p2)) / 16) | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) * 15 + INTERP_16_MASK_2(p2)) / 16); } -static inline u16 interp_16_97(u16 p1, u16 p2) +static inline uint16_t interp_16_97(uint16_t p1, uint16_t p2) { return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) * 9 + INTERP_16_MASK_1(p2) * 7) / 16) | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) * 9 + INTERP_16_MASK_2(p2) * 7) / 16); @@ -153,7 +153,7 @@ static inline u16 interp_16_97(u16 p1, u16 p2) #define INTERP_32_MASK_1(v) (v & 0xFF00FF) #define INTERP_32_MASK_2(v) (v & 0x00FF00) -static inline u32 interp_32_521(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_521(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 5 + INTERP_32_MASK_1(p2) * 2 + INTERP_32_MASK_1(p3) * 1) / @@ -163,7 +163,7 @@ static inline u32 interp_32_521(u32 p1, u32 p2, u32 p3) 8); } -static inline u32 interp_32_332(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_332(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 3 + INTERP_32_MASK_1(p2) * 3 + INTERP_32_MASK_1(p3) * 2) / @@ -173,7 +173,7 @@ static inline u32 interp_32_332(u32 p1, u32 p2, u32 p3) 8); } -static inline u32 interp_32_211(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_211(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1( (INTERP_32_MASK_1(p1) * 2 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 4) | @@ -181,7 +181,7 @@ static inline u32 interp_32_211(u32 p1, u32 p2, u32 p3) (INTERP_32_MASK_2(p1) * 2 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 4); } -static inline u32 interp_32_611(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_611(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1( (INTERP_32_MASK_1(p1) * 6 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 8) | @@ -189,13 +189,13 @@ static inline u32 interp_32_611(u32 p1, u32 p2, u32 p3) (INTERP_32_MASK_2(p1) * 6 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 8); } -static inline u32 interp_32_71(u32 p1, u32 p2) +static inline uint32_t interp_32_71(uint32_t p1, uint32_t p2) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 7 + INTERP_32_MASK_1(p2)) / 8) | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) * 7 + INTERP_32_MASK_2(p2)) / 8); } -static inline u32 interp_32_772(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_772(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1( ((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2)) * 7 + INTERP_32_MASK_1(p3) * 2) / @@ -205,19 +205,19 @@ static inline u32 interp_32_772(u32 p1, u32 p2, u32 p3) 16); } -static inline u32 interp_32_11(u32 p1, u32 p2) +static inline uint32_t interp_32_11(uint32_t p1, uint32_t p2) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2)) / 2) | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2)) / 2); } -static inline u32 interp_32_31(u32 p1, u32 p2) +static inline uint32_t interp_32_31(uint32_t p1, uint32_t p2) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 3 + INTERP_32_MASK_1(p2)) / 4) | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) * 3 + INTERP_32_MASK_2(p2)) / 4); } -static inline u32 interp_32_1411(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_1411(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1( (INTERP_32_MASK_1(p1) * 14 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 16) | @@ -225,7 +225,7 @@ static inline u32 interp_32_1411(u32 p1, u32 p2, u32 p3) (INTERP_32_MASK_2(p1) * 14 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 16); } -static inline u32 interp_32_431(u32 p1, u32 p2, u32 p3) +static inline uint32_t interp_32_431(uint32_t p1, uint32_t p2, uint32_t p3) { return INTERP_32_MASK_1( (INTERP_32_MASK_1(p1) * 4 + INTERP_32_MASK_1(p2) * 3 + INTERP_32_MASK_1(p3)) / @@ -235,19 +235,19 @@ static inline u32 interp_32_431(u32 p1, u32 p2, u32 p3) 8); } -static inline u32 interp_32_53(u32 p1, u32 p2) +static inline uint32_t interp_32_53(uint32_t p1, uint32_t p2) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 5 + INTERP_32_MASK_1(p2) * 3) / 8) | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) * 5 + INTERP_32_MASK_2(p2) * 3) / 8); } -static inline u32 interp_32_151(u32 p1, u32 p2) +static inline uint32_t interp_32_151(uint32_t p1, uint32_t p2) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 15 + INTERP_32_MASK_1(p2)) / 16) | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) * 15 + INTERP_32_MASK_2(p2)) / 16); } -static inline u32 interp_32_97(u32 p1, u32 p2) +static inline uint32_t interp_32_97(uint32_t p1, uint32_t p2) { return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) * 9 + INTERP_32_MASK_1(p2) * 7) / 16) | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) * 9 + INTERP_32_MASK_2(p2) * 7) / 16); @@ -260,7 +260,7 @@ static inline u32 interp_32_97(u32 p1, u32 p2) #define INTERP_U_LIMIT (0x07 * 4) #define INTERP_V_LIMIT (0x06 * 8) -static int interp_16_diff(u16 p1, u16 p2) +static int interp_16_diff(uint16_t p1, uint16_t p2) { int r, g, b; int y, u, v; @@ -294,7 +294,7 @@ static int interp_16_diff(u16 p1, u16 p2) return 0; } -static int interp_32_diff(u32 p1, u32 p2) +static int interp_32_diff(uint32_t p1, uint32_t p2) { int r, g, b; int y, u, v; diff --git a/src/filters/pixel.cpp b/src/filters/pixel.cpp index 079d66c5..8aff7181 100644 --- a/src/filters/pixel.cpp +++ b/src/filters/pixel.cpp @@ -2,25 +2,25 @@ extern int RGB_LOW_BITS_MASK; -void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Pixelate(uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; - u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); + uint8_t *nextLine, *finish; + uint32_t colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *xP = (u32 *) deltaPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; - u32 currentDelta; - u32 nextDelta; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *xP = (uint32_t *) deltaPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; + uint32_t nextPixel; + uint32_t currentDelta; + uint32_t nextDelta; - finish = (u8 *) bP + ((width+2) << 1); + finish = (uint8_t *) bP + ((width+2) << 1); nextPixel = *bP++; nextDelta = *xP++; @@ -31,7 +31,7 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, nextDelta = *xP++; if ((nextPixel != nextDelta) || (currentPixel != currentDelta)) { - u32 colorA, colorB, product; + uint32_t colorA, colorB, product; *(xP - 2) = currentPixel; #ifdef WORDS_BIGENDIAN @@ -68,7 +68,7 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, dP += 2; nL += 2; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); deltaPtr += srcPitch; srcPtr += srcPitch; @@ -78,30 +78,30 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, while (--height); } -void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Pixelate32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; - u32 colorMask = ~RGB_LOW_BITS_MASK; + uint8_t *nextLine, *finish; + uint32_t colorMask = ~RGB_LOW_BITS_MASK; nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - // u32 *xP = (u32 *) deltaPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; + uint32_t *bP = (uint32_t *) srcPtr; + // uint32_t *xP = (uint32_t *) deltaPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; + uint32_t nextPixel; - finish = (u8 *) bP + ((width+1) << 2); + finish = (uint8_t *) bP + ((width+1) << 2); nextPixel = *bP++; do { currentPixel = nextPixel; nextPixel = *bP++; - u32 colorA, colorB, product; + uint32_t colorA, colorB, product; colorA = currentPixel; colorB = nextPixel; @@ -122,7 +122,7 @@ void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 4; nL += 4; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; diff --git a/src/filters/scanline.cpp b/src/filters/scanline.cpp index 83411577..c74ff4c1 100644 --- a/src/filters/scanline.cpp +++ b/src/filters/scanline.cpp @@ -2,27 +2,27 @@ extern int RGB_LOW_BITS_MASK; -void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Scanlines (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; + uint8_t *nextLine, *finish; nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; + uint32_t nextPixel; - finish = (u8 *) bP + ((width+2) << 1); + finish = (uint8_t *) bP + ((width+2) << 1); nextPixel = *bP++; do { currentPixel = nextPixel; nextPixel = *bP++; - u32 colorA, colorB; + uint32_t colorA, colorB; #ifdef WORDS_BIGENDIAN colorA = currentPixel >> 16; @@ -46,7 +46,7 @@ void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *, dP += 2; nL += 2; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -55,28 +55,28 @@ void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *, while (--height); } -void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Scanlines32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; + uint8_t *nextLine, *finish; nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; + uint32_t nextPixel; - finish = (u8 *) bP + ((width+1) << 2); + finish = (uint8_t *) bP + ((width+1) << 2); nextPixel = *bP++; do { currentPixel = nextPixel; nextPixel = *bP++; - u32 colorA, colorB; + uint32_t colorA, colorB; colorA = currentPixel; colorB = nextPixel; @@ -95,7 +95,7 @@ void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 4; nL += 4; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -104,29 +104,29 @@ void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, while (--height); } -void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void ScanlinesTV(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; - u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); + uint8_t *nextLine, *finish; + uint32_t colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; + uint32_t nextPixel; - finish = (u8 *) bP + ((width+2) << 1); + finish = (uint8_t *) bP + ((width+2) << 1); nextPixel = *bP++; do { currentPixel = nextPixel; nextPixel = *bP++; - u32 colorA, colorB; + uint32_t colorA, colorB; #ifdef WORDS_BIGENDIAN colorA = currentPixel >> 16; @@ -153,7 +153,7 @@ void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 2; nL += 2; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -162,29 +162,29 @@ void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, while (--height); } -void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void ScanlinesTV32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; - u32 colorMask = ~RGB_LOW_BITS_MASK; + uint8_t *nextLine, *finish; + uint32_t colorMask = ~RGB_LOW_BITS_MASK; nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; + uint32_t nextPixel; - finish = (u8 *) bP + ((width+1) << 2); + finish = (uint8_t *) bP + ((width+1) << 2); nextPixel = *bP++; do { currentPixel = nextPixel; nextPixel = *bP++; - u32 colorA, colorB, temp; + uint32_t colorA, colorB, temp; colorA = currentPixel; colorB = nextPixel; @@ -202,7 +202,7 @@ void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 2; nL += 2; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; diff --git a/src/filters/simpleFilter.cpp b/src/filters/simpleFilter.cpp index 05260a02..7d86159e 100644 --- a/src/filters/simpleFilter.cpp +++ b/src/filters/simpleFilter.cpp @@ -1,26 +1,26 @@ #include "../System.h" -void Simple2x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Simple2x16(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; + uint8_t *nextLine, *finish; nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; - finish = (u8 *) bP + ((width+2) << 1); + finish = (uint8_t *) bP + ((width+2) << 1); currentPixel = *bP++; do { #ifdef WORDS_BIGENDIAN - u32 color = currentPixel >> 16; + uint32_t color = currentPixel >> 16; #else - u32 color = currentPixel & 0xffff; + uint32_t color = currentPixel & 0xffff; #endif color = color | (color << 16); @@ -41,7 +41,7 @@ void Simple2x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 2; nL += 2; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -50,24 +50,24 @@ void Simple2x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, while (--height); } -void Simple2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Simple2x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { - u8 *nextLine, *finish; + uint8_t *nextLine, *finish; nextLine = dstPtr + dstPitch; do { - u32 *bP = (u32 *) srcPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; + uint32_t *bP = (uint32_t *) srcPtr; + uint32_t *dP = (uint32_t *) dstPtr; + uint32_t *nL = (uint32_t *) nextLine; + uint32_t currentPixel; - finish = (u8 *) bP + ((width+1) << 2); + finish = (uint8_t *) bP + ((width+1) << 2); currentPixel = *bP++; do { - u32 color = currentPixel; + uint32_t color = currentPixel; *(dP) = color; *(dP+1) = color; @@ -78,7 +78,7 @@ void Simple2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 2; nL += 2; - } while ((u8 *) bP < finish); + } while ((uint8_t *) bP < finish); srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -88,8 +88,8 @@ void Simple2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } -void Simple3x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Simple3x16(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { #define magnification 3 #define colorBytes 2 // 16 bit colors = 2 byte colors @@ -138,8 +138,8 @@ void Simple3x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, -void Simple3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Simple3x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { #define magnification 3 #define colorBytes 4 // 32 bit colors = 4 byte colors @@ -186,8 +186,8 @@ void Simple3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, #undef colorBytes } -void Simple4x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Simple4x16(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { #define magnification 4 #define colorBytes 2 // 16 bit colors = 2 byte colors @@ -236,8 +236,8 @@ void Simple4x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, -void Simple4x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) +void Simple4x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, + uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { #define magnification 4 #define colorBytes 4 // 32 bit colors = 4 byte colors diff --git a/src/filters/xbrzfilter.cpp b/src/filters/xbrzfilter.cpp index fe97feea..ab30398e 100644 --- a/src/filters/xbrzfilter.cpp +++ b/src/filters/xbrzfilter.cpp @@ -2,27 +2,27 @@ #include "xBRZ/xbrz.h" -void xbrz2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) +void xbrz2x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { xbrz::scale(2, (const uint32_t *)srcPtr, width, height, srcPitch, (uint32_t *)dstPtr, dstPitch, xbrz::RGB); } -void xbrz3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) +void xbrz3x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { xbrz::scale(3, (const uint32_t *)srcPtr, width, height, srcPitch, (uint32_t *)dstPtr, dstPitch, xbrz::RGB); } -void xbrz4x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) +void xbrz4x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { xbrz::scale(4, (const uint32_t *)srcPtr, width, height, srcPitch, (uint32_t *)dstPtr, dstPitch, xbrz::RGB); } -void xbrz5x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) +void xbrz5x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { xbrz::scale(5, (const uint32_t *)srcPtr, width, height, srcPitch, (uint32_t *)dstPtr, dstPitch, xbrz::RGB); } -void xbrz6x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) +void xbrz6x32(uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */, uint8_t *dstPtr, uint32_t dstPitch, int width, int height) { xbrz::scale(6, (const uint32_t *)srcPtr, width, height, srcPitch, (uint32_t *)dstPtr, dstPitch, xbrz::RGB); } diff --git a/src/gb/gb.h b/src/gb/gb.h index 0244589d..c1371486 100644 --- a/src/gb/gb.h +++ b/src/gb/gb.h @@ -19,7 +19,7 @@ typedef union { extern gbRegister AF, BC, DE, HL, SP, PC; extern uint16_t IFF; -int gbDis(char*, u16); +int gbDis(char*, uint16_t); bool gbLoadRom(const char*); bool gbUpdateSizes(); diff --git a/src/gb/gbCheats.cpp b/src/gb/gbCheats.cpp index 1d5b3c18..15c79d7c 100644 --- a/src/gb/gbCheats.cpp +++ b/src/gb/gbCheats.cpp @@ -451,7 +451,7 @@ uint8_t gbCheatRead(uint16_t address) void gbCheatWrite(bool reboot) { if (cheatsEnabled) { - u16 address = 0; + uint16_t address = 0; if (gbNextCheat >= gbCheatNumber) gbNextCheat = 0; diff --git a/src/gb/gbCheats.h b/src/gb/gbCheats.h index 5edea88e..2b982187 100644 --- a/src/gb/gbCheats.h +++ b/src/gb/gbCheats.h @@ -32,7 +32,7 @@ void gbCheatRemove(int); void gbCheatRemoveAll(); void gbCheatEnable(int); void gbCheatDisable(int); -uint8_t gbCheatRead(u16); +uint8_t gbCheatRead(uint16_t); void gbCheatWrite(bool); bool gbVerifyGsCode(const char* code); bool gbVerifyGgCode(const char* code); diff --git a/src/gb/gbCodes.h b/src/gb/gbCodes.h index 523079a9..26adde06 100644 --- a/src/gb/gbCodes.h +++ b/src/gb/gbCodes.h @@ -125,7 +125,7 @@ AF.B.B0 = tempValue; break; case 0x18: // JR NN -PC.W += (s8)gbReadOpcode(PC.W) + 1; +PC.W += (int8_t)gbReadOpcode(PC.W) + 1; break; case 0x19: // ADD HL,DE @@ -166,7 +166,7 @@ case 0x20: if (AF.B.B0 & GB_Z_FLAG) PC.W++; else { - PC.W += (s8)gbReadOpcode(PC.W) + 1; + PC.W += (int8_t)gbReadOpcode(PC.W) + 1; clockTicks++; } break; @@ -206,7 +206,7 @@ break; case 0x28: // JR Z,NN if (AF.B.B0 & GB_Z_FLAG) { - PC.W += (s8)gbReadOpcode(PC.W) + 1; + PC.W += (int8_t)gbReadOpcode(PC.W) + 1; clockTicks++; } else PC.W++; @@ -249,7 +249,7 @@ case 0x30: if (AF.B.B0 & GB_C_FLAG) PC.W++; else { - PC.W += (s8)gbReadOpcode(PC.W) + 1; + PC.W += (int8_t)gbReadOpcode(PC.W) + 1; clockTicks++; } break; @@ -289,7 +289,7 @@ break; case 0x38: // JR C,NN if (AF.B.B0 & GB_C_FLAG) { - PC.W += (s8)gbReadOpcode(PC.W) + 1; + PC.W += (int8_t)gbReadOpcode(PC.W) + 1; clockTicks++; } else PC.W++; @@ -1230,7 +1230,7 @@ PC.W = 0x0020; break; case 0xe8: // ADD SP,NN -offset = (s8)gbReadOpcode(PC.W++); +offset = (int8_t)gbReadOpcode(PC.W++); tempRegister.W = SP.W + offset; AF.B.B0 = ((SP.W ^ offset ^ tempRegister.W) & 0x100 ? GB_C_FLAG : 0) | ((SP.W ^ offset ^ tempRegister.W) & 0x10 ? GB_H_FLAG : 0); SP.W = tempRegister.W; @@ -1308,7 +1308,7 @@ PC.W = 0x0030; break; case 0xf8: // LD HL,SP+NN -offset = (s8)gbReadOpcode(PC.W++); +offset = (int8_t)gbReadOpcode(PC.W++); tempRegister.W = SP.W + offset; AF.B.B0 = ((SP.W ^ offset ^ tempRegister.W) & 0x100 ? GB_C_FLAG : 0) | ((SP.W ^ offset ^ tempRegister.W) & 0x10 ? GB_H_FLAG : 0); HL.W = tempRegister.W; diff --git a/src/gb/gbGlobals.cpp b/src/gb/gbGlobals.cpp index cbb8f496..9949b37d 100644 --- a/src/gb/gbGlobals.cpp +++ b/src/gb/gbGlobals.cpp @@ -1,5 +1,5 @@ -#include "../common/Types.h" -#include +#include +#include uint8_t* gbMemoryMap[16]; diff --git a/src/gb/gbGlobals.h b/src/gb/gbGlobals.h index 8c741b47..24396a0f 100644 --- a/src/gb/gbGlobals.h +++ b/src/gb/gbGlobals.h @@ -1,6 +1,8 @@ #ifndef GBGLOBALS_H #define GBGLOBALS_H +#include + extern int gbRomSizeMask; extern int gbRomSize; extern int gbRamSize; diff --git a/src/gba/CheatSearch.cpp b/src/gba/CheatSearch.cpp index a4086cd1..e3219682 100644 --- a/src/gba/CheatSearch.cpp +++ b/src/gba/CheatSearch.cpp @@ -40,32 +40,32 @@ static bool cheatSearchGE(uint32_t a, uint32_t b) return a >= b; } -static bool cheatSearchSignedEQ(s32 a, s32 b) +static bool cheatSearchSignedEQ(int32_t a, int32_t b) { return a == b; } -static bool cheatSearchSignedNE(s32 a, s32 b) +static bool cheatSearchSignedNE(int32_t a, int32_t b) { return a != b; } -static bool cheatSearchSignedLT(s32 a, s32 b) +static bool cheatSearchSignedLT(int32_t a, int32_t b) { return a < b; } -static bool cheatSearchSignedLE(s32 a, s32 b) +static bool cheatSearchSignedLE(int32_t a, int32_t b) { return a <= b; } -static bool cheatSearchSignedGT(s32 a, s32 b) +static bool cheatSearchSignedGT(int32_t a, int32_t b) { return a > b; } -static bool cheatSearchSignedGE(s32 a, s32 b) +static bool cheatSearchSignedGE(int32_t a, int32_t b) { return a >= b; } @@ -79,7 +79,7 @@ static bool (*cheatSearchFunc[])(uint32_t, uint32_t) = { cheatSearchGE }; -static bool (*cheatSearchSignedFunc[])(s32, s32) = { +static bool (*cheatSearchSignedFunc[])(int32_t, int32_t) = { cheatSearchSignedEQ, cheatSearchSignedNE, cheatSearchSignedLT, @@ -111,25 +111,25 @@ void cheatSearchStart(const CheatSearchData* cs) } } -s32 cheatSearchSignedRead(uint8_t* data, int off, int size) +int32_t cheatSearchSignedRead(uint8_t* data, int off, int size) { uint32_t res = data[off++]; switch (size) { case BITS_8: res <<= 24; - return ((s32)res) >> 24; + return ((int32_t)res) >> 24; case BITS_16: res |= ((uint32_t)data[off++]) << 8; res <<= 16; - return ((s32)res) >> 16; + return ((int32_t)res) >> 16; case BITS_32: res |= ((uint32_t)data[off++]) << 8; res |= ((uint32_t)data[off++]) << 16; res |= ((uint32_t)data[off++]) << 24; - return (s32)res; + return (int32_t)res; } - return (s32)res; + return (int32_t)res; } uint32_t cheatSearchRead(uint8_t* data, int off, int size) @@ -157,7 +157,7 @@ void cheatSearch(const CheatSearchData* cs, int compare, int size, inc = 4; if (isSigned) { - bool (*func)(s32, s32) = cheatSearchSignedFunc[compare]; + bool (*func)(int32_t, int32_t) = cheatSearchSignedFunc[compare]; for (int i = 0; i < cs->count; i++) { CheatSearchBlock* block = &cs->blocks[i]; @@ -168,8 +168,8 @@ void cheatSearch(const CheatSearchData* cs, int compare, int size, for (int j = 0; j < size2; j += inc) { if (IS_BIT_SET(bits, j)) { - s32 a = cheatSearchSignedRead(data, j, size); - s32 b = cheatSearchSignedRead(saved, j, size); + int32_t a = cheatSearchSignedRead(data, j, size); + int32_t b = cheatSearchSignedRead(saved, j, size); if (!func(a, b)) { CLEAR_BIT(bits, j); @@ -225,7 +225,7 @@ void cheatSearchValue(const CheatSearchData* cs, int compare, int size, inc = 4; if (isSigned) { - bool (*func)(s32, s32) = cheatSearchSignedFunc[compare]; + bool (*func)(int32_t, int32_t) = cheatSearchSignedFunc[compare]; for (int i = 0; i < cs->count; i++) { CheatSearchBlock* block = &cs->blocks[i]; @@ -235,8 +235,8 @@ void cheatSearchValue(const CheatSearchData* cs, int compare, int size, for (int j = 0; j < size2; j += inc) { if (IS_BIT_SET(bits, j)) { - s32 a = cheatSearchSignedRead(data, j, size); - s32 b = (s32)value; + int32_t a = cheatSearchSignedRead(data, j, size); + int32_t b = (int32_t)value; if (!func(a, b)) { CLEAR_BIT(bits, j); diff --git a/src/gba/Cheats.cpp b/src/gba/Cheats.cpp index 3f5cfdc4..d04b7225 100644 --- a/src/gba/Cheats.cpp +++ b/src/gba/Cheats.cpp @@ -1021,62 +1021,62 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended) i += 2; break; case GSA_8_BIT_IF_LOWER_S: - if (!((s8)CPUReadByte(cheatsList[i].address) < ((s8)cheatsList[i].value & 0xFF))) { + if (!((int8_t)CPUReadByte(cheatsList[i].address) < ((int8_t)cheatsList[i].value & 0xFF))) { i++; } break; case GSA_16_BIT_IF_LOWER_S: - if (!((s16)CPUReadHalfWord(cheatsList[i].address) < ((s16)cheatsList[i].value & 0xFFFF))) { + if (!((int16_t)CPUReadHalfWord(cheatsList[i].address) < ((int16_t)cheatsList[i].value & 0xFFFF))) { i++; } break; case GSA_32_BIT_IF_LOWER_S: - if (!((s32)CPUReadMemory(cheatsList[i].address) < (s32)cheatsList[i].value)) { + if (!((int32_t)CPUReadMemory(cheatsList[i].address) < (int32_t)cheatsList[i].value)) { i++; } break; case GSA_8_BIT_IF_HIGHER_S: - if (!((s8)CPUReadByte(cheatsList[i].address) > ((s8)cheatsList[i].value & 0xFF))) { + if (!((int8_t)CPUReadByte(cheatsList[i].address) > ((int8_t)cheatsList[i].value & 0xFF))) { i++; } break; case GSA_16_BIT_IF_HIGHER_S: - if (!((s16)CPUReadHalfWord(cheatsList[i].address) > ((s16)cheatsList[i].value & 0xFFFF))) { + if (!((int16_t)CPUReadHalfWord(cheatsList[i].address) > ((int16_t)cheatsList[i].value & 0xFFFF))) { i++; } break; case GSA_32_BIT_IF_HIGHER_S: - if (!((s32)CPUReadMemory(cheatsList[i].address) > (s32)cheatsList[i].value)) { + if (!((int32_t)CPUReadMemory(cheatsList[i].address) > (int32_t)cheatsList[i].value)) { i++; } break; case GSA_8_BIT_IF_LOWER_S2: - if (!((s8)CPUReadByte(cheatsList[i].address) < ((s8)cheatsList[i].value & 0xFF))) { + if (!((int8_t)CPUReadByte(cheatsList[i].address) < ((int8_t)cheatsList[i].value & 0xFF))) { i += 2; } break; case GSA_16_BIT_IF_LOWER_S2: - if (!((s16)CPUReadHalfWord(cheatsList[i].address) < ((s16)cheatsList[i].value & 0xFFFF))) { + if (!((int16_t)CPUReadHalfWord(cheatsList[i].address) < ((int16_t)cheatsList[i].value & 0xFFFF))) { i += 2; } break; case GSA_32_BIT_IF_LOWER_S2: - if (!((s32)CPUReadMemory(cheatsList[i].address) < (s32)cheatsList[i].value)) { + if (!((int32_t)CPUReadMemory(cheatsList[i].address) < (int32_t)cheatsList[i].value)) { i += 2; } break; case GSA_8_BIT_IF_HIGHER_S2: - if (!((s8)CPUReadByte(cheatsList[i].address) > ((s8)cheatsList[i].value & 0xFF))) { + if (!((int8_t)CPUReadByte(cheatsList[i].address) > ((int8_t)cheatsList[i].value & 0xFF))) { i += 2; } break; case GSA_16_BIT_IF_HIGHER_S2: - if (!((s16)CPUReadHalfWord(cheatsList[i].address) > ((s16)cheatsList[i].value & 0xFFFF))) { + if (!((int16_t)CPUReadHalfWord(cheatsList[i].address) > ((int16_t)cheatsList[i].value & 0xFFFF))) { i += 2; } break; case GSA_32_BIT_IF_HIGHER_S2: - if (!((s32)CPUReadMemory(cheatsList[i].address) > (s32)cheatsList[i].value)) { + if (!((int32_t)CPUReadMemory(cheatsList[i].address) > (int32_t)cheatsList[i].value)) { i += 2; } break; @@ -1123,32 +1123,32 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended) } break; case GSA_8_BIT_IF_LOWER_S3: - if (!((s8)CPUReadByte(cheatsList[i].address) < ((s8)cheatsList[i].value & 0xFF))) { + if (!((int8_t)CPUReadByte(cheatsList[i].address) < ((int8_t)cheatsList[i].value & 0xFF))) { onoff = false; } break; case GSA_16_BIT_IF_LOWER_S3: - if (!((s16)CPUReadHalfWord(cheatsList[i].address) < ((s16)cheatsList[i].value & 0xFFFF))) { + if (!((int16_t)CPUReadHalfWord(cheatsList[i].address) < ((int16_t)cheatsList[i].value & 0xFFFF))) { onoff = false; } break; case GSA_32_BIT_IF_LOWER_S3: - if (!((s32)CPUReadMemory(cheatsList[i].address) < (s32)cheatsList[i].value)) { + if (!((int32_t)CPUReadMemory(cheatsList[i].address) < (int32_t)cheatsList[i].value)) { onoff = false; } break; case GSA_8_BIT_IF_HIGHER_S3: - if (!((s8)CPUReadByte(cheatsList[i].address) > ((s8)cheatsList[i].value & 0xFF))) { + if (!((int8_t)CPUReadByte(cheatsList[i].address) > ((int8_t)cheatsList[i].value & 0xFF))) { onoff = false; } break; case GSA_16_BIT_IF_HIGHER_S3: - if (!((s16)CPUReadHalfWord(cheatsList[i].address) > ((s16)cheatsList[i].value & 0xFFFF))) { + if (!((int16_t)CPUReadHalfWord(cheatsList[i].address) > ((int16_t)cheatsList[i].value & 0xFFFF))) { onoff = false; } break; case GSA_32_BIT_IF_HIGHER_S3: - if (!((s32)CPUReadMemory(cheatsList[i].address) > (s32)cheatsList[i].value)) { + if (!((int32_t)CPUReadMemory(cheatsList[i].address) > (int32_t)cheatsList[i].value)) { onoff = false; } break; diff --git a/src/gba/GBA-arm.cpp b/src/gba/GBA-arm.cpp index e00837b1..de6674f0 100644 --- a/src/gba/GBA-arm.cpp +++ b/src/gba/GBA-arm.cpp @@ -725,11 +725,13 @@ static void count(uint32_t opcode, int cond_res) V_FLAG = ((NEG(lhs) & POS(rhs) & POS(res)) | (POS(lhs) & NEG(rhs) & NEG(res))) ? true : false; \ C_FLAG = ((NEG(lhs) & POS(rhs)) | (NEG(lhs) & POS(res)) | (POS(rhs) & POS(res))) ? true : false; +#define maybe_unused(var) (void) var + #ifndef ALU_INIT_C -#define ALU_INIT_C \ - int dest = (opcode >> 12) & 15; \ - bool C_OUT = C_FLAG; \ - uint32_t value; +#define ALU_INIT_C \ + int dest = (opcode >> 12) & 15; maybe_unused(dest); \ + bool C_OUT = C_FLAG; maybe_unused(C_OUT); \ + uint32_t value; maybe_unused(value); #endif // OP Rd,Rb,Rm LSL # #ifndef VALUE_LSL_IMM_C @@ -1250,6 +1252,11 @@ DEFINE_ALU_INSN_C(1F, 3F, MVNS, YES) busPrefetchCount = ((busPrefetchCount + 1) << clockTicks) - 1; \ clockTicks += 1 + codeTicksAccess32(armNextPC); +typedef uint64_t u64; +typedef int64_t s64; +typedef uint64_t u32; +typedef int64_t s32; + #define OP_MUL \ reg[dest].I = reg[mult].I * rs; #define OP_MLA \ @@ -2974,4 +2981,4 @@ int armExecute() } while (cpuTotalTicks < cpuNextEvent && armState && !holdState && !SWITicks && !debugger); return 1; -} \ No newline at end of file +} diff --git a/src/gba/GBA-thumb.cpp b/src/gba/GBA-thumb.cpp index 8ef9c62f..c37d7bbc 100644 --- a/src/gba/GBA-thumb.cpp +++ b/src/gba/GBA-thumb.cpp @@ -37,7 +37,7 @@ static int clockTicks; -static INSN_REGPARM void thumbUnknownInsn(u32 opcode) +static INSN_REGPARM void thumbUnknownInsn(uint32_t opcode) { #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_UNDEFINED) @@ -47,7 +47,7 @@ static INSN_REGPARM void thumbUnknownInsn(u32 opcode) } #ifdef BKPT_SUPPORT -static INSN_REGPARM void thumbBreakpoint(u32 opcode) +static INSN_REGPARM void thumbBreakpoint(uint32_t opcode) { reg[15].I -= 2; armNextPC -= 2; @@ -568,9 +568,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef ADD_RD_RS_RN #define ADD_RD_RS_RN(N) \ { \ - u32 lhs = reg[source].I; \ - u32 rhs = reg[N].I; \ - u32 res = lhs + rhs; \ + uint32_t lhs = reg[source].I; \ + uint32_t rhs = reg[N].I; \ + uint32_t res = lhs + rhs; \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -581,9 +581,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef ADD_RD_RS_O3 #define ADD_RD_RS_O3(N) \ { \ - u32 lhs = reg[source].I; \ - u32 rhs = N; \ - u32 res = lhs + rhs; \ + uint32_t lhs = reg[source].I; \ + uint32_t rhs = N; \ + uint32_t res = lhs + rhs; \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -597,9 +597,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef ADD_RN_O8 #define ADD_RN_O8(d) \ { \ - u32 lhs = reg[(d)].I; \ - u32 rhs = (opcode & 255); \ - u32 res = lhs + rhs; \ + uint32_t lhs = reg[(d)].I; \ + uint32_t rhs = (opcode & 255); \ + uint32_t res = lhs + rhs; \ reg[(d)].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -610,9 +610,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef CMN_RD_RS #define CMN_RD_RS \ { \ - u32 lhs = reg[dest].I; \ - u32 rhs = value; \ - u32 res = lhs + rhs; \ + uint32_t lhs = reg[dest].I; \ + uint32_t rhs = value; \ + uint32_t res = lhs + rhs; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ ADDCARRY(lhs, rhs, res); \ @@ -622,9 +622,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef ADC_RD_RS #define ADC_RD_RS \ { \ - u32 lhs = reg[dest].I; \ - u32 rhs = value; \ - u32 res = lhs + rhs + (u32)C_FLAG; \ + uint32_t lhs = reg[dest].I; \ + uint32_t rhs = value; \ + uint32_t res = lhs + rhs + (uint32_t)C_FLAG; \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -635,9 +635,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef SUB_RD_RS_RN #define SUB_RD_RS_RN(N) \ { \ - u32 lhs = reg[source].I; \ - u32 rhs = reg[N].I; \ - u32 res = lhs - rhs; \ + uint32_t lhs = reg[source].I; \ + uint32_t rhs = reg[N].I; \ + uint32_t res = lhs - rhs; \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -648,9 +648,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef SUB_RD_RS_O3 #define SUB_RD_RS_O3(N) \ { \ - u32 lhs = reg[source].I; \ - u32 rhs = N; \ - u32 res = lhs - rhs; \ + uint32_t lhs = reg[source].I; \ + uint32_t rhs = N; \ + uint32_t res = lhs - rhs; \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -664,9 +664,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef SUB_RN_O8 #define SUB_RN_O8(d) \ { \ - u32 lhs = reg[(d)].I; \ - u32 rhs = (opcode & 255); \ - u32 res = lhs - rhs; \ + uint32_t lhs = reg[(d)].I; \ + uint32_t rhs = (opcode & 255); \ + uint32_t res = lhs - rhs; \ reg[(d)].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -685,9 +685,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef CMP_RN_O8 #define CMP_RN_O8(d) \ { \ - u32 lhs = reg[(d)].I; \ - u32 rhs = (opcode & 255); \ - u32 res = lhs - rhs; \ + uint32_t lhs = reg[(d)].I; \ + uint32_t rhs = (opcode & 255); \ + uint32_t res = lhs - rhs; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ SUBCARRY(lhs, rhs, res); \ @@ -697,9 +697,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef SBC_RD_RS #define SBC_RD_RS \ { \ - u32 lhs = reg[dest].I; \ - u32 rhs = value; \ - u32 res = lhs - rhs - !((u32)C_FLAG); \ + uint32_t lhs = reg[dest].I; \ + uint32_t rhs = value; \ + uint32_t res = lhs - rhs - !((uint32_t)C_FLAG); \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -738,15 +738,15 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef ASR_RD_RM_I5 #define ASR_RD_RM_I5 \ { \ - C_FLAG = ((s32)reg[source].I >> (int)(shift - 1)) & 1 ? true : false; \ - value = (s32)reg[source].I >> (int)shift; \ + C_FLAG = ((int32_t)reg[source].I >> (int)(shift - 1)) & 1 ? true : false; \ + value = (int32_t)reg[source].I >> (int)shift; \ } #endif #ifndef ASR_RD_RS #define ASR_RD_RS \ { \ - C_FLAG = ((s32)reg[dest].I >> (int)(value - 1)) & 1 ? true : false; \ - value = (s32)reg[dest].I >> (int)value; \ + C_FLAG = ((int32_t)reg[dest].I >> (int)(value - 1)) & 1 ? true : false; \ + value = (int32_t)reg[dest].I >> (int)value; \ } #endif #ifndef ROR_RD_RS @@ -759,9 +759,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef NEG_RD_RS #define NEG_RD_RS \ { \ - u32 lhs = reg[source].I; \ - u32 rhs = 0; \ - u32 res = rhs - lhs; \ + uint32_t lhs = reg[source].I; \ + uint32_t rhs = 0; \ + uint32_t res = rhs - lhs; \ reg[dest].I = res; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ @@ -772,9 +772,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifndef CMP_RD_RS #define CMP_RD_RS \ { \ - u32 lhs = reg[dest].I; \ - u32 rhs = value; \ - u32 res = lhs - rhs; \ + uint32_t lhs = reg[dest].I; \ + uint32_t rhs = value; \ + uint32_t res = lhs - rhs; \ Z_FLAG = (res == 0) ? true : false; \ N_FLAG = NEG(res) ? true : false; \ SUBCARRY(lhs, rhs, res); \ @@ -785,7 +785,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #define IMM5_INSN(OP, N) \ int dest = opcode & 0x07; \ int source = (opcode >> 3) & 0x07; \ - u32 value; \ + uint32_t value; \ OP(N); \ reg[dest].I = value; \ N_FLAG = (value & 0x80000000 ? true : false); \ @@ -793,7 +793,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #define IMM5_INSN_0(OP) \ int dest = opcode & 0x07; \ int source = (opcode >> 3) & 0x07; \ - u32 value; \ + uint32_t value; \ OP; \ reg[dest].I = value; \ N_FLAG = (value & 0x80000000 ? true : false); \ @@ -831,38 +831,38 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // Shift instructions ///////////////////////////////////////////////////// #define DEFINE_IMM5_INSN(OP, BASE) \ - static INSN_REGPARM void thumb##BASE##_00(u32 opcode) { IMM5_INSN_0(OP##_0); } \ - static INSN_REGPARM void thumb##BASE##_01(u32 opcode) { IMM5_INSN(OP, 1); } \ - static INSN_REGPARM void thumb##BASE##_02(u32 opcode) { IMM5_INSN(OP, 2); } \ - static INSN_REGPARM void thumb##BASE##_03(u32 opcode) { IMM5_INSN(OP, 3); } \ - static INSN_REGPARM void thumb##BASE##_04(u32 opcode) { IMM5_INSN(OP, 4); } \ - static INSN_REGPARM void thumb##BASE##_05(u32 opcode) { IMM5_INSN(OP, 5); } \ - static INSN_REGPARM void thumb##BASE##_06(u32 opcode) { IMM5_INSN(OP, 6); } \ - static INSN_REGPARM void thumb##BASE##_07(u32 opcode) { IMM5_INSN(OP, 7); } \ - static INSN_REGPARM void thumb##BASE##_08(u32 opcode) { IMM5_INSN(OP, 8); } \ - static INSN_REGPARM void thumb##BASE##_09(u32 opcode) { IMM5_INSN(OP, 9); } \ - static INSN_REGPARM void thumb##BASE##_0A(u32 opcode) { IMM5_INSN(OP, 10); } \ - static INSN_REGPARM void thumb##BASE##_0B(u32 opcode) { IMM5_INSN(OP, 11); } \ - static INSN_REGPARM void thumb##BASE##_0C(u32 opcode) { IMM5_INSN(OP, 12); } \ - static INSN_REGPARM void thumb##BASE##_0D(u32 opcode) { IMM5_INSN(OP, 13); } \ - static INSN_REGPARM void thumb##BASE##_0E(u32 opcode) { IMM5_INSN(OP, 14); } \ - static INSN_REGPARM void thumb##BASE##_0F(u32 opcode) { IMM5_INSN(OP, 15); } \ - static INSN_REGPARM void thumb##BASE##_10(u32 opcode) { IMM5_INSN(OP, 16); } \ - static INSN_REGPARM void thumb##BASE##_11(u32 opcode) { IMM5_INSN(OP, 17); } \ - static INSN_REGPARM void thumb##BASE##_12(u32 opcode) { IMM5_INSN(OP, 18); } \ - static INSN_REGPARM void thumb##BASE##_13(u32 opcode) { IMM5_INSN(OP, 19); } \ - static INSN_REGPARM void thumb##BASE##_14(u32 opcode) { IMM5_INSN(OP, 20); } \ - static INSN_REGPARM void thumb##BASE##_15(u32 opcode) { IMM5_INSN(OP, 21); } \ - static INSN_REGPARM void thumb##BASE##_16(u32 opcode) { IMM5_INSN(OP, 22); } \ - static INSN_REGPARM void thumb##BASE##_17(u32 opcode) { IMM5_INSN(OP, 23); } \ - static INSN_REGPARM void thumb##BASE##_18(u32 opcode) { IMM5_INSN(OP, 24); } \ - static INSN_REGPARM void thumb##BASE##_19(u32 opcode) { IMM5_INSN(OP, 25); } \ - static INSN_REGPARM void thumb##BASE##_1A(u32 opcode) { IMM5_INSN(OP, 26); } \ - static INSN_REGPARM void thumb##BASE##_1B(u32 opcode) { IMM5_INSN(OP, 27); } \ - static INSN_REGPARM void thumb##BASE##_1C(u32 opcode) { IMM5_INSN(OP, 28); } \ - static INSN_REGPARM void thumb##BASE##_1D(u32 opcode) { IMM5_INSN(OP, 29); } \ - static INSN_REGPARM void thumb##BASE##_1E(u32 opcode) { IMM5_INSN(OP, 30); } \ - static INSN_REGPARM void thumb##BASE##_1F(u32 opcode) { IMM5_INSN(OP, 31); } + static INSN_REGPARM void thumb##BASE##_00(uint32_t opcode) { IMM5_INSN_0(OP##_0); } \ + static INSN_REGPARM void thumb##BASE##_01(uint32_t opcode) { IMM5_INSN(OP, 1); } \ + static INSN_REGPARM void thumb##BASE##_02(uint32_t opcode) { IMM5_INSN(OP, 2); } \ + static INSN_REGPARM void thumb##BASE##_03(uint32_t opcode) { IMM5_INSN(OP, 3); } \ + static INSN_REGPARM void thumb##BASE##_04(uint32_t opcode) { IMM5_INSN(OP, 4); } \ + static INSN_REGPARM void thumb##BASE##_05(uint32_t opcode) { IMM5_INSN(OP, 5); } \ + static INSN_REGPARM void thumb##BASE##_06(uint32_t opcode) { IMM5_INSN(OP, 6); } \ + static INSN_REGPARM void thumb##BASE##_07(uint32_t opcode) { IMM5_INSN(OP, 7); } \ + static INSN_REGPARM void thumb##BASE##_08(uint32_t opcode) { IMM5_INSN(OP, 8); } \ + static INSN_REGPARM void thumb##BASE##_09(uint32_t opcode) { IMM5_INSN(OP, 9); } \ + static INSN_REGPARM void thumb##BASE##_0A(uint32_t opcode) { IMM5_INSN(OP, 10); } \ + static INSN_REGPARM void thumb##BASE##_0B(uint32_t opcode) { IMM5_INSN(OP, 11); } \ + static INSN_REGPARM void thumb##BASE##_0C(uint32_t opcode) { IMM5_INSN(OP, 12); } \ + static INSN_REGPARM void thumb##BASE##_0D(uint32_t opcode) { IMM5_INSN(OP, 13); } \ + static INSN_REGPARM void thumb##BASE##_0E(uint32_t opcode) { IMM5_INSN(OP, 14); } \ + static INSN_REGPARM void thumb##BASE##_0F(uint32_t opcode) { IMM5_INSN(OP, 15); } \ + static INSN_REGPARM void thumb##BASE##_10(uint32_t opcode) { IMM5_INSN(OP, 16); } \ + static INSN_REGPARM void thumb##BASE##_11(uint32_t opcode) { IMM5_INSN(OP, 17); } \ + static INSN_REGPARM void thumb##BASE##_12(uint32_t opcode) { IMM5_INSN(OP, 18); } \ + static INSN_REGPARM void thumb##BASE##_13(uint32_t opcode) { IMM5_INSN(OP, 19); } \ + static INSN_REGPARM void thumb##BASE##_14(uint32_t opcode) { IMM5_INSN(OP, 20); } \ + static INSN_REGPARM void thumb##BASE##_15(uint32_t opcode) { IMM5_INSN(OP, 21); } \ + static INSN_REGPARM void thumb##BASE##_16(uint32_t opcode) { IMM5_INSN(OP, 22); } \ + static INSN_REGPARM void thumb##BASE##_17(uint32_t opcode) { IMM5_INSN(OP, 23); } \ + static INSN_REGPARM void thumb##BASE##_18(uint32_t opcode) { IMM5_INSN(OP, 24); } \ + static INSN_REGPARM void thumb##BASE##_19(uint32_t opcode) { IMM5_INSN(OP, 25); } \ + static INSN_REGPARM void thumb##BASE##_1A(uint32_t opcode) { IMM5_INSN(OP, 26); } \ + static INSN_REGPARM void thumb##BASE##_1B(uint32_t opcode) { IMM5_INSN(OP, 27); } \ + static INSN_REGPARM void thumb##BASE##_1C(uint32_t opcode) { IMM5_INSN(OP, 28); } \ + static INSN_REGPARM void thumb##BASE##_1D(uint32_t opcode) { IMM5_INSN(OP, 29); } \ + static INSN_REGPARM void thumb##BASE##_1E(uint32_t opcode) { IMM5_INSN(OP, 30); } \ + static INSN_REGPARM void thumb##BASE##_1F(uint32_t opcode) { IMM5_INSN(OP, 31); } // LSL Rd, Rm, #Imm 5 DEFINE_IMM5_INSN(IMM5_LSL, 00) @@ -874,24 +874,24 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // 3-argument ADD/SUB ///////////////////////////////////////////////////// #define DEFINE_REG3_INSN(OP, BASE) \ - static INSN_REGPARM void thumb##BASE##_0(u32 opcode) { THREEARG_INSN(OP, 0); } \ - static INSN_REGPARM void thumb##BASE##_1(u32 opcode) { THREEARG_INSN(OP, 1); } \ - static INSN_REGPARM void thumb##BASE##_2(u32 opcode) { THREEARG_INSN(OP, 2); } \ - static INSN_REGPARM void thumb##BASE##_3(u32 opcode) { THREEARG_INSN(OP, 3); } \ - static INSN_REGPARM void thumb##BASE##_4(u32 opcode) { THREEARG_INSN(OP, 4); } \ - static INSN_REGPARM void thumb##BASE##_5(u32 opcode) { THREEARG_INSN(OP, 5); } \ - static INSN_REGPARM void thumb##BASE##_6(u32 opcode) { THREEARG_INSN(OP, 6); } \ - static INSN_REGPARM void thumb##BASE##_7(u32 opcode) { THREEARG_INSN(OP, 7); } + static INSN_REGPARM void thumb##BASE##_0(uint32_t opcode) { THREEARG_INSN(OP, 0); } \ + static INSN_REGPARM void thumb##BASE##_1(uint32_t opcode) { THREEARG_INSN(OP, 1); } \ + static INSN_REGPARM void thumb##BASE##_2(uint32_t opcode) { THREEARG_INSN(OP, 2); } \ + static INSN_REGPARM void thumb##BASE##_3(uint32_t opcode) { THREEARG_INSN(OP, 3); } \ + static INSN_REGPARM void thumb##BASE##_4(uint32_t opcode) { THREEARG_INSN(OP, 4); } \ + static INSN_REGPARM void thumb##BASE##_5(uint32_t opcode) { THREEARG_INSN(OP, 5); } \ + static INSN_REGPARM void thumb##BASE##_6(uint32_t opcode) { THREEARG_INSN(OP, 6); } \ + static INSN_REGPARM void thumb##BASE##_7(uint32_t opcode) { THREEARG_INSN(OP, 7); } #define DEFINE_IMM3_INSN(OP, BASE) \ - static INSN_REGPARM void thumb##BASE##_0(u32 opcode) { THREEARG_INSN(OP##_0, 0); } \ - static INSN_REGPARM void thumb##BASE##_1(u32 opcode) { THREEARG_INSN(OP, 1); } \ - static INSN_REGPARM void thumb##BASE##_2(u32 opcode) { THREEARG_INSN(OP, 2); } \ - static INSN_REGPARM void thumb##BASE##_3(u32 opcode) { THREEARG_INSN(OP, 3); } \ - static INSN_REGPARM void thumb##BASE##_4(u32 opcode) { THREEARG_INSN(OP, 4); } \ - static INSN_REGPARM void thumb##BASE##_5(u32 opcode) { THREEARG_INSN(OP, 5); } \ - static INSN_REGPARM void thumb##BASE##_6(u32 opcode) { THREEARG_INSN(OP, 6); } \ - static INSN_REGPARM void thumb##BASE##_7(u32 opcode) { THREEARG_INSN(OP, 7); } + static INSN_REGPARM void thumb##BASE##_0(uint32_t opcode) { THREEARG_INSN(OP##_0, 0); } \ + static INSN_REGPARM void thumb##BASE##_1(uint32_t opcode) { THREEARG_INSN(OP, 1); } \ + static INSN_REGPARM void thumb##BASE##_2(uint32_t opcode) { THREEARG_INSN(OP, 2); } \ + static INSN_REGPARM void thumb##BASE##_3(uint32_t opcode) { THREEARG_INSN(OP, 3); } \ + static INSN_REGPARM void thumb##BASE##_4(uint32_t opcode) { THREEARG_INSN(OP, 4); } \ + static INSN_REGPARM void thumb##BASE##_5(uint32_t opcode) { THREEARG_INSN(OP, 5); } \ + static INSN_REGPARM void thumb##BASE##_6(uint32_t opcode) { THREEARG_INSN(OP, 6); } \ + static INSN_REGPARM void thumb##BASE##_7(uint32_t opcode) { THREEARG_INSN(OP, 7); } // ADD Rd, Rs, Rn DEFINE_REG3_INSN(ADD_RD_RS_RN, 18) @@ -905,77 +905,77 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // MOV/CMP/ADD/SUB immediate ////////////////////////////////////////////// // MOV R0, #Offset8 - static INSN_REGPARM void thumb20(u32 opcode) { MOV_RN_O8(0); } + static INSN_REGPARM void thumb20(uint32_t opcode) { MOV_RN_O8(0); } // MOV R1, #Offset8 - static INSN_REGPARM void thumb21(u32 opcode) { MOV_RN_O8(1); } + static INSN_REGPARM void thumb21(uint32_t opcode) { MOV_RN_O8(1); } // MOV R2, #Offset8 - static INSN_REGPARM void thumb22(u32 opcode) { MOV_RN_O8(2); } + static INSN_REGPARM void thumb22(uint32_t opcode) { MOV_RN_O8(2); } // MOV R3, #Offset8 - static INSN_REGPARM void thumb23(u32 opcode) { MOV_RN_O8(3); } + static INSN_REGPARM void thumb23(uint32_t opcode) { MOV_RN_O8(3); } // MOV R4, #Offset8 - static INSN_REGPARM void thumb24(u32 opcode) { MOV_RN_O8(4); } + static INSN_REGPARM void thumb24(uint32_t opcode) { MOV_RN_O8(4); } // MOV R5, #Offset8 - static INSN_REGPARM void thumb25(u32 opcode) { MOV_RN_O8(5); } + static INSN_REGPARM void thumb25(uint32_t opcode) { MOV_RN_O8(5); } // MOV R6, #Offset8 - static INSN_REGPARM void thumb26(u32 opcode) { MOV_RN_O8(6); } + static INSN_REGPARM void thumb26(uint32_t opcode) { MOV_RN_O8(6); } // MOV R7, #Offset8 - static INSN_REGPARM void thumb27(u32 opcode) { MOV_RN_O8(7); } + static INSN_REGPARM void thumb27(uint32_t opcode) { MOV_RN_O8(7); } // CMP R0, #Offset8 - static INSN_REGPARM void thumb28(u32 opcode) { CMP_RN_O8(0); } + static INSN_REGPARM void thumb28(uint32_t opcode) { CMP_RN_O8(0); } // CMP R1, #Offset8 - static INSN_REGPARM void thumb29(u32 opcode) { CMP_RN_O8(1); } + static INSN_REGPARM void thumb29(uint32_t opcode) { CMP_RN_O8(1); } // CMP R2, #Offset8 - static INSN_REGPARM void thumb2A(u32 opcode) { CMP_RN_O8(2); } + static INSN_REGPARM void thumb2A(uint32_t opcode) { CMP_RN_O8(2); } // CMP R3, #Offset8 - static INSN_REGPARM void thumb2B(u32 opcode) { CMP_RN_O8(3); } + static INSN_REGPARM void thumb2B(uint32_t opcode) { CMP_RN_O8(3); } // CMP R4, #Offset8 - static INSN_REGPARM void thumb2C(u32 opcode) { CMP_RN_O8(4); } + static INSN_REGPARM void thumb2C(uint32_t opcode) { CMP_RN_O8(4); } // CMP R5, #Offset8 - static INSN_REGPARM void thumb2D(u32 opcode) { CMP_RN_O8(5); } + static INSN_REGPARM void thumb2D(uint32_t opcode) { CMP_RN_O8(5); } // CMP R6, #Offset8 - static INSN_REGPARM void thumb2E(u32 opcode) { CMP_RN_O8(6); } + static INSN_REGPARM void thumb2E(uint32_t opcode) { CMP_RN_O8(6); } // CMP R7, #Offset8 - static INSN_REGPARM void thumb2F(u32 opcode) { CMP_RN_O8(7); } + static INSN_REGPARM void thumb2F(uint32_t opcode) { CMP_RN_O8(7); } // ADD R0,#Offset8 - static INSN_REGPARM void thumb30(u32 opcode) { ADD_RN_O8(0); } + static INSN_REGPARM void thumb30(uint32_t opcode) { ADD_RN_O8(0); } // ADD R1,#Offset8 - static INSN_REGPARM void thumb31(u32 opcode) { ADD_RN_O8(1); } + static INSN_REGPARM void thumb31(uint32_t opcode) { ADD_RN_O8(1); } // ADD R2,#Offset8 - static INSN_REGPARM void thumb32(u32 opcode) { ADD_RN_O8(2); } + static INSN_REGPARM void thumb32(uint32_t opcode) { ADD_RN_O8(2); } // ADD R3,#Offset8 - static INSN_REGPARM void thumb33(u32 opcode) { ADD_RN_O8(3); } + static INSN_REGPARM void thumb33(uint32_t opcode) { ADD_RN_O8(3); } // ADD R4,#Offset8 - static INSN_REGPARM void thumb34(u32 opcode) { ADD_RN_O8(4); } + static INSN_REGPARM void thumb34(uint32_t opcode) { ADD_RN_O8(4); } // ADD R5,#Offset8 - static INSN_REGPARM void thumb35(u32 opcode) { ADD_RN_O8(5); } + static INSN_REGPARM void thumb35(uint32_t opcode) { ADD_RN_O8(5); } // ADD R6,#Offset8 - static INSN_REGPARM void thumb36(u32 opcode) { ADD_RN_O8(6); } + static INSN_REGPARM void thumb36(uint32_t opcode) { ADD_RN_O8(6); } // ADD R7,#Offset8 - static INSN_REGPARM void thumb37(u32 opcode) { ADD_RN_O8(7); } + static INSN_REGPARM void thumb37(uint32_t opcode) { ADD_RN_O8(7); } // SUB R0,#Offset8 - static INSN_REGPARM void thumb38(u32 opcode) { SUB_RN_O8(0); } + static INSN_REGPARM void thumb38(uint32_t opcode) { SUB_RN_O8(0); } // SUB R1,#Offset8 - static INSN_REGPARM void thumb39(u32 opcode) { SUB_RN_O8(1); } + static INSN_REGPARM void thumb39(uint32_t opcode) { SUB_RN_O8(1); } // SUB R2,#Offset8 - static INSN_REGPARM void thumb3A(u32 opcode) { SUB_RN_O8(2); } + static INSN_REGPARM void thumb3A(uint32_t opcode) { SUB_RN_O8(2); } // SUB R3,#Offset8 - static INSN_REGPARM void thumb3B(u32 opcode) { SUB_RN_O8(3); } + static INSN_REGPARM void thumb3B(uint32_t opcode) { SUB_RN_O8(3); } // SUB R4,#Offset8 - static INSN_REGPARM void thumb3C(u32 opcode) { SUB_RN_O8(4); } + static INSN_REGPARM void thumb3C(uint32_t opcode) { SUB_RN_O8(4); } // SUB R5,#Offset8 - static INSN_REGPARM void thumb3D(u32 opcode) { SUB_RN_O8(5); } + static INSN_REGPARM void thumb3D(uint32_t opcode) { SUB_RN_O8(5); } // SUB R6,#Offset8 - static INSN_REGPARM void thumb3E(u32 opcode) { SUB_RN_O8(6); } + static INSN_REGPARM void thumb3E(uint32_t opcode) { SUB_RN_O8(6); } // SUB R7,#Offset8 - static INSN_REGPARM void thumb3F(u32 opcode) { SUB_RN_O8(7); } + static INSN_REGPARM void thumb3F(uint32_t opcode) { SUB_RN_O8(7); } // ALU operations ///////////////////////////////////////////////////////// // AND Rd, Rs - static INSN_REGPARM void thumb40_0(u32 opcode) + static INSN_REGPARM void thumb40_0(uint32_t opcode) { int dest = opcode & 7; reg[dest].I &= reg[(opcode >> 3) & 7].I; @@ -985,7 +985,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // EOR Rd, Rs - static INSN_REGPARM void thumb40_1(u32 opcode) + static INSN_REGPARM void thumb40_1(uint32_t opcode) { int dest = opcode & 7; reg[dest].I ^= reg[(opcode >> 3) & 7].I; @@ -994,10 +994,10 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // LSL Rd, Rs - static INSN_REGPARM void thumb40_2(u32 opcode) + static INSN_REGPARM void thumb40_2(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[(opcode >> 3) & 7].B.B0; + uint32_t value = reg[(opcode >> 3) & 7].B.B0; if (value) { if (value == 32) { value = 0; @@ -1016,10 +1016,10 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // LSR Rd, Rs - static INSN_REGPARM void thumb40_3(u32 opcode) + static INSN_REGPARM void thumb40_3(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[(opcode >> 3) & 7].B.B0; + uint32_t value = reg[(opcode >> 3) & 7].B.B0; if (value) { if (value == 32) { value = 0; @@ -1038,10 +1038,10 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // ASR Rd, Rs - static INSN_REGPARM void thumb41_0(u32 opcode) + static INSN_REGPARM void thumb41_0(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[(opcode >> 3) & 7].B.B0; + uint32_t value = reg[(opcode >> 3) & 7].B.B0; if (value) { if (value < 32) { ASR_RD_RS; @@ -1062,26 +1062,26 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // ADC Rd, Rs - static INSN_REGPARM void thumb41_1(u32 opcode) + static INSN_REGPARM void thumb41_1(uint32_t opcode) { int dest = opcode & 0x07; - u32 value = reg[(opcode >> 3) & 7].I; + uint32_t value = reg[(opcode >> 3) & 7].I; ADC_RD_RS; } // SBC Rd, Rs - static INSN_REGPARM void thumb41_2(u32 opcode) + static INSN_REGPARM void thumb41_2(uint32_t opcode) { int dest = opcode & 0x07; - u32 value = reg[(opcode >> 3) & 7].I; + uint32_t value = reg[(opcode >> 3) & 7].I; SBC_RD_RS; } // ROR Rd, Rs - static INSN_REGPARM void thumb41_3(u32 opcode) + static INSN_REGPARM void thumb41_3(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[(opcode >> 3) & 7].B.B0; + uint32_t value = reg[(opcode >> 3) & 7].B.B0; if (value) { value = value & 0x1f; @@ -1098,15 +1098,15 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // TST Rd, Rs - static INSN_REGPARM void thumb42_0(u32 opcode) + static INSN_REGPARM void thumb42_0(uint32_t opcode) { - u32 value = reg[opcode & 7].I & reg[(opcode >> 3) & 7].I; + uint32_t value = reg[opcode & 7].I & reg[(opcode >> 3) & 7].I; N_FLAG = value & 0x80000000 ? true : false; Z_FLAG = value ? false : true; } // NEG Rd, Rs - static INSN_REGPARM void thumb42_1(u32 opcode) + static INSN_REGPARM void thumb42_1(uint32_t opcode) { int dest = opcode & 7; int source = (opcode >> 3) & 7; @@ -1114,23 +1114,23 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // CMP Rd, Rs - static INSN_REGPARM void thumb42_2(u32 opcode) + static INSN_REGPARM void thumb42_2(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[(opcode >> 3) & 7].I; + uint32_t value = reg[(opcode >> 3) & 7].I; CMP_RD_RS; } // CMN Rd, Rs - static INSN_REGPARM void thumb42_3(u32 opcode) + static INSN_REGPARM void thumb42_3(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[(opcode >> 3) & 7].I; + uint32_t value = reg[(opcode >> 3) & 7].I; CMN_RD_RS; } // ORR Rd, Rs - static INSN_REGPARM void thumb43_0(u32 opcode) + static INSN_REGPARM void thumb43_0(uint32_t opcode) { int dest = opcode & 7; reg[dest].I |= reg[(opcode >> 3) & 7].I; @@ -1139,13 +1139,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // MUL Rd, Rs - static INSN_REGPARM void thumb43_1(u32 opcode) + static INSN_REGPARM void thumb43_1(uint32_t opcode) { clockTicks = 1; int dest = opcode & 7; - u32 rm = reg[dest].I; + uint32_t rm = reg[dest].I; reg[dest].I = reg[(opcode >> 3) & 7].I * rm; - if (((s32)rm) < 0) + if (((int32_t)rm) < 0) rm = ~rm; if ((rm & 0xFFFFFF00) == 0) clockTicks += 0; @@ -1162,7 +1162,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BIC Rd, Rs - static INSN_REGPARM void thumb43_2(u32 opcode) + static INSN_REGPARM void thumb43_2(uint32_t opcode) { int dest = opcode & 7; reg[dest].I &= (~reg[(opcode >> 3) & 7].I); @@ -1171,7 +1171,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // MVN Rd, Rs - static INSN_REGPARM void thumb43_3(u32 opcode) + static INSN_REGPARM void thumb43_3(uint32_t opcode) { int dest = opcode & 7; reg[dest].I = ~reg[(opcode >> 3) & 7].I; @@ -1182,13 +1182,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // High-register instructions and BX ////////////////////////////////////// // ADD Rd, Hs - static INSN_REGPARM void thumb44_1(u32 opcode) + static INSN_REGPARM void thumb44_1(uint32_t opcode) { reg[opcode & 7].I += reg[((opcode >> 3) & 7) + 8].I; } // ADD Hd, Rs - static INSN_REGPARM void thumb44_2(u32 opcode) + static INSN_REGPARM void thumb44_2(uint32_t opcode) { reg[(opcode & 7) + 8].I += reg[(opcode >> 3) & 7].I; if ((opcode & 7) == 7) { @@ -1202,7 +1202,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // ADD Hd, Hs - static INSN_REGPARM void thumb44_3(u32 opcode) + static INSN_REGPARM void thumb44_3(uint32_t opcode) { reg[(opcode & 7) + 8].I += reg[((opcode >> 3) & 7) + 8].I; if ((opcode & 7) == 7) { @@ -1216,45 +1216,45 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // CMP Rd, Hs - static INSN_REGPARM void thumb45_1(u32 opcode) + static INSN_REGPARM void thumb45_1(uint32_t opcode) { int dest = opcode & 7; - u32 value = reg[((opcode >> 3) & 7) + 8].I; + uint32_t value = reg[((opcode >> 3) & 7) + 8].I; CMP_RD_RS; } // CMP Hd, Rs - static INSN_REGPARM void thumb45_2(u32 opcode) + static INSN_REGPARM void thumb45_2(uint32_t opcode) { int dest = (opcode & 7) + 8; - u32 value = reg[(opcode >> 3) & 7].I; + uint32_t value = reg[(opcode >> 3) & 7].I; CMP_RD_RS; } // CMP Hd, Hs - static INSN_REGPARM void thumb45_3(u32 opcode) + static INSN_REGPARM void thumb45_3(uint32_t opcode) { int dest = (opcode & 7) + 8; - u32 value = reg[((opcode >> 3) & 7) + 8].I; + uint32_t value = reg[((opcode >> 3) & 7) + 8].I; CMP_RD_RS; } // MOV Rd, Rs - static INSN_REGPARM void thumb46_0(u32 opcode) + static INSN_REGPARM void thumb46_0(uint32_t opcode) { reg[opcode & 7].I = reg[((opcode >> 3) & 7)].I; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; } // MOV Rd, Hs - static INSN_REGPARM void thumb46_1(u32 opcode) + static INSN_REGPARM void thumb46_1(uint32_t opcode) { reg[opcode & 7].I = reg[((opcode >> 3) & 7) + 8].I; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; } // MOV Hd, Rs - static INSN_REGPARM void thumb46_2(u32 opcode) + static INSN_REGPARM void thumb46_2(uint32_t opcode) { reg[(opcode & 7) + 8].I = reg[(opcode >> 3) & 7].I; if ((opcode & 7) == 7) { @@ -1269,7 +1269,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // MOV Hd, Hs - static INSN_REGPARM void thumb46_3(u32 opcode) + static INSN_REGPARM void thumb46_3(uint32_t opcode) { reg[(opcode & 7) + 8].I = reg[((opcode >> 3) & 7) + 8].I; if ((opcode & 7) == 7) { @@ -1284,7 +1284,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BX Rs - static INSN_REGPARM void thumb47(u32 opcode) + static INSN_REGPARM void thumb47(uint32_t opcode) { int base = (opcode >> 3) & 15; busPrefetchCount = 0; @@ -1310,175 +1310,175 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // Load/store instructions //////////////////////////////////////////////// // LDR R0~R7,[PC, #Imm] - static INSN_REGPARM void thumb48(u32 opcode) + static INSN_REGPARM void thumb48(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + uint32_t address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); reg[regist].I = CPUReadMemoryQuick(address); busPrefetchCount = 0; clockTicks = 3 + dataTicksAccess32(address) + codeTicksAccess16(armNextPC); } // STR Rd, [Rs, Rn] - static INSN_REGPARM void thumb50(u32 opcode) + static INSN_REGPARM void thumb50(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; CPUWriteMemory(address, reg[opcode & 7].I); clockTicks = dataTicksAccess32(address) + codeTicksAccess16(armNextPC) + 2; } // STRH Rd, [Rs, Rn] - static INSN_REGPARM void thumb52(u32 opcode) + static INSN_REGPARM void thumb52(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; CPUWriteHalfWord(address, reg[opcode & 7].W.W0); clockTicks = dataTicksAccess16(address) + codeTicksAccess16(armNextPC) + 2; } // STRB Rd, [Rs, Rn] - static INSN_REGPARM void thumb54(u32 opcode) + static INSN_REGPARM void thumb54(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; CPUWriteByte(address, reg[opcode & 7].B.B0); clockTicks = dataTicksAccess16(address) + codeTicksAccess16(armNextPC) + 2; } // LDSB Rd, [Rs, Rn] - static INSN_REGPARM void thumb56(u32 opcode) + static INSN_REGPARM void thumb56(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; - reg[opcode & 7].I = (s8)CPUReadByte(address); + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + reg[opcode & 7].I = (int8_t)CPUReadByte(address); clockTicks = 3 + dataTicksAccess16(address) + codeTicksAccess16(armNextPC); } // LDR Rd, [Rs, Rn] - static INSN_REGPARM void thumb58(u32 opcode) + static INSN_REGPARM void thumb58(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; reg[opcode & 7].I = CPUReadMemory(address); clockTicks = 3 + dataTicksAccess32(address) + codeTicksAccess16(armNextPC); } // LDRH Rd, [Rs, Rn] - static INSN_REGPARM void thumb5A(u32 opcode) + static INSN_REGPARM void thumb5A(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; reg[opcode & 7].I = CPUReadHalfWord(address); clockTicks = 3 + dataTicksAccess32(address) + codeTicksAccess16(armNextPC); } // LDRB Rd, [Rs, Rn] - static INSN_REGPARM void thumb5C(u32 opcode) + static INSN_REGPARM void thumb5C(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; reg[opcode & 7].I = CPUReadByte(address); clockTicks = 3 + dataTicksAccess16(address) + codeTicksAccess16(armNextPC); } // LDSH Rd, [Rs, Rn] - static INSN_REGPARM void thumb5E(u32 opcode) + static INSN_REGPARM void thumb5E(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; - reg[opcode & 7].I = (u32)CPUReadHalfWordSigned(address); + uint32_t address = reg[(opcode >> 3) & 7].I + reg[(opcode >> 6) & 7].I; + reg[opcode & 7].I = (uint32_t)CPUReadHalfWordSigned(address); clockTicks = 3 + dataTicksAccess16(address) + codeTicksAccess16(armNextPC); } // STR Rd, [Rs, #Imm] - static INSN_REGPARM void thumb60(u32 opcode) + static INSN_REGPARM void thumb60(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 2); + uint32_t address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 2); CPUWriteMemory(address, reg[opcode & 7].I); clockTicks = dataTicksAccess32(address) + codeTicksAccess16(armNextPC) + 2; } // LDR Rd, [Rs, #Imm] - static INSN_REGPARM void thumb68(u32 opcode) + static INSN_REGPARM void thumb68(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 2); + uint32_t address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 2); reg[opcode & 7].I = CPUReadMemory(address); clockTicks = 3 + dataTicksAccess32(address) + codeTicksAccess16(armNextPC); } // STRB Rd, [Rs, #Imm] - static INSN_REGPARM void thumb70(u32 opcode) + static INSN_REGPARM void thumb70(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31)); + uint32_t address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31)); CPUWriteByte(address, reg[opcode & 7].B.B0); clockTicks = dataTicksAccess16(address) + codeTicksAccess16(armNextPC) + 2; } // LDRB Rd, [Rs, #Imm] - static INSN_REGPARM void thumb78(u32 opcode) + static INSN_REGPARM void thumb78(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31)); + uint32_t address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31)); reg[opcode & 7].I = CPUReadByte(address); clockTicks = 3 + dataTicksAccess16(address) + codeTicksAccess16(armNextPC); } // STRH Rd, [Rs, #Imm] - static INSN_REGPARM void thumb80(u32 opcode) + static INSN_REGPARM void thumb80(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 1); + uint32_t address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 1); CPUWriteHalfWord(address, reg[opcode & 7].W.W0); clockTicks = dataTicksAccess16(address) + codeTicksAccess16(armNextPC) + 2; } // LDRH Rd, [Rs, #Imm] - static INSN_REGPARM void thumb88(u32 opcode) + static INSN_REGPARM void thumb88(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 1); + uint32_t address = reg[(opcode >> 3) & 7].I + (((opcode >> 6) & 31) << 1); reg[opcode & 7].I = CPUReadHalfWord(address); clockTicks = 3 + dataTicksAccess16(address) + codeTicksAccess16(armNextPC); } // STR R0~R7, [SP, #Imm] - static INSN_REGPARM void thumb90(u32 opcode) + static INSN_REGPARM void thumb90(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[13].I + ((opcode & 255) << 2); + uint32_t address = reg[13].I + ((opcode & 255) << 2); CPUWriteMemory(address, reg[regist].I); clockTicks = dataTicksAccess32(address) + codeTicksAccess16(armNextPC) + 2; } // LDR R0~R7, [SP, #Imm] - static INSN_REGPARM void thumb98(u32 opcode) + static INSN_REGPARM void thumb98(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[13].I + ((opcode & 255) << 2); + uint32_t address = reg[13].I + ((opcode & 255) << 2); reg[regist].I = CPUReadMemoryQuick(address); clockTicks = 3 + dataTicksAccess32(address) + codeTicksAccess16(armNextPC); } @@ -1486,23 +1486,23 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // PC/stack-related /////////////////////////////////////////////////////// // ADD R0~R7, PC, Imm - static INSN_REGPARM void thumbA0(u32 opcode) + static INSN_REGPARM void thumbA0(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; reg[regist].I = (reg[15].I & 0xFFFFFFFC) + ((opcode & 255) << 2); clockTicks = 1 + codeTicksAccess16(armNextPC); } // ADD R0~R7, SP, Imm - static INSN_REGPARM void thumbA8(u32 opcode) + static INSN_REGPARM void thumbA8(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; reg[regist].I = reg[13].I + ((opcode & 255) << 2); clockTicks = 1 + codeTicksAccess16(armNextPC); } // ADD SP, Imm - static INSN_REGPARM void thumbB0(u32 opcode) + static INSN_REGPARM void thumbB0(uint32_t opcode) { int offset = (opcode & 127) << 2; if (opcode & 0x80) @@ -1538,13 +1538,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // PUSH {Rlist} - static INSN_REGPARM void thumbB4(u32 opcode) + static INSN_REGPARM void thumbB4(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; int count = 0; - u32 temp = reg[13].I - 4 * cpuBitsSet[opcode & 0xff]; - u32 address = temp & 0xFFFFFFFC; + uint32_t temp = reg[13].I - 4 * cpuBitsSet[opcode & 0xff]; + uint32_t address = temp & 0xFFFFFFFC; PUSH_REG(1, 0); PUSH_REG(2, 1); PUSH_REG(4, 2); @@ -1558,13 +1558,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // PUSH {Rlist, LR} - static INSN_REGPARM void thumbB5(u32 opcode) + static INSN_REGPARM void thumbB5(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; int count = 0; - u32 temp = reg[13].I - 4 - 4 * cpuBitsSet[opcode & 0xff]; - u32 address = temp & 0xFFFFFFFC; + uint32_t temp = reg[13].I - 4 - 4 * cpuBitsSet[opcode & 0xff]; + uint32_t address = temp & 0xFFFFFFFC; PUSH_REG(1, 0); PUSH_REG(2, 1); PUSH_REG(4, 2); @@ -1579,13 +1579,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // POP {Rlist} - static INSN_REGPARM void thumbBC(u32 opcode) + static INSN_REGPARM void thumbBC(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; int count = 0; - u32 address = reg[13].I & 0xFFFFFFFC; - u32 temp = reg[13].I + 4 * cpuBitsSet[opcode & 0xFF]; + uint32_t address = reg[13].I & 0xFFFFFFFC; + uint32_t temp = reg[13].I + 4 * cpuBitsSet[opcode & 0xFF]; POP_REG(1, 0); POP_REG(2, 1); POP_REG(4, 2); @@ -1599,13 +1599,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // POP {Rlist, PC} - static INSN_REGPARM void thumbBD(u32 opcode) + static INSN_REGPARM void thumbBD(uint32_t opcode) { if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; int count = 0; - u32 address = reg[13].I & 0xFFFFFFFC; - u32 temp = reg[13].I + 4 + 4 * cpuBitsSet[opcode & 0xFF]; + uint32_t address = reg[13].I & 0xFFFFFFFC; + uint32_t temp = reg[13].I + 4 + 4 * cpuBitsSet[opcode & 0xFF]; POP_REG(1, 0); POP_REG(2, 1); POP_REG(4, 2); @@ -1657,13 +1657,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // STM R0~7!, {Rlist} - static INSN_REGPARM void thumbC0(u32 opcode) + static INSN_REGPARM void thumbC0(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[regist].I & 0xFFFFFFFC; - u32 temp = reg[regist].I + 4 * cpuBitsSet[opcode & 0xff]; + uint32_t address = reg[regist].I & 0xFFFFFFFC; + uint32_t temp = reg[regist].I + 4 * cpuBitsSet[opcode & 0xff]; int count = 0; // store THUMB_STM_REG(1, 0, regist); @@ -1678,13 +1678,13 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // LDM R0~R7!, {Rlist} - static INSN_REGPARM void thumbC8(u32 opcode) + static INSN_REGPARM void thumbC8(uint32_t opcode) { - u8 regist = (opcode >> 8) & 7; + uint8_t regist = (opcode >> 8) & 7; if (busPrefetchCount == 0) busPrefetch = busPrefetchEnable; - u32 address = reg[regist].I & 0xFFFFFFFC; - u32 temp = reg[regist].I + 4 * cpuBitsSet[opcode & 0xFF]; + uint32_t address = reg[regist].I & 0xFFFFFFFC; + uint32_t temp = reg[regist].I + 4 * cpuBitsSet[opcode & 0xFF]; int count = 0; // load THUMB_LDM_REG(1, 0); @@ -1703,12 +1703,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // Conditional branches /////////////////////////////////////////////////// // BEQ offset - static INSN_REGPARM void thumbD0(u32 opcode) + static INSN_REGPARM void thumbD0(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (Z_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1718,12 +1718,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BNE offset - static INSN_REGPARM void thumbD1(u32 opcode) + static INSN_REGPARM void thumbD1(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (!Z_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1733,12 +1733,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BCS offset - static INSN_REGPARM void thumbD2(u32 opcode) + static INSN_REGPARM void thumbD2(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (C_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1748,12 +1748,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BCC offset - static INSN_REGPARM void thumbD3(u32 opcode) + static INSN_REGPARM void thumbD3(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (!C_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1763,12 +1763,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BMI offset - static INSN_REGPARM void thumbD4(u32 opcode) + static INSN_REGPARM void thumbD4(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (N_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1778,12 +1778,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BPL offset - static INSN_REGPARM void thumbD5(u32 opcode) + static INSN_REGPARM void thumbD5(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (!N_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1793,12 +1793,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BVS offset - static INSN_REGPARM void thumbD6(u32 opcode) + static INSN_REGPARM void thumbD6(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (V_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1808,12 +1808,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BVC offset - static INSN_REGPARM void thumbD7(u32 opcode) + static INSN_REGPARM void thumbD7(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (!V_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1823,12 +1823,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BHI offset - static INSN_REGPARM void thumbD8(u32 opcode) + static INSN_REGPARM void thumbD8(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (C_FLAG && !Z_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1838,12 +1838,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BLS offset - static INSN_REGPARM void thumbD9(u32 opcode) + static INSN_REGPARM void thumbD9(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (!C_FLAG || Z_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1853,12 +1853,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BGE offset - static INSN_REGPARM void thumbDA(u32 opcode) + static INSN_REGPARM void thumbDA(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (N_FLAG == V_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1868,12 +1868,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BLT offset - static INSN_REGPARM void thumbDB(u32 opcode) + static INSN_REGPARM void thumbDB(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (N_FLAG != V_FLAG) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1883,12 +1883,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BGT offset - static INSN_REGPARM void thumbDC(u32 opcode) + static INSN_REGPARM void thumbDC(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC) + 1; if (!Z_FLAG && (N_FLAG == V_FLAG)) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1898,12 +1898,12 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BLE offset - static INSN_REGPARM void thumbDD(u32 opcode) + static INSN_REGPARM void thumbDD(uint32_t opcode) { UPDATE_OLDREG; clockTicks = codeTicksAccessSeq16(armNextPC); if (Z_FLAG || (N_FLAG != V_FLAG)) { - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((int8_t)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1915,9 +1915,9 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // SWI, B, BL ///////////////////////////////////////////////////////////// // SWI #comment - static INSN_REGPARM void thumbDF(u32 opcode) + static INSN_REGPARM void thumbDF(uint32_t opcode) { - u32 address = 0; + uint32_t address = 0; //clockTicks = codeTicksAccessSeq16(address)*2 + codeTicksAccess16(address)+3; clockTicks = 3; busPrefetchCount = 0; @@ -1925,7 +1925,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // B offset - static INSN_REGPARM void thumbE0(u32 opcode) + static INSN_REGPARM void thumbE0(uint32_t opcode) { int offset = (opcode & 0x3FF) << 1; if (opcode & 0x0400) @@ -1939,7 +1939,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BLL #offset (forward) - static INSN_REGPARM void thumbF0(u32 opcode) + static INSN_REGPARM void thumbF0(uint32_t opcode) { int offset = (opcode & 0x7FF); reg[14].I = reg[15].I + (offset << 12); @@ -1947,7 +1947,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BLL #offset (backward) - static INSN_REGPARM void thumbF4(u32 opcode) + static INSN_REGPARM void thumbF4(uint32_t opcode) { int offset = (opcode & 0x7FF); reg[14].I = reg[15].I + ((offset << 12) | 0xFF800000); @@ -1955,10 +1955,10 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) } // BLH #offset - static INSN_REGPARM void thumbF8(u32 opcode) + static INSN_REGPARM void thumbF8(uint32_t opcode) { int offset = (opcode & 0x7FF); - u32 temp = reg[15].I - 2; + uint32_t temp = reg[15].I - 2; reg[15].I = (reg[14].I + (offset << 1)) & 0xFFFFFFFE; armNextPC = reg[15].I; reg[15].I += 2; @@ -1970,7 +1970,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) // Instruction table ////////////////////////////////////////////////////// - typedef INSN_REGPARM void (*insnfunc_t)(u32 opcode); + typedef INSN_REGPARM void (*insnfunc_t)(uint32_t opcode); #define thumbUI thumbUnknownInsn #ifdef BKPT_SUPPORT #define thumbBP thumbBreakpoint @@ -2120,14 +2120,14 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) //if ((armNextPC & 0x0803FFFF) == 0x08020000) // busPrefetchCount=0x100; - u32 opcode = cpuPrefetch[0]; + uint32_t opcode = cpuPrefetch[0]; cpuPrefetch[0] = cpuPrefetch[1]; busPrefetch = false; if (busPrefetchCount & 0xFFFFFF00) busPrefetchCount = 0x100 | (busPrefetchCount & 0xFF); clockTicks = 0; - u32 oldArmNextPC = armNextPC; + uint32_t oldArmNextPC = armNextPC; #ifndef FINAL_VERSION if (armNextPC == stop) { armNextPC++; @@ -2139,7 +2139,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) THUMB_PREFETCH_NEXT; #ifdef BKPT_SUPPORT - u32 memAddr = armNextPC; + uint32_t memAddr = armNextPC; memoryMap* m = &map[memAddr >> 24]; if (m->breakPoints && BreakThumbCheck(m->breakPoints, memAddr & m->mask)) { if (debuggerBreakOnExecution(memAddr, armState)) { diff --git a/src/gba/GBA.cpp b/src/gba/GBA.cpp index 2e00d2d1..61264147 100644 --- a/src/gba/GBA.cpp +++ b/src/gba/GBA.cpp @@ -4239,7 +4239,7 @@ void CPULoop(int ticks) } #ifdef TILED_RENDERING -union u8h { +union uint8_th { struct { /* 0*/ unsigned lo : 4; @@ -4316,7 +4316,7 @@ inline const TileLine gfxReadTilePal(const uint16_t* screenSource, const int yyy palette += tile.palette * 16; TileLine tileLine; - const u8h* tileBase = (u8h*)&charBase[tile.tileNum * 32 + tileY * 4]; + const uint8_th* tileBase = (uint8_th*)&charBase[tile.tileNum * 32 + tileY * 4]; if (!tile.hFlip) { gfxDrawPixel(&tileLine.pixels[0], tileBase[0].lo, palette, prio); diff --git a/src/gba/GBA.h b/src/gba/GBA.h index a5895cca..7060639b 100644 --- a/src/gba/GBA.h +++ b/src/gba/GBA.h @@ -1,6 +1,8 @@ #ifndef GBA_H #define GBA_H +#include + #include "../System.h" const uint64_t TICKS_PER_SECOND = 16777216; diff --git a/src/gba/GBALink.cpp b/src/gba/GBALink.cpp index efb0ae0a..821b3da0 100644 --- a/src/gba/GBALink.cpp +++ b/src/gba/GBALink.cpp @@ -14,7 +14,7 @@ #define snprintf _snprintf #endif -#define UPDATE_REG(address, value) WRITE16LE(((u16*)&ioMem[address]), value) +#define UPDATE_REG(address, value) WRITE16LE(((uint16_t*)&ioMem[address]), value) static int vbaid = 0; const char* MakeInstanceFilename(const char* Input) @@ -225,9 +225,9 @@ int WaitForSingleObject(sem_t* s, int t) #define JOYBUS 4 #define GP 5 -static int GetSIOMode(u16, u16); +static int GetSIOMode(uint16_t, uint16_t); static ConnectionState InitSocket(); -static void StartCableSocket(u16 siocnt); +static void StartCableSocket(uint16_t siocnt); static ConnectionState ConnectUpdateSocket(char* const message, size_t size); static void UpdateCableSocket(int ticks); static void CloseSocket(); @@ -236,9 +236,9 @@ const u64 TICKS_PER_FRAME = TICKS_PER_SECOND / 60; const u64 BITS_PER_SECOND = 115200; const u64 BYTES_PER_SECOND = BITS_PER_SECOND / 8; -static u32 lastjoybusupdate = 0; -static u32 nextjoybusupdate = 0; -static u32 lastcommand = 0; +static uint32_t lastjoybusupdate = 0; +static uint32_t nextjoybusupdate = 0; +static uint32_t lastcommand = 0; static bool booted = false; static ConnectionState JoyBusConnect(); @@ -246,7 +246,7 @@ static void JoyBusUpdate(int ticks); static void JoyBusShutdown(); static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size); -static void StartRFUSocket(u16 siocnt); +static void StartRFUSocket(uint16_t siocnt); bool LinkRFUUpdateSocket(); static void UpdateRFUSocket(int ticks); @@ -256,34 +256,34 @@ static void UpdateRFUSocket(int ticks); #define RFU_RECV 3 typedef struct { - u16 linkdata[5]; - u16 linkcmd[4]; - u16 numtransfers; - s32 lastlinktime; - u8 numgbas; //# of GBAs (max vbaid value plus 1), used in Single computer - u8 trgbas; - u8 linkflags; + uint16_t linkdata[5]; + uint16_t linkcmd[4]; + uint16_t numtransfers; + int32_t lastlinktime; + uint8_t numgbas; //# of GBAs (max vbaid value plus 1), used in Single computer + uint8_t trgbas; + uint8_t linkflags; - u8 rfu_proto[5]; // 0=UDP-like, 1=TCP-like protocols to see whether the data important or not (may or may not be received successfully by the other side) - u16 rfu_qid[5]; - s32 rfu_q[5]; - u32 rfu_signal[5]; - u8 rfu_is_host[5]; //request to join - //u8 rfu_joined[5]; //bool //currenlty joined - u16 rfu_reqid[5]; //id to join - u16 rfu_clientidx[5]; //only used by clients - s32 rfu_linktime[5]; - u32 rfu_broadcastdata[5][7]; //for 0x16/0x1d/0x1e? - u32 rfu_gdata[5]; //for 0x17/0x19?/0x1e? - s32 rfu_state[5]; //0=none, 1=waiting for ACK - u8 rfu_listfront[5]; - u8 rfu_listback[5]; + uint8_t rfu_proto[5]; // 0=UDP-like, 1=TCP-like protocols to see whether the data important or not (may or may not be received successfully by the other side) + uint16_t rfu_qid[5]; + int32_t rfu_q[5]; + uint32_t rfu_signal[5]; + uint8_t rfu_is_host[5]; //request to join + //uint8_t rfu_joined[5]; //bool //currenlty joined + uint16_t rfu_reqid[5]; //id to join + uint16_t rfu_clientidx[5]; //only used by clients + int32_t rfu_linktime[5]; + uint32_t rfu_broadcastdata[5][7]; //for 0x16/0x1d/0x1e? + uint32_t rfu_gdata[5]; //for 0x17/0x19?/0x1e? + int32_t rfu_state[5]; //0=none, 1=waiting for ACK + uint8_t rfu_listfront[5]; + uint8_t rfu_listback[5]; rfu_datarec rfu_datalist[5][256]; - /*u16 rfu_qidlist[5][256]; - u16 rfu_qlist[5][256]; - u32 rfu_datalist[5][256][255]; - u32 rfu_timelist[5][256];*/ + /*uint16_t rfu_qidlist[5][256]; + uint16_t rfu_qlist[5][256]; + uint32_t rfu_datalist[5][256][255]; + uint32_t rfu_timelist[5][256];*/ } LINKDATA; class RFUServer { @@ -291,7 +291,7 @@ class RFUServer { sf::SocketSelector fdset; int counter; int done; - u8 current_host; + uint8_t current_host; public: sf::TcpSocket tcpsocket[5]; @@ -322,14 +322,14 @@ public: // RFU crap (except for numtransfers note...should probably check that out) static LINKDATA* linkmem = NULL; static LINKDATA rfu_data; -static u8 rfu_cmd, rfu_qsend, rfu_qrecv_broadcast_data_len; +static uint8_t rfu_cmd, rfu_qsend, rfu_qrecv_broadcast_data_len; static int rfu_state, rfu_polarity, rfu_counter, rfu_masterq; // numtransfers seems to be used interchangeably with linkmem->numtransfers // in rfu code; probably a bug? static int rfu_transfer_end; // in local comm, setting this keeps slaves from trying to communicate even // when master isn't -static u16 numtransfers = 0; +static uint16_t numtransfers = 0; // time until next broadcast static int rfu_last_broadcast_time; @@ -337,27 +337,27 @@ static int rfu_last_broadcast_time; // timer to sync data static int rfu_last_host_send_time; -static u32 rfu_masterdata[255]; +static uint32_t rfu_masterdata[255]; bool rfu_enabled = false; bool rfu_initialized = false; bool rfu_waiting = false; -u8 rfu_qsend2, rfu_cmd2, rfu_lastcmd, rfu_lastcmd2; -u16 rfu_id, rfu_idx; +uint8_t rfu_qsend2, rfu_cmd2, rfu_lastcmd, rfu_lastcmd2; +uint16_t rfu_id, rfu_idx; static int gbaid = 0; static int gbaidx = 0; bool rfu_ishost, rfu_cansend; int rfu_lasttime; -u32 rfu_buf; -u16 PrevVAL = 0; -u32 PrevCOM = 0, PrevDAT = 0; -u8 rfu_numclients = 0; -u8 rfu_curclient = 0; -u32 rfu_clientlist[5]; +uint32_t rfu_buf; +uint16_t PrevVAL = 0; +uint32_t PrevCOM = 0, PrevDAT = 0; +uint8_t rfu_numclients = 0; +uint8_t rfu_curclient = 0; +uint32_t rfu_clientlist[5]; static RFUServer rfu_server; static RFUClient rfu_client; -u8 gbSIO_SC = 0; +uint8_t gbSIO_SC = 0; bool EmuReseted = true; bool LinkIsWaiting = false; bool LinkFirstTime = true; @@ -365,10 +365,10 @@ bool LinkFirstTime = true; #if (defined __WIN32__ || defined _WIN32) static ConnectionState InitIPC(); -static void StartCableIPC(u16 siocnt); +static void StartCableIPC(uint16_t siocnt); static void ReconnectCableIPC(); static void UpdateCableIPC(int ticks); -static void StartRFU(u16 siocnt); +static void StartRFU(uint16_t siocnt); static void UpdateRFUIPC(int ticks); static void CloseIPC(); @@ -377,7 +377,7 @@ static void CloseIPC(); struct LinkDriver { typedef ConnectionState(ConnectFunc)(); typedef ConnectionState(ConnectUpdateFunc)(char* const message, size_t size); - typedef void(StartFunc)(u16 siocnt); + typedef void(StartFunc)(uint16_t siocnt); typedef void(UpdateFunc)(int ticks); typedef void(CloseFunc)(); @@ -432,10 +432,10 @@ class CableServer { sf::SocketSelector fdset; //timeval udptimeout; char inbuffer[256], outbuffer[256]; - s32* intinbuffer; - u16* u16inbuffer; - s32* intoutbuffer; - u16* u16outbuffer; + int32_t* intinbuffer; + uint16_t* uint16_tinbuffer; + int32_t* intoutbuffer; + uint16_t* uint16_toutbuffer; int counter; int done; @@ -452,10 +452,10 @@ public: class CableClient { sf::SocketSelector fdset; char inbuffer[256], outbuffer[256]; - s32* intinbuffer; - u16* u16inbuffer; - s32* intoutbuffer; - u16* u16outbuffer; + int32_t* intinbuffer; + uint16_t* uint16_tinbuffer; + int32_t* intoutbuffer; + uint16_t* uint16_toutbuffer; int numbytes; public: @@ -473,8 +473,8 @@ public: static int i, j; static int linktimeout = 1; static LANLINKDATA lanlink; -static u16 cable_data[4]; -static u8 cable_gb_data[4]; +static uint16_t cable_data[4]; +static uint8_t cable_gb_data[4]; static CableServer ls; static CableClient lc; @@ -501,7 +501,7 @@ static const int trtimeend[3][4] = { }; // Hodgepodge -static u8 tspeed = 3; +static uint8_t tspeed = 3; static bool transfer_direction = false; static int linkid = 0; #if (defined __WIN32__ || defined _WIN32) @@ -521,7 +521,7 @@ static char linkevent[] = #endif "VBA link event "; -inline static int GetSIOMode(u16 siocnt, u16 rcnt) +inline static int GetSIOMode(uint16_t siocnt, uint16_t rcnt) { if (!(rcnt & 0x8000)) { switch (siocnt & 0x3000) { @@ -667,7 +667,7 @@ ConnectionState InitLink(LinkMode mode) // Find the link driver linkDriver = NULL; - for (u8 i = 0; i < sizeof(linkDrivers) / sizeof(linkDrivers[0]); i++) { + for (uint8_t i = 0; i < sizeof(linkDrivers) / sizeof(linkDrivers[0]); i++) { if (linkDrivers[i].mode == mode) { linkDriver = &linkDrivers[i]; break; @@ -689,7 +689,7 @@ ConnectionState InitLink(LinkMode mode) return gba_connection_state; } -void StartLink(u16 siocnt) +void StartLink(uint16_t siocnt) { if (!linkDriver || !linkDriver->start) { return; @@ -714,7 +714,7 @@ ConnectionState ConnectLinkUpdate(char* const message, size_t size) return gba_connection_state; } -void StartGPLink(u16 value) +void StartGPLink(uint16_t value) { UPDATE_REG(COMM_RCNT, value); @@ -777,17 +777,17 @@ void CloseLink(void) // Server CableServer::CableServer(void) { - intinbuffer = (s32*)inbuffer; - u16inbuffer = (u16*)inbuffer; - intoutbuffer = (s32*)outbuffer; - u16outbuffer = (u16*)outbuffer; + intinbuffer = (int32_t*)inbuffer; + uint16_tinbuffer = (uint16_t*)inbuffer; + intoutbuffer = (int32_t*)outbuffer; + uint16_toutbuffer = (uint16_t*)outbuffer; } void CableServer::Send(void) { if (lanlink.type == 0) { // TCP outbuffer[1] = tspeed; - WRITE16LE(&u16outbuffer[1], cable_data[0]); + WRITE16LE(&uint16_toutbuffer[1], cable_data[0]); WRITE32LE(&intoutbuffer[1], transfer_start_time_from_master); if (lanlink.numslaves == 1) { @@ -796,22 +796,22 @@ void CableServer::Send(void) tcpsocket[1].send(outbuffer, 8); } } else if (lanlink.numslaves == 2) { - WRITE16LE(&u16outbuffer[4], cable_data[2]); + WRITE16LE(&uint16_toutbuffer[4], cable_data[2]); if (lanlink.type == 0) { outbuffer[0] = 10; tcpsocket[1].send(outbuffer, 10); - WRITE16LE(&u16outbuffer[4], cable_data[1]); + WRITE16LE(&uint16_toutbuffer[4], cable_data[1]); tcpsocket[2].send(outbuffer, 10); } } else { if (lanlink.type == 0) { outbuffer[0] = 12; - WRITE16LE(&u16outbuffer[4], cable_data[2]); - WRITE16LE(&u16outbuffer[5], cable_data[3]); + WRITE16LE(&uint16_toutbuffer[4], cable_data[2]); + WRITE16LE(&uint16_toutbuffer[5], cable_data[3]); tcpsocket[1].send(outbuffer, 12); - WRITE16LE(&u16outbuffer[4], cable_data[1]); + WRITE16LE(&uint16_toutbuffer[4], cable_data[1]); tcpsocket[2].send(outbuffer, 12); - WRITE16LE(&u16outbuffer[5], cable_data[2]); + WRITE16LE(&uint16_toutbuffer[5], cable_data[2]); tcpsocket[3].send(outbuffer, 12); } } @@ -856,7 +856,7 @@ void CableServer::Recv(void) CloseLink(); return; } - cable_data[i + 1] = READ16LE(&u16inbuffer[1]); + cable_data[i + 1] = READ16LE(&uint16_tinbuffer[1]); } } return; @@ -896,7 +896,7 @@ bool CableServer::RecvGB(void) for (i = 0; i < lanlink.numslaves; i++) { numbytes = 0; - u8 recv_byte = 0; + uint8_t recv_byte = 0; size_t nr; tcpsocket[i + 1].receive(&recv_byte, 1, nr); @@ -926,10 +926,10 @@ bool CableServer::RecvGB(void) // Client CableClient::CableClient(void) { - intinbuffer = (s32*)inbuffer; - u16inbuffer = (u16*)inbuffer; - intoutbuffer = (s32*)outbuffer; - u16outbuffer = (u16*)outbuffer; + intinbuffer = (int32_t*)inbuffer; + uint16_tinbuffer = (uint16_t*)inbuffer; + intoutbuffer = (int32_t*)outbuffer; + uint16_toutbuffer = (uint16_t*)outbuffer; transferring = false; return; } @@ -953,11 +953,11 @@ void CableClient::CheckConn(void) } transferring = true; transfer_start_time_from_master = 0; - cable_data[0] = READ16LE(&u16inbuffer[1]); + cable_data[0] = READ16LE(&uint16_tinbuffer[1]); tspeed = inbuffer[1] & 3; for (i = 1, numbytes = 4; i <= lanlink.numslaves; i++) if (i != linkid) { - cable_data[i] = READ16LE(&u16inbuffer[numbytes]); + cable_data[i] = READ16LE(&uint16_tinbuffer[numbytes]); numbytes++; } } @@ -978,7 +978,7 @@ bool CableClient::RecvGB(void) } numbytes = 0; size_t nr; - u8 recv_byte = 0; + uint8_t recv_byte = 0; lanlink.tcpsocket.receive(&recv_byte, 1, nr); numbytes += nr; @@ -1032,11 +1032,11 @@ void CableClient::Recv(void) return; } tspeed = inbuffer[1] & 3; - cable_data[0] = READ16LE(&u16inbuffer[1]); - transfer_start_time_from_master = (s32)READ32LE(&intinbuffer[1]); + cable_data[0] = READ16LE(&uint16_tinbuffer[1]); + transfer_start_time_from_master = (int32_t)READ32LE(&intinbuffer[1]); for (i = 1, numbytes = 4; i < lanlink.numslaves + 1; i++) { if (i != linkid) { - cable_data[i] = READ16LE(&u16inbuffer[numbytes]); + cable_data[i] = READ16LE(&uint16_tinbuffer[numbytes]); numbytes++; } } @@ -1046,7 +1046,7 @@ void CableClient::Send() { outbuffer[0] = 4; outbuffer[1] = linkid << 2; - WRITE16LE(&u16outbuffer[1], cable_data[linkid]); + WRITE16LE(&uint16_toutbuffer[1], cable_data[linkid]); lanlink.tcpsocket.send(outbuffer, 4); return; } @@ -1173,7 +1173,7 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size) return newState; } -void StartCableSocket(u16 value) +void StartCableSocket(uint16_t value) { switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) { case MULTIPLAYER: { @@ -1346,7 +1346,7 @@ static void JoyBusUpdate(int ticks) char data[5] = { 0x10, 0, 0, 0, 0 }; // init with invalid cmd std::vector resp; - u8 cmd = 0x10; + uint8_t cmd = 0x10; if (lastcommand > (TICKS_PER_FRAME * 4)) { cmd = dol->ReceiveCmd(data, true); @@ -1370,10 +1370,10 @@ static void JoyBusUpdate(int ticks) break; case JOY_CMD_READ: - resp.push_back((u8)(READ16LE(&ioMem[COMM_JOY_TRANS_L]) & 0xff)); - resp.push_back((u8)(READ16LE(&ioMem[COMM_JOY_TRANS_L]) >> 8)); - resp.push_back((u8)(READ16LE(&ioMem[COMM_JOY_TRANS_H]) & 0xff)); - resp.push_back((u8)(READ16LE(&ioMem[COMM_JOY_TRANS_H]) >> 8)); + resp.push_back((uint8_t)(READ16LE(&ioMem[COMM_JOY_TRANS_L]) & 0xff)); + resp.push_back((uint8_t)(READ16LE(&ioMem[COMM_JOY_TRANS_L]) >> 8)); + resp.push_back((uint8_t)(READ16LE(&ioMem[COMM_JOY_TRANS_H]) & 0xff)); + resp.push_back((uint8_t)(READ16LE(&ioMem[COMM_JOY_TRANS_H]) >> 8)); UPDATE_REG(COMM_JOYCNT, READ16LE(&ioMem[COMM_JOYCNT]) | JOYCNT_SEND_COMPLETE); nextjoybusupdate = TICKS_PER_SECOND / BYTES_PER_SECOND; @@ -1381,8 +1381,8 @@ static void JoyBusUpdate(int ticks) break; case JOY_CMD_WRITE: - UPDATE_REG(COMM_JOY_RECV_L, (u16)((u16)data[2] << 8) | (u8)data[1]); - UPDATE_REG(COMM_JOY_RECV_H, (u16)((u16)data[4] << 8) | (u8)data[3]); + UPDATE_REG(COMM_JOY_RECV_L, (uint16_t)((uint16_t)data[2] << 8) | (uint8_t)data[1]); + UPDATE_REG(COMM_JOY_RECV_H, (uint16_t)((uint16_t)data[4] << 8) | (uint8_t)data[3]); UPDATE_REG(COMM_JOYSTAT, READ16LE(&ioMem[COMM_JOYSTAT]) | JOYSTAT_RECV); UPDATE_REG(COMM_JOYCNT, READ16LE(&ioMem[COMM_JOYCNT]) | JOYCNT_RECV_COMPLETE); nextjoybusupdate = TICKS_PER_SECOND / BYTES_PER_SECOND; @@ -1396,7 +1396,7 @@ static void JoyBusUpdate(int ticks) } lastjoybusupdate = 0; - resp.push_back((u8)READ16LE(&ioMem[COMM_JOYSTAT])); + resp.push_back((uint8_t)READ16LE(&ioMem[COMM_JOYSTAT])); if (cmd == JOY_CMD_READ) { UPDATE_REG(COMM_JOYSTAT, READ16LE(&ioMem[COMM_JOYSTAT]) & ~JOYSTAT_SEND); @@ -1478,7 +1478,7 @@ void RFUServer::DeSerialize(sf::Packet packet, int slave) for (int i = 0; i < MAX_CLIENTS; i++) { if (i != slave) { - u8 num_data_sent = 0; + uint8_t num_data_sent = 0; packet >> rfu_data.rfu_clientidx[i]; packet >> rfu_data.rfu_is_host[i]; packet >> num_data_sent; @@ -1615,7 +1615,7 @@ void RFUClient::DeSerialize(sf::Packet packet) } if (i == linkid) { - u8 num_data_sent = 0; + uint8_t num_data_sent = 0; packet >> rfu_data.rfu_clientidx[i]; packet >> rfu_data.rfu_is_host[i]; packet >> num_data_sent; @@ -1755,7 +1755,7 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size) } // The GBA wireless RFU (see adapter3.txt) -static void StartRFUSocket(u16 value) +static void StartRFUSocket(uint16_t value) { int siomode = GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT])); @@ -1782,7 +1782,7 @@ static void StartRFUSocket(u16 value) } static bool logstartd; - u32 CurCOM = 0, CurDAT = 0; + uint32_t CurCOM = 0, CurDAT = 0; bool rfulogd = (READ16LE(&ioMem[COMM_SIOCNT]) != value); switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) { @@ -1815,7 +1815,7 @@ static void StartRFUSocket(u16 value) else rfu_transfer_end = 256; - u16 siodata_h = READ16LE(&ioMem[COMM_SIODATA32_H]); + uint16_t siodata_h = READ16LE(&ioMem[COMM_SIODATA32_H]); switch (rfu_state) { case RFU_INIT: if (READ32LE(&ioMem[COMM_SIODATA32_L]) == 0xb0bb8001) { @@ -1830,7 +1830,7 @@ static void StartRFUSocket(u16 value) CurCOM = READ32LE(&ioMem[COMM_SIODATA32_L]); if (siodata_h == 0x9966) //initialize cmd { - u8 tmpcmd = CurCOM; + uint8_t tmpcmd = CurCOM; if (tmpcmd != 0x10 && tmpcmd != 0x11 && tmpcmd != 0x13 && tmpcmd != 0x14 && tmpcmd != 0x16 && tmpcmd != 0x17 && tmpcmd != 0x19 && tmpcmd != 0x1a && tmpcmd != 0x1b && tmpcmd != 0x1c && tmpcmd != 0x1d && tmpcmd != 0x1e && tmpcmd != 0x1f && tmpcmd != 0x20 && tmpcmd != 0x21 && tmpcmd != 0x24 && tmpcmd != 0x25 && tmpcmd != 0x26 && tmpcmd != 0x27 && tmpcmd != 0x30 && tmpcmd != 0x32 && tmpcmd != 0x33 && tmpcmd != 0x34 && tmpcmd != 0x3d && tmpcmd != 0xa8 && tmpcmd != 0xee) { } rfu_counter = 0; @@ -1994,8 +1994,8 @@ static void StartRFUSocket(u16 value) //check signal if (rfu_data.numgbas >= 2 && (rfu_data.rfu_is_host[linkid] | rfu_data.rfu_is_host[gbaid])) //signal only good when connected if (rfu_ishost) { //update, just incase there are leaving clients - u8 rfureq = rfu_data.rfu_is_host[linkid]; - u8 oldnum = rfu_numclients; + uint8_t rfureq = rfu_data.rfu_is_host[linkid]; + uint8_t oldnum = rfu_numclients; rfu_numclients = 0; for (int i = 0; i < 8; i++) { if (rfureq & 1) @@ -2011,11 +2011,11 @@ static void StartRFUSocket(u16 value) rfu_data.rfu_signal[linkid] = 0; if (rfu_qrecv_broadcast_data_len == 0) { rfu_qrecv_broadcast_data_len = 1; - rfu_masterdata[0] = (u32)rfu_data.rfu_signal[linkid]; + rfu_masterdata[0] = (uint32_t)rfu_data.rfu_signal[linkid]; } if (rfu_qrecv_broadcast_data_len > 0) { rfu_state = RFU_RECV; - rfu_masterdata[rfu_qrecv_broadcast_data_len - 1] = (u32)rfu_data.rfu_signal[gbaid]; + rfu_masterdata[rfu_qrecv_broadcast_data_len - 1] = (uint32_t)rfu_data.rfu_signal[gbaid]; } rfu_cmd ^= 0x80; break; @@ -2023,7 +2023,7 @@ static void StartRFUSocket(u16 value) if (rfu_data.rfu_signal[linkid] || numtransfers == 0) rfu_masterdata[0] = 0; else //0=success - rfu_masterdata[0] = (u32)-1; //0xffffffff; //1=failed, 2++ = reserved/invalid, we use invalid value to let the game retries 0x33 until signal restored + rfu_masterdata[0] = (uint32_t)-1; //0xffffffff; //1=failed, 2++ = reserved/invalid, we use invalid value to let the game retries 0x33 until signal restored rfu_cmd ^= 0x80; rfu_state = RFU_RECV; rfu_qrecv_broadcast_data_len = 1; @@ -2154,7 +2154,7 @@ static void StartRFUSocket(u16 value) ctr = 0; if (rfu_data.rfu_listfront[linkid] != rfu_data.rfu_listback[linkid]) //data existed do { - u8 qdata_len = rfu_data.rfu_datalist[linkid][rfu_data.rfu_listfront[linkid]].len; //(u8)rfu_data.rfu_qlist[linkid][rfu_data.rfu_listfront[linkid]]; + uint8_t qdata_len = rfu_data.rfu_datalist[linkid][rfu_data.rfu_listfront[linkid]].len; //(uint8_t)rfu_data.rfu_qlist[linkid][rfu_data.rfu_listfront[linkid]]; ok = false; if (qdata_len != rfu_qrecv_broadcast_data_len) ok = true; @@ -2179,7 +2179,7 @@ static void StartRFUSocket(u16 value) gbaid = rfu_data.rfu_datalist[linkid][rfu_data.rfu_listfront[linkid]].gbaid; rfu_id = (gbaid << 3) + 0x61f1; if (rfu_ishost) { - rfu_curclient = (u8)rfu_data.rfu_clientidx[gbaid]; + rfu_curclient = (uint8_t)rfu_data.rfu_clientidx[gbaid]; } if (rfu_qrecv_broadcast_data_len != 0) { //data size > 0 memcpy(rfu_masterdata, rfu_data.rfu_datalist[linkid][rfu_data.rfu_listfront[linkid]].data, std::min(rfu_masterq << 2, (int)sizeof(rfu_masterdata))); @@ -2489,7 +2489,7 @@ static void UpdateRFUSocket(int ticks) if (LinkRFUUpdateSocket()) { if (transfer_direction == RECEIVING && rfu_transfer_end <= 0) { transfer_direction = SENDING; - u16 value = READ16LE(&ioMem[COMM_SIOCNT]); + uint16_t value = READ16LE(&ioMem[COMM_SIOCNT]); if (value & SIO_IRQ_ENABLE) { IF |= 0x80; UPDATE_REG(0x202, IF); @@ -2518,9 +2518,9 @@ void gbInitLink() } } -u8 gbStartLink(u8 b) //used on internal clock +uint8_t gbStartLink(uint8_t b) //used on internal clock { - u8 dat = 0xff; //master (w/ internal clock) will gets 0xff if slave is turned off (or not ready yet also?) + uint8_t dat = 0xff; //master (w/ internal clock) will gets 0xff if slave is turned off (or not ready yet also?) //if(linkid) return 0xff; //b; //Slave shouldn't be sending from here //int gbSerialOn = (gbMemory[0xff02] & 0x80); //not needed? gba_link_enabled = true; //(gbMemory[0xff02]!=0); //not needed? @@ -2559,10 +2559,10 @@ u8 gbStartLink(u8 b) //used on internal clock return dat; } -u16 gbLinkUpdate(u8 b, int gbSerialOn) //used on external clock +uint16_t gbLinkUpdate(uint8_t b, int gbSerialOn) //used on external clock { - u8 dat = b; //0xff; //slave (w/ external clocks) won't be getting 0xff if master turned off - u8 recvd = 0; + uint8_t dat = b; //0xff; //slave (w/ external clocks) won't be getting 0xff if master turned off + uint8_t recvd = 0; int idx = 0; gba_link_enabled = true; //(gbMemory[0xff02]!=0); @@ -2608,7 +2608,7 @@ u16 gbLinkUpdate(u8 b, int gbSerialOn) //used on external clock if (dat == 0xff /*||dat==0x00||b==0x00*/) //dat==0xff||dat==0x00 LinkFirstTime = true; } - return ((dat << 8) | (recvd & (u8)0xff)); + return ((dat << 8) | (recvd & (uint8_t)0xff)); } #if (defined __WIN32__ || defined _WIN32) @@ -2724,7 +2724,7 @@ static ConnectionState InitIPC() return LINK_OK; } -static void StartCableIPC(u16 value) +static void StartCableIPC(uint16_t value) { switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) { case MULTIPLAYER: { @@ -2952,7 +2952,7 @@ static void UpdateCableIPC(int ticks) ReleaseSemaphore(linksync[0], 1, NULL); linktime -= trtimeend[transfer_direction - 3][tspeed]; transfer_direction = 0; - u16 value = READ16LE(&ioMem[COMM_SIOCNT]); + uint16_t value = READ16LE(&ioMem[COMM_SIOCNT]); if (!linkid) value |= 4; // SI becomes high on slaves after xfer UPDATE_REG(COMM_SIOCNT, (value & 0xff0f) | (linkid << 4)); @@ -2966,7 +2966,7 @@ static void UpdateCableIPC(int ticks) } // The GBA wireless RFU (see adapter3.txt) -static void StartRFU(u16 value) +static void StartRFU(uint16_t value) { int siomode = GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT])); @@ -3000,7 +3000,7 @@ static void StartRFU(u16 value) linktimeout = 1; static bool logstartd; - u32 CurCOM = 0, CurDAT = 0; + uint32_t CurCOM = 0, CurDAT = 0; bool rfulogd = (READ16LE(&ioMem[COMM_SIOCNT]) != value); switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) { @@ -3031,7 +3031,7 @@ static void StartRFU(u16 value) rfu_transfer_end = 2048; else rfu_transfer_end = 256; - u16 siodata_h = READ16LE(&ioMem[COMM_SIODATA32_H]); + uint16_t siodata_h = READ16LE(&ioMem[COMM_SIODATA32_H]); switch (rfu_state) { case RFU_INIT: if (READ32LE(&ioMem[COMM_SIODATA32_L]) == 0xb0bb8001) { @@ -3046,7 +3046,7 @@ static void StartRFU(u16 value) CurCOM = READ32LE(&ioMem[COMM_SIODATA32_L]); if (siodata_h == 0x9966) //initialize cmd { - u8 tmpcmd = CurCOM; + uint8_t tmpcmd = CurCOM; if (tmpcmd != 0x10 && tmpcmd != 0x11 && tmpcmd != 0x13 && tmpcmd != 0x14 && tmpcmd != 0x16 && tmpcmd != 0x17 && tmpcmd != 0x19 && tmpcmd != 0x1a && tmpcmd != 0x1b && tmpcmd != 0x1c && tmpcmd != 0x1d && tmpcmd != 0x1e && tmpcmd != 0x1f && tmpcmd != 0x20 && tmpcmd != 0x21 && tmpcmd != 0x24 && tmpcmd != 0x25 && tmpcmd != 0x26 && tmpcmd != 0x27 && tmpcmd != 0x30 && tmpcmd != 0x32 && tmpcmd != 0x33 && tmpcmd != 0x34 && tmpcmd != 0x3d && tmpcmd != 0xa8 && tmpcmd != 0xee) { log("%08X : UnkCMD %08X %04X %08X %08X\n", GetTickCount(), CurCOM, PrevVAL, PrevCOM, PrevDAT); } @@ -3285,8 +3285,8 @@ static void StartRFU(u16 value) //check signal if (linkmem->numgbas >= 2 && (linkmem->rfu_is_host[vbaid] | linkmem->rfu_is_host[gbaid])) //signal only good when connected if (rfu_ishost) { //update, just incase there are leaving clients - u8 rfureq = linkmem->rfu_is_host[vbaid]; - u8 oldnum = rfu_numclients; + uint8_t rfureq = linkmem->rfu_is_host[vbaid]; + uint8_t oldnum = rfu_numclients; rfu_numclients = 0; for (int i = 0; i < 8; i++) { if (rfureq & 1) @@ -3315,24 +3315,24 @@ static void StartRFU(u16 value) } while (i!=gbaid);*/ /*if(rfu_numclients>0) for(int i=0; i=0x61f1) { cid = (cid-0x61f1)>>3; rfu_masterdata[rfu_qrecv++] = linkmem->rfu_signal[cid] = 0xffffffff>>((3-linkmem->rfu_clientidx[cid])<<3); //0x0ff << (linkmem->rfu_clientidx[cid]<<3); } }*/ - //rfu_masterdata[0] = (u32)linkmem->rfu_signal[vbaid]; + //rfu_masterdata[0] = (uint32_t)linkmem->rfu_signal[vbaid]; } if (rfu_qrecv_broadcast_data_len == 0) { rfu_qrecv_broadcast_data_len = 1; - rfu_masterdata[0] = (u32)linkmem->rfu_signal[vbaid]; + rfu_masterdata[0] = (uint32_t)linkmem->rfu_signal[vbaid]; } if (rfu_qrecv_broadcast_data_len > 0) { rfu_state = RFU_RECV; int hid = vbaid; if (!rfu_ishost) hid = gbaid; - rfu_masterdata[rfu_qrecv_broadcast_data_len - 1] = (u32)linkmem->rfu_signal[hid]; + rfu_masterdata[rfu_qrecv_broadcast_data_len - 1] = (uint32_t)linkmem->rfu_signal[hid]; } rfu_cmd ^= 0x80; //rfu_polarity = 0; @@ -3350,7 +3350,7 @@ static void StartRFU(u16 value) if (linkmem->rfu_signal[vbaid] || numtransfers == 0) rfu_masterdata[0] = 0; else //0=success - rfu_masterdata[0] = (u32)-1; //0xffffffff; //1=failed, 2++ = reserved/invalid, we use invalid value to let the game retries 0x33 until signal restored + rfu_masterdata[0] = (uint32_t)-1; //0xffffffff; //1=failed, 2++ = reserved/invalid, we use invalid value to let the game retries 0x33 until signal restored rfu_cmd ^= 0x80; rfu_state = RFU_RECV; rfu_qrecv_broadcast_data_len = 1; @@ -3521,7 +3521,7 @@ static void StartRFU(u16 value) //do { if(rfu_numclients>0) { //is a host - u8 cc = rfu_curclient; + uint8_t cc = rfu_curclient; do { rfu_curclient = (rfu_curclient+1) % rfu_numclients; rfu_idx = rfu_clientlist[rfu_curclient]; @@ -3559,7 +3559,7 @@ static void StartRFU(u16 value) //ResetEvent(linksync[vbaid]); //lock it so noone can access it if (linkmem->rfu_listfront[vbaid] != linkmem->rfu_listback[vbaid]) //data existed do { - u8 tmpq = linkmem->rfu_datalist[vbaid][linkmem->rfu_listfront[vbaid]].len; //(u8)linkmem->rfu_qlist[vbaid][linkmem->rfu_listfront[vbaid]]; + uint8_t tmpq = linkmem->rfu_datalist[vbaid][linkmem->rfu_listfront[vbaid]].len; //(uint8_t)linkmem->rfu_qlist[vbaid][linkmem->rfu_listfront[vbaid]]; ok = false; if (tmpq != rfu_qrecv_broadcast_data_len) ok = true; @@ -3585,7 +3585,7 @@ static void StartRFU(u16 value) gbaid = linkmem->rfu_datalist[vbaid][linkmem->rfu_listfront[vbaid]].gbaid; rfu_id = (gbaid << 3) + 0x61f1; if (rfu_ishost) - rfu_curclient = (u8)linkmem->rfu_clientidx[gbaid]; + rfu_curclient = (uint8_t)linkmem->rfu_clientidx[gbaid]; if (rfu_qrecv_broadcast_data_len != 0) { //data size > 0 memcpy(rfu_masterdata, linkmem->rfu_datalist[vbaid][linkmem->rfu_listfront[vbaid]].data, std::min(rfu_masterq << 2, (int)sizeof(rfu_masterdata))); } @@ -3940,9 +3940,9 @@ bool LinkRFUUpdate() if (transfer_direction && rfu_transfer_end <= 0) { if (rfu_waiting) { bool ok = false; - u8 oldcmd = rfu_cmd; - u8 oldq = linkmem->rfu_q[vbaid]; - u32 tmout = linktimeout; + uint8_t oldcmd = rfu_cmd; + uint8_t oldq = linkmem->rfu_q[vbaid]; + uint32_t tmout = linktimeout; //if ((!lanlink.active&&speedhack) || (lanlink.speed&&IsLinkConnected()))tmout = 16; if (rfu_state != RFU_INIT) { if (rfu_cmd == 0x24 || rfu_cmd == 0x25 || rfu_cmd == 0x35) { @@ -4009,7 +4009,7 @@ static void UpdateRFUIPC(int ticks) if (LinkRFUUpdate()) { if (transfer_direction && rfu_transfer_end <= 0) { transfer_direction = 0; - u16 value = READ16LE(&ioMem[COMM_SIOCNT]); + uint16_t value = READ16LE(&ioMem[COMM_SIOCNT]); if (value & 0x4000) { IF |= 0x80; UPDATE_REG(0x202, IF); @@ -4036,9 +4036,9 @@ void gbInitLinkIPC() linkmem->linkdata[linkid] = 0xff; } -u8 gbStartLinkIPC(u8 b) //used on internal clock +uint8_t gbStartLinkIPC(uint8_t b) //used on internal clock { - u8 dat = 0xff; //master (w/ internal clock) will gets 0xff if slave is turned off (or not ready yet also?) + uint8_t dat = 0xff; //master (w/ internal clock) will gets 0xff if slave is turned off (or not ready yet also?) //if(linkid) return 0xff; //b; //Slave shouldn't be sending from here BOOL sent = false; //int gbSerialOn = (gbMemory[0xff02] & 0x80); //not needed? @@ -4050,11 +4050,11 @@ u8 gbStartLinkIPC(u8 b) //used on internal clock //Single Computer if (GetLinkMode() == LINK_GAMEBOY_IPC) { - u32 tm = GetTickCount(); + uint32_t tm = GetTickCount(); do { WaitForSingleObject(linksync[linkid], 1); ResetEvent(linksync[linkid]); - } while (linkmem->linkcmd[linkid] && (GetTickCount() - tm) < (u32)linktimeout); + } while (linkmem->linkcmd[linkid] && (GetTickCount() - tm) < (uint32_t)linktimeout); linkmem->linkdata[linkid] = b; linkmem->linkcmd[linkid] = 1; SetEvent(linksync[linkid]); @@ -4064,9 +4064,9 @@ u8 gbStartLinkIPC(u8 b) //used on internal clock do { WaitForSingleObject(linksync[1 - linkid], 1); ResetEvent(linksync[1 - linkid]); - } while (!linkmem->linkcmd[1 - linkid] && (GetTickCount() - tm) < (u32)linktimeout); + } while (!linkmem->linkcmd[1 - linkid] && (GetTickCount() - tm) < (uint32_t)linktimeout); if (linkmem->linkcmd[1 - linkid]) { - dat = (u8)linkmem->linkdata[1 - linkid]; + dat = (uint8_t)linkmem->linkdata[1 - linkid]; linkmem->linkcmd[1 - linkid] = 0; } //else LinkIsWaiting = true; SetEvent(linksync[1 - linkid]); @@ -4080,9 +4080,9 @@ u8 gbStartLinkIPC(u8 b) //used on internal clock return dat; } -u16 gbLinkUpdateIPC(u8 b, int gbSerialOn) //used on external clock +uint16_t gbLinkUpdateIPC(uint8_t b, int gbSerialOn) //used on external clock { - u8 dat = b; //0xff; //slave (w/ external clocks) won't be getting 0xff if master turned off + uint8_t dat = b; //0xff; //slave (w/ external clocks) won't be getting 0xff if master turned off BOOL recvd = false; int idx = 0; @@ -4093,13 +4093,13 @@ u16 gbLinkUpdateIPC(u8 b, int gbSerialOn) //used on external clock if (gba_link_enabled) //Single Computer if (GetLinkMode() == LINK_GAMEBOY_IPC) { - u32 tm; // = GetTickCount(); + uint32_t tm; // = GetTickCount(); //do { WaitForSingleObject(linksync[1 - linkid], linktimeout); ResetEvent(linksync[1 - linkid]); - //} while (!linkmem->linkcmd[1-linkid] && (GetTickCount()-tm)<(u32)linktimeout); + //} while (!linkmem->linkcmd[1-linkid] && (GetTickCount()-tm)<(uint32_t)linktimeout); if (linkmem->linkcmd[1 - linkid]) { - dat = (u8)linkmem->linkdata[1 - linkid]; + dat = (uint8_t)linkmem->linkdata[1 - linkid]; linkmem->linkcmd[1 - linkid] = 0; recvd = true; LinkIsWaiting = false; @@ -4112,7 +4112,7 @@ u16 gbLinkUpdateIPC(u8 b, int gbSerialOn) //used on external clock do { WaitForSingleObject(linksync[linkid], 1); ResetEvent(linksync[linkid]); - } while (linkmem->linkcmd[1 - linkid] && (GetTickCount() - tm) < (u32)linktimeout); + } while (linkmem->linkcmd[1 - linkid] && (GetTickCount() - tm) < (uint32_t)linktimeout); if (!linkmem->linkcmd[linkid]) { linkmem->linkdata[linkid] = b; linkmem->linkcmd[linkid] = 1; @@ -4124,7 +4124,7 @@ u16 gbLinkUpdateIPC(u8 b, int gbSerialOn) //used on external clock if (dat == 0xff /*||dat==0x00||b==0x00*/) //dat==0xff||dat==0x00 LinkFirstTime = true; } - return ((dat << 8) | (recvd & (u8)0xff)); + return ((dat << 8) | (recvd & (uint8_t)0xff)); } static void CloseIPC() diff --git a/src/gba/GBALink.h b/src/gba/GBALink.h index 4ba965b0..596e2f3b 100644 --- a/src/gba/GBALink.h +++ b/src/gba/GBALink.h @@ -108,14 +108,14 @@ extern int GetLinkPlayerId(); * * @param siocnt the value of SIOCNT to be written */ -extern void StartLink(u16 siocnt); +extern void StartLink(uint16_t siocnt); /** * Start a general purpose link transfer * * @param rcnt the value of RCNT to be written */ -extern void StartGPLink(u16 rcnt); +extern void StartGPLink(uint16_t rcnt); /** * Emulate the linked device @@ -185,22 +185,22 @@ extern const char* MakeInstanceFilename(const char* Input); #define RF_CNT 0x27a // Unknown, Seems to be related to Wireless Adapter(RF_SIOCNT?) typedef struct { - u8 len; // data len in 32bit words - u8 gbaid; // source id - u32 time; // linktime - u32 data[255]; + uint8_t len; // data len in 32bit words + uint8_t gbaid; // source id + uint32_t time; // linktime + uint32_t data[255]; } rfu_datarec; -extern u8 gbSIO_SC; +extern uint8_t gbSIO_SC; extern bool LinkIsWaiting; extern bool LinkFirstTime; extern bool EmuReseted; extern void gbInitLink(); -extern u8 gbStartLink(u8 b); -extern u16 gbLinkUpdate(u8 b, int gbSerialOn); +extern uint8_t gbStartLink(uint8_t b); +extern uint16_t gbLinkUpdate(uint8_t b, int gbSerialOn); extern void gbInitLinkIPC(); -extern u8 gbStartLinkIPC(u8 b); -extern u16 gbLinkUpdateIPC(u8 b, int gbSerialOn); +extern uint8_t gbStartLinkIPC(uint8_t b); +extern uint16_t gbLinkUpdateIPC(uint8_t b, int gbSerialOn); extern void BootLink(int m_type, const char* host, int timeout, bool m_hacks, int m_numplayers); diff --git a/src/gba/GBASockClient.cpp b/src/gba/GBASockClient.cpp index 17e94891..a332d126 100644 --- a/src/gba/GBASockClient.cpp +++ b/src/gba/GBASockClient.cpp @@ -27,7 +27,7 @@ GBASockClient::~GBASockClient() clock_client.disconnect(); } -u32 clock_sync_ticks = 0; +uint32_t clock_sync_ticks = 0; void GBASockClient::Send(std::vector data) { @@ -70,15 +70,15 @@ void GBASockClient::ReceiveClock(bool block) if (num_received == 4) { clock_sync_ticks = 0; for (int i = 0; i < 4; i++) - clock_sync_ticks |= (u8)(sync_ticks[i]) << ((3 - i) * 8); + clock_sync_ticks |= (uint8_t)(sync_ticks[i]) << ((3 - i) * 8); clock_sync += clock_sync_ticks; } } -void GBASockClient::ClockSync(u32 ticks) +void GBASockClient::ClockSync(uint32_t ticks) { - if (clock_sync > (s32)ticks) - clock_sync -= (s32)ticks; + if (clock_sync > (int32_t)ticks) + clock_sync -= (int32_t)ticks; else clock_sync = 0; } diff --git a/src/gba/GBASockClient.h b/src/gba/GBASockClient.h index 15e8b25b..cf28bd00 100644 --- a/src/gba/GBASockClient.h +++ b/src/gba/GBASockClient.h @@ -1,6 +1,6 @@ #pragma once -#include "../common/Types.h" +#include #include class GBASockClient { @@ -13,7 +13,7 @@ public: char ReceiveCmd(char* data_in, bool block); void ReceiveClock(bool block); - void ClockSync(u32 ticks); + void ClockSync(uint32_t ticks); void Disconnect(); bool IsDisconnected(); @@ -22,6 +22,6 @@ private: sf::TcpSocket client; sf::TcpSocket clock_client; - s32 clock_sync; + int32_t clock_sync; bool is_disconnected; }; diff --git a/src/gba/Globals.cpp b/src/gba/Globals.cpp index 17897f19..4205df7e 100644 --- a/src/gba/Globals.cpp +++ b/src/gba/Globals.cpp @@ -14,99 +14,99 @@ bool Z_FLAG = 0; bool V_FLAG = 0; bool armState = true; bool armIrqEnable = true; -u32 armNextPC = 0x00000000; +uint32_t armNextPC = 0x00000000; int armMode = 0x1f; -u32 stop = 0x08000568; +uint32_t stop = 0x08000568; // this is an optional hack to change the backdrop/background color: // -1: disabled // 0x0000 to 0x7FFF: set custom 15 bit color int customBackdropColor = -1; -u8* bios = 0; -u8* rom = 0; -u8* internalRAM = 0; -u8* workRAM = 0; -u8* paletteRAM = 0; -u8* vram = 0; -u8* pix = 0; -u8* oam = 0; -u8* ioMem = 0; +uint8_t* bios = 0; +uint8_t* rom = 0; +uint8_t* internalRAM = 0; +uint8_t* workRAM = 0; +uint8_t* paletteRAM = 0; +uint8_t* vram = 0; +uint8_t* pix = 0; +uint8_t* oam = 0; +uint8_t* ioMem = 0; -u16 DISPCNT = 0x0080; -u16 DISPSTAT = 0x0000; -u16 VCOUNT = 0x0000; -u16 BG0CNT = 0x0000; -u16 BG1CNT = 0x0000; -u16 BG2CNT = 0x0000; -u16 BG3CNT = 0x0000; -u16 BG0HOFS = 0x0000; -u16 BG0VOFS = 0x0000; -u16 BG1HOFS = 0x0000; -u16 BG1VOFS = 0x0000; -u16 BG2HOFS = 0x0000; -u16 BG2VOFS = 0x0000; -u16 BG3HOFS = 0x0000; -u16 BG3VOFS = 0x0000; -u16 BG2PA = 0x0100; -u16 BG2PB = 0x0000; -u16 BG2PC = 0x0000; -u16 BG2PD = 0x0100; -u16 BG2X_L = 0x0000; -u16 BG2X_H = 0x0000; -u16 BG2Y_L = 0x0000; -u16 BG2Y_H = 0x0000; -u16 BG3PA = 0x0100; -u16 BG3PB = 0x0000; -u16 BG3PC = 0x0000; -u16 BG3PD = 0x0100; -u16 BG3X_L = 0x0000; -u16 BG3X_H = 0x0000; -u16 BG3Y_L = 0x0000; -u16 BG3Y_H = 0x0000; -u16 WIN0H = 0x0000; -u16 WIN1H = 0x0000; -u16 WIN0V = 0x0000; -u16 WIN1V = 0x0000; -u16 WININ = 0x0000; -u16 WINOUT = 0x0000; -u16 MOSAIC = 0x0000; -u16 BLDMOD = 0x0000; -u16 COLEV = 0x0000; -u16 COLY = 0x0000; -u16 DM0SAD_L = 0x0000; -u16 DM0SAD_H = 0x0000; -u16 DM0DAD_L = 0x0000; -u16 DM0DAD_H = 0x0000; -u16 DM0CNT_L = 0x0000; -u16 DM0CNT_H = 0x0000; -u16 DM1SAD_L = 0x0000; -u16 DM1SAD_H = 0x0000; -u16 DM1DAD_L = 0x0000; -u16 DM1DAD_H = 0x0000; -u16 DM1CNT_L = 0x0000; -u16 DM1CNT_H = 0x0000; -u16 DM2SAD_L = 0x0000; -u16 DM2SAD_H = 0x0000; -u16 DM2DAD_L = 0x0000; -u16 DM2DAD_H = 0x0000; -u16 DM2CNT_L = 0x0000; -u16 DM2CNT_H = 0x0000; -u16 DM3SAD_L = 0x0000; -u16 DM3SAD_H = 0x0000; -u16 DM3DAD_L = 0x0000; -u16 DM3DAD_H = 0x0000; -u16 DM3CNT_L = 0x0000; -u16 DM3CNT_H = 0x0000; -u16 TM0D = 0x0000; -u16 TM0CNT = 0x0000; -u16 TM1D = 0x0000; -u16 TM1CNT = 0x0000; -u16 TM2D = 0x0000; -u16 TM2CNT = 0x0000; -u16 TM3D = 0x0000; -u16 TM3CNT = 0x0000; -u16 P1 = 0xFFFF; -u16 IE = 0x0000; -u16 IF = 0x0000; -u16 IME = 0x0000; +uint16_t DISPCNT = 0x0080; +uint16_t DISPSTAT = 0x0000; +uint16_t VCOUNT = 0x0000; +uint16_t BG0CNT = 0x0000; +uint16_t BG1CNT = 0x0000; +uint16_t BG2CNT = 0x0000; +uint16_t BG3CNT = 0x0000; +uint16_t BG0HOFS = 0x0000; +uint16_t BG0VOFS = 0x0000; +uint16_t BG1HOFS = 0x0000; +uint16_t BG1VOFS = 0x0000; +uint16_t BG2HOFS = 0x0000; +uint16_t BG2VOFS = 0x0000; +uint16_t BG3HOFS = 0x0000; +uint16_t BG3VOFS = 0x0000; +uint16_t BG2PA = 0x0100; +uint16_t BG2PB = 0x0000; +uint16_t BG2PC = 0x0000; +uint16_t BG2PD = 0x0100; +uint16_t BG2X_L = 0x0000; +uint16_t BG2X_H = 0x0000; +uint16_t BG2Y_L = 0x0000; +uint16_t BG2Y_H = 0x0000; +uint16_t BG3PA = 0x0100; +uint16_t BG3PB = 0x0000; +uint16_t BG3PC = 0x0000; +uint16_t BG3PD = 0x0100; +uint16_t BG3X_L = 0x0000; +uint16_t BG3X_H = 0x0000; +uint16_t BG3Y_L = 0x0000; +uint16_t BG3Y_H = 0x0000; +uint16_t WIN0H = 0x0000; +uint16_t WIN1H = 0x0000; +uint16_t WIN0V = 0x0000; +uint16_t WIN1V = 0x0000; +uint16_t WININ = 0x0000; +uint16_t WINOUT = 0x0000; +uint16_t MOSAIC = 0x0000; +uint16_t BLDMOD = 0x0000; +uint16_t COLEV = 0x0000; +uint16_t COLY = 0x0000; +uint16_t DM0SAD_L = 0x0000; +uint16_t DM0SAD_H = 0x0000; +uint16_t DM0DAD_L = 0x0000; +uint16_t DM0DAD_H = 0x0000; +uint16_t DM0CNT_L = 0x0000; +uint16_t DM0CNT_H = 0x0000; +uint16_t DM1SAD_L = 0x0000; +uint16_t DM1SAD_H = 0x0000; +uint16_t DM1DAD_L = 0x0000; +uint16_t DM1DAD_H = 0x0000; +uint16_t DM1CNT_L = 0x0000; +uint16_t DM1CNT_H = 0x0000; +uint16_t DM2SAD_L = 0x0000; +uint16_t DM2SAD_H = 0x0000; +uint16_t DM2DAD_L = 0x0000; +uint16_t DM2DAD_H = 0x0000; +uint16_t DM2CNT_L = 0x0000; +uint16_t DM2CNT_H = 0x0000; +uint16_t DM3SAD_L = 0x0000; +uint16_t DM3SAD_H = 0x0000; +uint16_t DM3DAD_L = 0x0000; +uint16_t DM3DAD_H = 0x0000; +uint16_t DM3CNT_L = 0x0000; +uint16_t DM3CNT_H = 0x0000; +uint16_t TM0D = 0x0000; +uint16_t TM0CNT = 0x0000; +uint16_t TM1D = 0x0000; +uint16_t TM1CNT = 0x0000; +uint16_t TM2D = 0x0000; +uint16_t TM2CNT = 0x0000; +uint16_t TM3D = 0x0000; +uint16_t TM3CNT = 0x0000; +uint16_t P1 = 0xFFFF; +uint16_t IE = 0x0000; +uint16_t IF = 0x0000; +uint16_t IME = 0x0000; diff --git a/src/gba/Globals.h b/src/gba/Globals.h index a8975b27..0759329c 100644 --- a/src/gba/Globals.h +++ b/src/gba/Globals.h @@ -1,7 +1,6 @@ #ifndef GLOBALS_H #define GLOBALS_H -#include "../common/Types.h" #include "GBA.h" #define VERBOSE_SWI 1 @@ -24,9 +23,9 @@ extern bool Z_FLAG; extern bool V_FLAG; extern bool armState; extern bool armIrqEnable; -extern u32 armNextPC; +extern uint32_t armNextPC; extern int armMode; -extern u32 stop; +extern uint32_t stop; extern int saveType; extern int frameSkip; extern bool gba_joybus_enabled; @@ -36,92 +35,92 @@ extern int layerEnable; extern int cpuSaveType; extern int customBackdropColor; -extern u8* bios; -extern u8* rom; -extern u8* internalRAM; -extern u8* workRAM; -extern u8* paletteRAM; -extern u8* vram; -extern u8* pix; -extern u8* oam; -extern u8* ioMem; +extern uint8_t* bios; +extern uint8_t* rom; +extern uint8_t* internalRAM; +extern uint8_t* workRAM; +extern uint8_t* paletteRAM; +extern uint8_t* vram; +extern uint8_t* pix; +extern uint8_t* oam; +extern uint8_t* ioMem; -extern u16 DISPCNT; -extern u16 DISPSTAT; -extern u16 VCOUNT; -extern u16 BG0CNT; -extern u16 BG1CNT; -extern u16 BG2CNT; -extern u16 BG3CNT; -extern u16 BG0HOFS; -extern u16 BG0VOFS; -extern u16 BG1HOFS; -extern u16 BG1VOFS; -extern u16 BG2HOFS; -extern u16 BG2VOFS; -extern u16 BG3HOFS; -extern u16 BG3VOFS; -extern u16 BG2PA; -extern u16 BG2PB; -extern u16 BG2PC; -extern u16 BG2PD; -extern u16 BG2X_L; -extern u16 BG2X_H; -extern u16 BG2Y_L; -extern u16 BG2Y_H; -extern u16 BG3PA; -extern u16 BG3PB; -extern u16 BG3PC; -extern u16 BG3PD; -extern u16 BG3X_L; -extern u16 BG3X_H; -extern u16 BG3Y_L; -extern u16 BG3Y_H; -extern u16 WIN0H; -extern u16 WIN1H; -extern u16 WIN0V; -extern u16 WIN1V; -extern u16 WININ; -extern u16 WINOUT; -extern u16 MOSAIC; -extern u16 BLDMOD; -extern u16 COLEV; -extern u16 COLY; -extern u16 DM0SAD_L; -extern u16 DM0SAD_H; -extern u16 DM0DAD_L; -extern u16 DM0DAD_H; -extern u16 DM0CNT_L; -extern u16 DM0CNT_H; -extern u16 DM1SAD_L; -extern u16 DM1SAD_H; -extern u16 DM1DAD_L; -extern u16 DM1DAD_H; -extern u16 DM1CNT_L; -extern u16 DM1CNT_H; -extern u16 DM2SAD_L; -extern u16 DM2SAD_H; -extern u16 DM2DAD_L; -extern u16 DM2DAD_H; -extern u16 DM2CNT_L; -extern u16 DM2CNT_H; -extern u16 DM3SAD_L; -extern u16 DM3SAD_H; -extern u16 DM3DAD_L; -extern u16 DM3DAD_H; -extern u16 DM3CNT_L; -extern u16 DM3CNT_H; -extern u16 TM0D; -extern u16 TM0CNT; -extern u16 TM1D; -extern u16 TM1CNT; -extern u16 TM2D; -extern u16 TM2CNT; -extern u16 TM3D; -extern u16 TM3CNT; -extern u16 P1; -extern u16 IE; -extern u16 IF; -extern u16 IME; +extern uint16_t DISPCNT; +extern uint16_t DISPSTAT; +extern uint16_t VCOUNT; +extern uint16_t BG0CNT; +extern uint16_t BG1CNT; +extern uint16_t BG2CNT; +extern uint16_t BG3CNT; +extern uint16_t BG0HOFS; +extern uint16_t BG0VOFS; +extern uint16_t BG1HOFS; +extern uint16_t BG1VOFS; +extern uint16_t BG2HOFS; +extern uint16_t BG2VOFS; +extern uint16_t BG3HOFS; +extern uint16_t BG3VOFS; +extern uint16_t BG2PA; +extern uint16_t BG2PB; +extern uint16_t BG2PC; +extern uint16_t BG2PD; +extern uint16_t BG2X_L; +extern uint16_t BG2X_H; +extern uint16_t BG2Y_L; +extern uint16_t BG2Y_H; +extern uint16_t BG3PA; +extern uint16_t BG3PB; +extern uint16_t BG3PC; +extern uint16_t BG3PD; +extern uint16_t BG3X_L; +extern uint16_t BG3X_H; +extern uint16_t BG3Y_L; +extern uint16_t BG3Y_H; +extern uint16_t WIN0H; +extern uint16_t WIN1H; +extern uint16_t WIN0V; +extern uint16_t WIN1V; +extern uint16_t WININ; +extern uint16_t WINOUT; +extern uint16_t MOSAIC; +extern uint16_t BLDMOD; +extern uint16_t COLEV; +extern uint16_t COLY; +extern uint16_t DM0SAD_L; +extern uint16_t DM0SAD_H; +extern uint16_t DM0DAD_L; +extern uint16_t DM0DAD_H; +extern uint16_t DM0CNT_L; +extern uint16_t DM0CNT_H; +extern uint16_t DM1SAD_L; +extern uint16_t DM1SAD_H; +extern uint16_t DM1DAD_L; +extern uint16_t DM1DAD_H; +extern uint16_t DM1CNT_L; +extern uint16_t DM1CNT_H; +extern uint16_t DM2SAD_L; +extern uint16_t DM2SAD_H; +extern uint16_t DM2DAD_L; +extern uint16_t DM2DAD_H; +extern uint16_t DM2CNT_L; +extern uint16_t DM2CNT_H; +extern uint16_t DM3SAD_L; +extern uint16_t DM3SAD_H; +extern uint16_t DM3DAD_L; +extern uint16_t DM3DAD_H; +extern uint16_t DM3CNT_L; +extern uint16_t DM3CNT_H; +extern uint16_t TM0D; +extern uint16_t TM0CNT; +extern uint16_t TM1D; +extern uint16_t TM1CNT; +extern uint16_t TM2D; +extern uint16_t TM2CNT; +extern uint16_t TM3D; +extern uint16_t TM3CNT; +extern uint16_t P1; +extern uint16_t IE; +extern uint16_t IF; +extern uint16_t IME; #endif // GLOBALS_H diff --git a/src/gba/Mode0.cpp b/src/gba/Mode0.cpp index b4afe2b4..a0cdbd0e 100644 --- a/src/gba/Mode0.cpp +++ b/src/gba/Mode0.cpp @@ -4,7 +4,7 @@ void mode0RenderLine() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -31,7 +31,7 @@ void mode0RenderLine() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -39,55 +39,55 @@ void mode0RenderLine() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; if (line0[x] < color) { color = line0[x]; top = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24)) { color = line1[x]; top = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) { color = line2[x]; top = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24)) { color = line3[x]; top = 0x08; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } if ((top & 0x10) && (color & 0x00010000)) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((u8)(line0[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { back = line0[x]; top2 = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { back = line1[x]; top2 = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { back = line2[x]; top2 = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { back = line3[x]; top2 = 0x08; } @@ -116,7 +116,7 @@ void mode0RenderLine() void mode0RenderLineNoWindow() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -143,7 +143,7 @@ void mode0RenderLineNoWindow() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -153,8 +153,8 @@ void mode0RenderLineNoWindow() int effect = (BLDMOD >> 6) & 3; for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; if (line0[x] < color) { color = line0[x]; @@ -187,8 +187,8 @@ void mode0RenderLineNoWindow() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if (line0[x] < back) { if (top != 0x01) { back = line0[x]; @@ -241,8 +241,8 @@ void mode0RenderLineNoWindow() } } else { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if (line0[x] < back) { back = line0[x]; @@ -288,7 +288,7 @@ void mode0RenderLineNoWindow() void mode0RenderLineAll() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -301,8 +301,8 @@ void mode0RenderLineAll() bool inWindow1 = false; if (layerEnable & 0x2000) { - u8 v0 = WIN0V >> 8; - u8 v1 = WIN0V & 255; + uint8_t v0 = WIN0V >> 8; + uint8_t v1 = WIN0V & 255; inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -310,8 +310,8 @@ void mode0RenderLineAll() inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); } if (layerEnable & 0x4000) { - u8 v0 = WIN1V >> 8; - u8 v1 = WIN1V & 255; + uint8_t v0 = WIN1V >> 8; + uint8_t v1 = WIN1V & 255; inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -338,21 +338,21 @@ void mode0RenderLineAll() gfxDrawSprites(lineOBJ); gfxDrawOBJWin(lineOBJWin); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000); } - u8 inWin0Mask = WININ & 0xFF; - u8 inWin1Mask = WININ >> 8; - u8 outMask = WINOUT & 0xFF; + uint8_t inWin0Mask = WININ & 0xFF; + uint8_t inWin1Mask = WININ >> 8; + uint8_t outMask = WINOUT & 0xFF; for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; - u8 mask = outMask; + uint32_t color = backdrop; + uint8_t top = 0x20; + uint8_t mask = outMask; if (!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -374,47 +374,47 @@ void mode0RenderLineAll() top = 0x01; } - if ((mask & 2) && ((u8)(line1[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 2) && ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24))) { color = line1[x]; top = 0x02; } - if ((mask & 4) && ((u8)(line2[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 4) && ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24))) { color = line2[x]; top = 0x04; } - if ((mask & 8) && ((u8)(line3[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 8) && ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24))) { color = line3[x]; top = 0x08; } - if ((mask & 16) && ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) { color = lineOBJ[x]; top = 0x10; } if (color & 0x00010000) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((mask & 1) && ((u8)(line0[x] >> 24) < (u8)(back >> 24))) { + if ((mask & 1) && ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24))) { back = line0[x]; top2 = 0x01; } - if ((mask & 2) && ((u8)(line1[x] >> 24) < (u8)(back >> 24))) { + if ((mask & 2) && ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24))) { back = line1[x]; top2 = 0x02; } - if ((mask & 4) && ((u8)(line2[x] >> 24) < (u8)(back >> 24))) { + if ((mask & 4) && ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24))) { back = line2[x]; top2 = 0x04; } - if ((mask & 8) && ((u8)(line3[x] >> 24) < (u8)(back >> 24))) { + if ((mask & 8) && ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24))) { back = line3[x]; top2 = 0x08; } @@ -442,37 +442,37 @@ void mode0RenderLineAll() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; - if ((mask & 1) && (u8)(line0[x] >> 24) < (u8)(back >> 24)) { + uint32_t back = backdrop; + uint8_t top2 = 0x20; + if ((mask & 1) && (uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x01) { back = line0[x]; top2 = 0x01; } } - if ((mask & 2) && (u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 2) && (uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x02) { back = line1[x]; top2 = 0x02; } } - if ((mask & 4) && (u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 4) && (uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x04) { back = line2[x]; top2 = 0x04; } } - if ((mask & 8) && (u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 8) && (uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x08) { back = line3[x]; top2 = 0x08; } } - if ((mask & 16) && (u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; diff --git a/src/gba/Mode1.cpp b/src/gba/Mode1.cpp index 0867f40a..8710ce73 100644 --- a/src/gba/Mode1.cpp +++ b/src/gba/Mode1.cpp @@ -4,7 +4,7 @@ void mode1RenderLine() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -33,7 +33,7 @@ void mode1RenderLine() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -41,45 +41,45 @@ void mode1RenderLine() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; if (line0[x] < color) { color = line0[x]; top = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24)) { color = line1[x]; top = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } if ((top & 0x10) && (color & 0x00010000)) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((u8)(line0[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { back = line0[x]; top2 = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { back = line1[x]; top2 = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { back = line2[x]; top2 = 0x04; } @@ -110,7 +110,7 @@ void mode1RenderLine() void mode1RenderLineNoWindow() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -139,7 +139,7 @@ void mode1RenderLineNoWindow() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -147,25 +147,25 @@ void mode1RenderLineNoWindow() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; if (line0[x] < color) { color = line0[x]; top = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24)) { color = line1[x]; top = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } @@ -176,30 +176,30 @@ void mode1RenderLineNoWindow() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; - if ((u8)(line0[x] >> 24) < (u8)(back >> 24)) { + uint32_t back = backdrop; + uint8_t top2 = 0x20; + if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x01) { back = line0[x]; top2 = 0x01; } } - if ((u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x02) { back = line1[x]; top2 = 0x02; } } - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x04) { back = line2[x]; top2 = 0x04; } } - if ((u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; @@ -223,20 +223,20 @@ void mode1RenderLineNoWindow() } } else { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((u8)(line0[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { back = line0[x]; top2 = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { back = line1[x]; top2 = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { back = line2[x]; top2 = 0x04; } @@ -267,7 +267,7 @@ void mode1RenderLineNoWindow() void mode1RenderLineAll() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -281,8 +281,8 @@ void mode1RenderLineAll() bool inWindow1 = false; if (layerEnable & 0x2000) { - u8 v0 = WIN0V >> 8; - u8 v1 = WIN0V & 255; + uint8_t v0 = WIN0V >> 8; + uint8_t v1 = WIN0V & 255; inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -290,8 +290,8 @@ void mode1RenderLineAll() inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); } if (layerEnable & 0x4000) { - u8 v0 = WIN1V >> 8; - u8 v1 = WIN1V & 255; + uint8_t v0 = WIN1V >> 8; + uint8_t v1 = WIN1V & 255; inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -319,21 +319,21 @@ void mode1RenderLineAll() gfxDrawSprites(lineOBJ); gfxDrawOBJWin(lineOBJWin); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000); } - u8 inWin0Mask = WININ & 0xFF; - u8 inWin1Mask = WININ >> 8; - u8 outMask = WINOUT & 0xFF; + uint8_t inWin0Mask = WININ & 0xFF; + uint8_t inWin1Mask = WININ >> 8; + uint8_t outMask = WINOUT & 0xFF; for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; - u8 mask = outMask; + uint32_t color = backdrop; + uint8_t top = 0x20; + uint8_t mask = outMask; if (!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -355,37 +355,37 @@ void mode1RenderLineAll() top = 0x01; } - if ((u8)(line1[x] >> 24) < (u8)(color >> 24) && (mask & 2)) { + if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24) && (mask & 2)) { color = line1[x]; top = 0x02; } - if ((u8)(line2[x] >> 24) < (u8)(color >> 24) && (mask & 4)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24) && (mask & 4)) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24) && (mask & 16)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24) && (mask & 16)) { color = lineOBJ[x]; top = 0x10; } if (color & 0x00010000) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((mask & 1) && (u8)(line0[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 1) && (uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { back = line0[x]; top2 = 0x01; } - if ((mask & 2) && (u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 2) && (uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { back = line1[x]; top2 = 0x02; } - if ((mask & 4) && (u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 4) && (uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { back = line2[x]; top2 = 0x04; } @@ -413,31 +413,31 @@ void mode1RenderLineAll() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((mask & 1) && (u8)(line0[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 1) && (uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x01) { back = line0[x]; top2 = 0x01; } } - if ((mask & 2) && (u8)(line1[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 2) && (uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x02) { back = line1[x]; top2 = 0x02; } } - if ((mask & 4) && (u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 4) && (uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x04) { back = line2[x]; top2 = 0x04; } } - if ((mask & 16) && (u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; diff --git a/src/gba/Mode2.cpp b/src/gba/Mode2.cpp index 8bd20a39..aede2990 100644 --- a/src/gba/Mode2.cpp +++ b/src/gba/Mode2.cpp @@ -4,7 +4,7 @@ void mode2RenderLine() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -36,7 +36,7 @@ void mode2RenderLine() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -44,35 +44,35 @@ void mode2RenderLine() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; - if ((u8)(line2[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) { color = line2[x]; top = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24)) { color = line3[x]; top = 0x08; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } if ((top & 0x10) && (color & 0x00010000)) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { back = line2[x]; top2 = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { back = line3[x]; top2 = 0x08; } @@ -104,7 +104,7 @@ void mode2RenderLine() void mode2RenderLineNoWindow() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -136,7 +136,7 @@ void mode2RenderLineNoWindow() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -144,20 +144,20 @@ void mode2RenderLineNoWindow() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; - if ((u8)(line2[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) { color = line2[x]; top = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24)) { color = line3[x]; top = 0x08; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } @@ -168,24 +168,24 @@ void mode2RenderLineNoWindow() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x04) { back = line2[x]; top2 = 0x04; } } - if ((u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x08) { back = line3[x]; top2 = 0x08; } } - if ((u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; @@ -209,15 +209,15 @@ void mode2RenderLineNoWindow() } } else { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; - if ((u8)(line2[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) { back = line2[x]; top2 = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { back = line3[x]; top2 = 0x08; } @@ -249,7 +249,7 @@ void mode2RenderLineNoWindow() void mode2RenderLineAll() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -263,8 +263,8 @@ void mode2RenderLineAll() bool inWindow1 = false; if (layerEnable & 0x2000) { - u8 v0 = WIN0V >> 8; - u8 v1 = WIN0V & 255; + uint8_t v0 = WIN0V >> 8; + uint8_t v1 = WIN0V & 255; inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -272,8 +272,8 @@ void mode2RenderLineAll() inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); } if (layerEnable & 0x4000) { - u8 v0 = WIN1V >> 8; - u8 v1 = WIN1V & 255; + uint8_t v0 = WIN1V >> 8; + uint8_t v1 = WIN1V & 255; inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -304,21 +304,21 @@ void mode2RenderLineAll() gfxDrawSprites(lineOBJ); gfxDrawOBJWin(lineOBJWin); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000); } - u8 inWin0Mask = WININ & 0xFF; - u8 inWin1Mask = WININ >> 8; - u8 outMask = WINOUT & 0xFF; + uint8_t inWin0Mask = WININ & 0xFF; + uint8_t inWin1Mask = WININ >> 8; + uint8_t outMask = WINOUT & 0xFF; for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; - u8 mask = outMask; + uint32_t color = backdrop; + uint8_t top = 0x20; + uint8_t mask = outMask; if (!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -340,27 +340,27 @@ void mode2RenderLineAll() top = 0x04; } - if ((u8)(line3[x] >> 24) < (u8)(color >> 24) && (mask & 8)) { + if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24) && (mask & 8)) { color = line3[x]; top = 0x08; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24) && (mask & 16)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24) && (mask & 16)) { color = lineOBJ[x]; top = 0x10; } if (color & 0x00010000) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { back = line2[x]; top2 = 0x04; } - if ((mask & 8) && (u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 8) && (uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { back = line3[x]; top2 = 0x08; } @@ -388,8 +388,8 @@ void mode2RenderLineAll() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { if (top != 0x04) { @@ -398,14 +398,14 @@ void mode2RenderLineAll() } } - if ((mask & 8) && (u8)(line3[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 8) && (uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x08) { back = line3[x]; top2 = 0x08; } } - if ((mask & 16) && (u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; diff --git a/src/gba/Mode3.cpp b/src/gba/Mode3.cpp index 9814ab21..1bc49cb5 100644 --- a/src/gba/Mode3.cpp +++ b/src/gba/Mode3.cpp @@ -4,7 +4,7 @@ void mode3RenderLine() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -29,7 +29,7 @@ void mode3RenderLine() gfxDrawSprites(lineOBJ); - u32 background; + uint32_t background; if (customBackdropColor == -1) { background = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -37,23 +37,23 @@ void mode3RenderLine() } for (int x = 0; x < 240; x++) { - u32 color = background; - u8 top = 0x20; + uint32_t color = background; + uint8_t top = 0x20; if (line2[x] < color) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } if ((top & 0x10) && (color & 0x00010000)) { // semi-transparent OBJ - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if (line2[x] < back) { back = line2[x]; @@ -86,7 +86,7 @@ void mode3RenderLine() void mode3RenderLineNoWindow() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -111,7 +111,7 @@ void mode3RenderLineNoWindow() gfxDrawSprites(lineOBJ); - u32 background; + uint32_t background; if (customBackdropColor == -1) { background = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -119,15 +119,15 @@ void mode3RenderLineNoWindow() } for (int x = 0; x < 240; x++) { - u32 color = background; - u8 top = 0x20; + uint32_t color = background; + uint8_t top = 0x20; if (line2[x] < color) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } @@ -138,8 +138,8 @@ void mode3RenderLineNoWindow() break; case 1: { if (top & BLDMOD) { - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if (line2[x] < back) { if (top != 0x04) { @@ -148,7 +148,7 @@ void mode3RenderLineNoWindow() } } - if ((u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; @@ -172,8 +172,8 @@ void mode3RenderLineNoWindow() } } else { // semi-transparent OBJ - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if (line2[x] < back) { back = line2[x]; @@ -206,7 +206,7 @@ void mode3RenderLineNoWindow() void mode3RenderLineAll() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x80) { for (int x = 0; x < 240; x++) { @@ -220,8 +220,8 @@ void mode3RenderLineAll() bool inWindow1 = false; if (layerEnable & 0x2000) { - u8 v0 = WIN0V >> 8; - u8 v1 = WIN0V & 255; + uint8_t v0 = WIN0V >> 8; + uint8_t v1 = WIN0V & 255; inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -229,8 +229,8 @@ void mode3RenderLineAll() inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); } if (layerEnable & 0x4000) { - u8 v0 = WIN1V >> 8; - u8 v1 = WIN1V & 255; + uint8_t v0 = WIN1V >> 8; + uint8_t v1 = WIN1V & 255; inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -254,11 +254,11 @@ void mode3RenderLineAll() gfxDrawSprites(lineOBJ); gfxDrawOBJWin(lineOBJWin); - u8 inWin0Mask = WININ & 0xFF; - u8 inWin1Mask = WININ >> 8; - u8 outMask = WINOUT & 0xFF; + uint8_t inWin0Mask = WININ & 0xFF; + uint8_t inWin1Mask = WININ >> 8; + uint8_t outMask = WINOUT & 0xFF; - u32 background; + uint32_t background; if (customBackdropColor == -1) { background = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -266,9 +266,9 @@ void mode3RenderLineAll() } for (int x = 0; x < 240; x++) { - u32 color = background; - u8 top = 0x20; - u8 mask = outMask; + uint32_t color = background; + uint8_t top = 0x20; + uint8_t mask = outMask; if (!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -290,15 +290,15 @@ void mode3RenderLineAll() top = 0x04; } - if ((mask & 16) && ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) { color = lineOBJ[x]; top = 0x10; } if (color & 0x00010000) { // semi-transparent OBJ - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { back = line2[x]; @@ -327,8 +327,8 @@ void mode3RenderLineAll() break; case 1: { if (top & BLDMOD) { - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { if (top != 0x04) { @@ -337,7 +337,7 @@ void mode3RenderLineAll() } } - if ((mask & 16) && (u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; diff --git a/src/gba/Mode4.cpp b/src/gba/Mode4.cpp index e47c9cac..25b2249e 100644 --- a/src/gba/Mode4.cpp +++ b/src/gba/Mode4.cpp @@ -4,7 +4,7 @@ void mode4RenderLine() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x0080) { for (int x = 0; x < 240; x++) { @@ -28,7 +28,7 @@ void mode4RenderLine() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -36,23 +36,23 @@ void mode4RenderLine() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; if (line2[x] < color) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } if ((top & 0x10) && (color & 0x00010000)) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if (line2[x] < back) { back = line2[x]; @@ -85,7 +85,7 @@ void mode4RenderLine() void mode4RenderLineNoWindow() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x0080) { for (int x = 0; x < 240; x++) { @@ -109,7 +109,7 @@ void mode4RenderLineNoWindow() gfxDrawSprites(lineOBJ); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -117,15 +117,15 @@ void mode4RenderLineNoWindow() } for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; + uint32_t color = backdrop; + uint8_t top = 0x20; if (line2[x] < color) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } @@ -136,8 +136,8 @@ void mode4RenderLineNoWindow() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if (line2[x] < back) { if (top != 0x04) { @@ -146,7 +146,7 @@ void mode4RenderLineNoWindow() } } - if ((u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; @@ -170,8 +170,8 @@ void mode4RenderLineNoWindow() } } else { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if (line2[x] < back) { back = line2[x]; @@ -204,7 +204,7 @@ void mode4RenderLineNoWindow() void mode4RenderLineAll() { - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (DISPCNT & 0x0080) { for (int x = 0; x < 240; x++) { @@ -218,8 +218,8 @@ void mode4RenderLineAll() bool inWindow1 = false; if (layerEnable & 0x2000) { - u8 v0 = WIN0V >> 8; - u8 v1 = WIN0V & 255; + uint8_t v0 = WIN0V >> 8; + uint8_t v1 = WIN0V & 255; inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -227,8 +227,8 @@ void mode4RenderLineAll() inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); } if (layerEnable & 0x4000) { - u8 v0 = WIN1V >> 8; - u8 v1 = WIN1V & 255; + uint8_t v0 = WIN1V >> 8; + uint8_t v1 = WIN1V & 255; inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -251,21 +251,21 @@ void mode4RenderLineAll() gfxDrawSprites(lineOBJ); gfxDrawOBJWin(lineOBJWin); - u32 backdrop; + uint32_t backdrop; if (customBackdropColor == -1) { backdrop = (READ16LE(&palette[0]) | 0x30000000); } else { backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000); } - u8 inWin0Mask = WININ & 0xFF; - u8 inWin1Mask = WININ >> 8; - u8 outMask = WINOUT & 0xFF; + uint8_t inWin0Mask = WININ & 0xFF; + uint8_t inWin1Mask = WININ >> 8; + uint8_t outMask = WINOUT & 0xFF; for (int x = 0; x < 240; x++) { - u32 color = backdrop; - u8 top = 0x20; - u8 mask = outMask; + uint32_t color = backdrop; + uint8_t top = 0x20; + uint8_t mask = outMask; if (!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -287,15 +287,15 @@ void mode4RenderLineAll() top = 0x04; } - if ((mask & 16) && ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) { color = lineOBJ[x]; top = 0x10; } if (color & 0x00010000) { // semi-transparent OBJ - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { back = line2[x]; @@ -324,8 +324,8 @@ void mode4RenderLineAll() break; case 1: { if (top & BLDMOD) { - u32 back = backdrop; - u8 top2 = 0x20; + uint32_t back = backdrop; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { if (top != 0x04) { @@ -334,7 +334,7 @@ void mode4RenderLineAll() } } - if ((mask & 16) && (u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; diff --git a/src/gba/Mode5.cpp b/src/gba/Mode5.cpp index e491f6fe..857c95ad 100644 --- a/src/gba/Mode5.cpp +++ b/src/gba/Mode5.cpp @@ -12,7 +12,7 @@ void mode5RenderLine() return; } - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (layerEnable & 0x0400) { int changed = gfxBG2Changed; @@ -29,7 +29,7 @@ void mode5RenderLine() gfxDrawSprites(lineOBJ); - u32 background; + uint32_t background; if (customBackdropColor == -1) { background = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -37,23 +37,23 @@ void mode5RenderLine() } for (int x = 0; x < 240; x++) { - u32 color = background; - u8 top = 0x20; + uint32_t color = background; + uint8_t top = 0x20; if (line2[x] < color) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } if ((top & 0x10) && (color & 0x00010000)) { // semi-transparent OBJ - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if (line2[x] < back) { back = line2[x]; @@ -94,7 +94,7 @@ void mode5RenderLineNoWindow() return; } - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (layerEnable & 0x0400) { int changed = gfxBG2Changed; @@ -111,7 +111,7 @@ void mode5RenderLineNoWindow() gfxDrawSprites(lineOBJ); - u32 background; + uint32_t background; if (customBackdropColor == -1) { background = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -119,15 +119,15 @@ void mode5RenderLineNoWindow() } for (int x = 0; x < 240; x++) { - u32 color = background; - u8 top = 0x20; + uint32_t color = background; + uint8_t top = 0x20; if (line2[x] < color) { color = line2[x]; top = 0x04; } - if ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) { color = lineOBJ[x]; top = 0x10; } @@ -138,8 +138,8 @@ void mode5RenderLineNoWindow() break; case 1: { if (top & BLDMOD) { - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if (line2[x] < back) { if (top != 0x04) { @@ -148,7 +148,7 @@ void mode5RenderLineNoWindow() } } - if ((u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; @@ -172,8 +172,8 @@ void mode5RenderLineNoWindow() } } else { // semi-transparent OBJ - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if (line2[x] < back) { back = line2[x]; @@ -214,7 +214,7 @@ void mode5RenderLineAll() return; } - u16* palette = (u16*)paletteRAM; + uint16_t* palette = (uint16_t*)paletteRAM; if (layerEnable & 0x0400) { int changed = gfxBG2Changed; @@ -236,8 +236,8 @@ void mode5RenderLineAll() bool inWindow1 = false; if (layerEnable & 0x2000) { - u8 v0 = WIN0V >> 8; - u8 v1 = WIN0V & 255; + uint8_t v0 = WIN0V >> 8; + uint8_t v1 = WIN0V & 255; inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -245,8 +245,8 @@ void mode5RenderLineAll() inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); } if (layerEnable & 0x4000) { - u8 v0 = WIN1V >> 8; - u8 v1 = WIN1V & 255; + uint8_t v0 = WIN1V >> 8; + uint8_t v1 = WIN1V & 255; inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); if (v1 >= v0) inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); @@ -254,11 +254,11 @@ void mode5RenderLineAll() inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); } - u8 inWin0Mask = WININ & 0xFF; - u8 inWin1Mask = WININ >> 8; - u8 outMask = WINOUT & 0xFF; + uint8_t inWin0Mask = WININ & 0xFF; + uint8_t inWin1Mask = WININ >> 8; + uint8_t outMask = WINOUT & 0xFF; - u32 background; + uint32_t background; if (customBackdropColor == -1) { background = (READ16LE(&palette[0]) | 0x30000000); } else { @@ -266,9 +266,9 @@ void mode5RenderLineAll() } for (int x = 0; x < 240; x++) { - u32 color = background; - u8 top = 0x20; - u8 mask = outMask; + uint32_t color = background; + uint8_t top = 0x20; + uint8_t mask = outMask; if (!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -290,15 +290,15 @@ void mode5RenderLineAll() top = 0x04; } - if ((mask & 16) && ((u8)(lineOBJ[x] >> 24) < (u8)(color >> 24))) { + if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) { color = lineOBJ[x]; top = 0x10; } if (color & 0x00010000) { // semi-transparent OBJ - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { back = line2[x]; @@ -327,8 +327,8 @@ void mode5RenderLineAll() break; case 1: { if (top & BLDMOD) { - u32 back = background; - u8 top2 = 0x20; + uint32_t back = background; + uint8_t top2 = 0x20; if ((mask & 4) && line2[x] < back) { if (top != 0x04) { @@ -337,7 +337,7 @@ void mode5RenderLineAll() } } - if ((mask & 16) && (u8)(lineOBJ[x] >> 24) < (u8)(back >> 24)) { + if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) { if (top != 0x10) { back = lineOBJ[x]; top2 = 0x10; diff --git a/src/gba/RTC.cpp b/src/gba/RTC.cpp index bfbffae5..bcc64e4e 100644 --- a/src/gba/RTC.cpp +++ b/src/gba/RTC.cpp @@ -18,18 +18,18 @@ enum RTCSTATE { typedef struct { - u8 byte0; - u8 select; - u8 enable; - u8 command; + uint8_t byte0; + uint8_t select; + uint8_t enable; + uint8_t command; int dataLen; int bits; RTCSTATE state; - u8 data[12]; + uint8_t data[12]; // reserved variables for future - u8 reserved[12]; + uint8_t reserved[12]; bool reserved2; - u32 reserved3; + uint32_t reserved3; } RTCCLOCKDATA; struct tm gba_time; @@ -37,7 +37,7 @@ static RTCCLOCKDATA rtcClockData; static bool rtcClockEnabled = true; static bool rtcRumbleEnabled = false; -u32 countTicks = 0; +uint32_t countTicks = 0; void rtcEnable(bool e) { @@ -54,7 +54,7 @@ void rtcEnableRumble(bool e) rtcRumbleEnabled = e; } -u16 rtcRead(u32 address) +uint16_t rtcRead(uint32_t address) { int res = 0; @@ -81,7 +81,7 @@ u16 rtcRead(u32 address) // WarioWare Twisted Tilt Sensor if (rtcClockData.select == 0x0b) { - u16 v = systemGetSensorZ(); + uint16_t v = systemGetSensorZ(); v = 0x6C0 + v; res |= ((v >> rtcClockData.reserved[11]) & 1) << 2; } @@ -98,7 +98,7 @@ u16 rtcRead(u32 address) return READ16LE((&rom[address & 0x1FFFFFE])); } -static u8 toBCD(u8 value) +static uint8_t toBCD(uint8_t value) { value = value % 100; int l = value % 10; @@ -124,12 +124,12 @@ void rtcUpdateTime(int ticks) } } -bool rtcWrite(u32 address, u16 value) +bool rtcWrite(uint32_t address, uint16_t value) { if (address == 0x80000c8) { - rtcClockData.enable = (u8)value; // bit 0 = enable reading from 0x80000c4 c6 and c8 + rtcClockData.enable = (uint8_t)value; // bit 0 = enable reading from 0x80000c4 c6 and c8 } else if (address == 0x80000c6) { - rtcClockData.select = (u8)value; // 0=read/1=write (for each of 4 low bits) + rtcClockData.select = (uint8_t)value; // 0=read/1=write (for each of 4 low bits) // rumble is off when not writing to that pin if (rtcRumbleEnabled && !(value & 8)) @@ -183,7 +183,7 @@ bool rtcWrite(u32 address, u16 value) rtcClockData.command = 0; } else if (!(rtcClockData.byte0 & 1) && (value & 1)) // bit transfer { - rtcClockData.byte0 = (u8)value; + rtcClockData.byte0 = (uint8_t)value; switch (rtcClockData.state) { case COMMAND: @@ -283,7 +283,7 @@ bool rtcWrite(u32 address, u16 value) break; } } else - rtcClockData.byte0 = (u8)value; + rtcClockData.byte0 = (uint8_t)value; } } @@ -305,12 +305,12 @@ void rtcReset() } #ifdef __LIBRETRO__ -void rtcSaveGame(u8*& data) +void rtcSaveGame(uint8_t*& data) { utilWriteMem(data, &rtcClockData, sizeof(rtcClockData)); } -void rtcReadGame(const u8*& data) +void rtcReadGame(const uint8_t*& data) { utilReadMem(&rtcClockData, data, sizeof(rtcClockData)); } diff --git a/src/gba/RTC.h b/src/gba/RTC.h index 6fee9289..bba2fa48 100644 --- a/src/gba/RTC.h +++ b/src/gba/RTC.h @@ -1,17 +1,17 @@ #ifndef RTC_H #define RTC_H -u16 rtcRead(u32 address); +uint16_t rtcRead(uint32_t address); void rtcUpdateTime(int ticks); -bool rtcWrite(u32 address, u16 value); +bool rtcWrite(uint32_t address, uint16_t value); void rtcEnable(bool); void rtcEnableRumble(bool e); bool rtcIsEnabled(); void rtcReset(); #ifdef __LIBRETRO__ -void rtcReadGame(const u8*& data); -void rtcSaveGame(u8*& data); +void rtcReadGame(const uint8_t*& data); +void rtcSaveGame(uint8_t*& data); #else void rtcReadGame(gzFile gzFile); void rtcSaveGame(gzFile gzFile); diff --git a/src/gba/Sound.cpp b/src/gba/Sound.cpp index dfb3b3ab..7eaa5a6a 100644 --- a/src/gba/Sound.cpp +++ b/src/gba/Sound.cpp @@ -40,7 +40,7 @@ extern bool stopState; // TODO: silence sound when true int const SOUND_CLOCK_TICKS_ = 167772; // 1/100 second -static u16 soundFinalWave[1600]; +static uint16_t soundFinalWave[1600]; long soundSampleRate = 44100; bool soundInterpolation = true; bool soundPaused = true; @@ -82,7 +82,7 @@ public: int readIndex; int count; int writeIndex; - u8 fifo[32]; + uint8_t fifo[32]; int dac; private: @@ -155,7 +155,7 @@ void Gba_Pcm::update(int dac) if (output) { blip_time_t time = blip_time(); - dac = (s8)dac >> shift; + dac = (int8_t)dac >> shift; int delta = dac - last_amp; if (delta) { last_amp = dac; @@ -193,8 +193,8 @@ void Gba_Pcm_Fifo::timer_overflowed(int which_timer) // Not filled by DMA, so fill with 16 bytes of silence int reg = which ? FIFOB_L : FIFOA_L; for (int n = 8; n--;) { - soundEvent(reg, (u16)0); - soundEvent(reg + 2, (u16)0); + soundEvent(reg, (uint16_t)0); + soundEvent(reg + 2, (uint16_t)0); } } } @@ -256,7 +256,7 @@ static int gba_to_gb_sound(int addr) return 0; } -void soundEvent(u32 address, u8 data) +void soundEvent(uint32_t address, uint8_t data) { int gb_addr = gba_to_gb_sound(address); if (gb_addr) { @@ -294,7 +294,7 @@ static void write_SGCNT0_H(int data) apply_volume(true); } -void soundEvent(u32 address, u16 data) +void soundEvent(uint32_t address, uint16_t data) { switch (address) { case SGCNT0_H: @@ -319,8 +319,8 @@ void soundEvent(u32 address, u16 data) break; default: - soundEvent(address & ~1, (u8)(data)); // even - soundEvent(address | 1, (u8)(data >> 8)); // odd + soundEvent(address & ~1, (uint8_t)(data)); // even + soundEvent(address | 1, (uint8_t)(data >> 8)); // odd break; } } @@ -527,7 +527,7 @@ void soundReset() SOUND_CLOCK_TICKS = SOUND_CLOCK_TICKS_; soundTicks = SOUND_CLOCK_TICKS_; - soundEvent(NR52, (u8)0x80); + soundEvent(NR52, (uint8_t)0x80); } bool soundInit() @@ -586,7 +586,7 @@ static struct { gb_apu_state_t apu; // old state - u8 soundDSAValue; + uint8_t soundDSAValue; int soundDSBValue; } state; @@ -650,16 +650,16 @@ static variable_desc old_gba_state[] = { LOAD(int, pcm[0].readIndex), LOAD(int, pcm[0].count), LOAD(int, pcm[0].writeIndex), - SKIP(u8, soundDSAEnabled), // was bool, which was one byte on MS compiler + SKIP(uint8_t, soundDSAEnabled), // was bool, which was one byte on MS compiler SKIP(int, soundDSATimer), - LOAD(u8[32], pcm[0].fifo), - LOAD(u8, state.soundDSAValue), + LOAD(uint8_t[32], pcm[0].fifo), + LOAD(uint8_t, state.soundDSAValue), LOAD(int, pcm[1].readIndex), LOAD(int, pcm[1].count), LOAD(int, pcm[1].writeIndex), SKIP(int, soundDSBEnabled), SKIP(int, soundDSBTimer), - LOAD(u8[32], pcm[1].fifo), + LOAD(uint8_t[32], pcm[1].fifo), LOAD(int, state.soundDSBValue), // skipped manually @@ -669,7 +669,7 @@ static variable_desc old_gba_state[] = { }; variable_desc old_gba_state2[] = { - LOAD(u8[0x20], state.apu.regs[0x20]), + LOAD(uint8_t[0x20], state.apu.regs[0x20]), SKIP(int, sound3Bank), SKIP(int, sound3DataSize), SKIP(int, sound3ForcedOutput), @@ -682,7 +682,7 @@ static variable_desc gba_state[] = { LOAD(int, pcm[0].readIndex), LOAD(int, pcm[0].count), LOAD(int, pcm[0].writeIndex), - LOAD(u8[32], pcm[0].fifo), + LOAD(uint8_t[32], pcm[0].fifo), LOAD(int, pcm[0].dac), SKIP(int[4], room_for_expansion), @@ -690,13 +690,13 @@ static variable_desc gba_state[] = { LOAD(int, pcm[1].readIndex), LOAD(int, pcm[1].count), LOAD(int, pcm[1].writeIndex), - LOAD(u8[32], pcm[1].fifo), + LOAD(uint8_t[32], pcm[1].fifo), LOAD(int, pcm[1].dac), SKIP(int[4], room_for_expansion), // APU - LOAD(u8[0x40], state.apu.regs), // last values written to registers and wave RAM (both banks) + LOAD(uint8_t[0x40], state.apu.regs), // last values written to registers and wave RAM (both banks) LOAD(int, state.apu.frame_time), // clocks until next frame sequencer action LOAD(int, state.apu.frame_phase), // next step frame sequencer will run @@ -727,7 +727,7 @@ static variable_desc gba_state[] = { }; #ifdef __LIBRETRO__ -void soundSaveGame(u8*& out) +void soundSaveGame(uint8_t*& out) #else void soundSaveGame(gzFile out) #endif @@ -799,7 +799,7 @@ static void soundReadGameOld(gzFile in, int version) #include #ifdef __LIBRETRO__ -void soundReadGame(const u8*& in, int version) +void soundReadGame(const uint8_t*& in, int version) #else void soundReadGame(gzFile in, int version) #endif diff --git a/src/gba/Sound.h b/src/gba/Sound.h index e8d0bc37..8645140f 100644 --- a/src/gba/Sound.h +++ b/src/gba/Sound.h @@ -58,8 +58,8 @@ extern float soundFiltering; // 0.0 = none, 1.0 = max void soundReset(); // Emulates write to sound hardware -void soundEvent(u32 addr, u8 data); -void soundEvent(u32 addr, u16 data); // TODO: error-prone to overload like this +void soundEvent(uint32_t addr, uint8_t data); +void soundEvent(uint32_t addr, uint16_t data); // TODO: error-prone to overload like this // Notifies emulator that a timer has overflowed void soundTimerOverflow(int which); @@ -74,8 +74,8 @@ extern int soundTicks; // Number of 16.8 MHz clocks until soundTick() will be ca // Saves/loads emulator state #ifdef __LIBRETRO__ -void soundSaveGame(u8*&); -void soundReadGame(const u8*& in, int version); +void soundSaveGame(uint8_t*&); +void soundReadGame(const uint8_t*& in, int version); #else void soundSaveGame(gzFile); void soundReadGame(gzFile, int version); diff --git a/src/gba/Sram.cpp b/src/gba/Sram.cpp index 7c70e54a..7ca030c2 100644 --- a/src/gba/Sram.cpp +++ b/src/gba/Sram.cpp @@ -3,18 +3,18 @@ #include "GBA.h" #include "Globals.h" -u8 sramRead(u32 address) +uint8_t sramRead(uint32_t address) { return flashSaveMemory[address & 0xFFFF]; } -void sramDelayedWrite(u32 address, u8 byte) +void sramDelayedWrite(uint32_t address, uint8_t byte) { saveType = 2; cpuSaveGameFunc = sramWrite; sramWrite(address, byte); } -void sramWrite(u32 address, u8 byte) +void sramWrite(uint32_t address, uint8_t byte) { flashSaveMemory[address & 0xFFFF] = byte; systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; diff --git a/src/gba/bios.cpp b/src/gba/bios.cpp index ab5c092f..5f91b677 100644 --- a/src/gba/bios.cpp +++ b/src/gba/bios.cpp @@ -478,7 +478,7 @@ void BIOS_Div() reg[0].I = number / denom; reg[1].I = number % denom; int32_t temp = (int32_t)reg[0].I; - reg[3].I = temp < 0 ? (u32)-temp : (u32)temp; + reg[3].I = temp < 0 ? (uint32_t)-temp : (uint32_t)temp; } #ifdef GBA_LOGGING if (systemVerbose & VERBOSE_SWI) { @@ -842,7 +842,7 @@ void BIOS_ObjAffineSet() } } -void BIOS_RegisterRamReset(u32 flags) +void BIOS_RegisterRamReset(uint32_t flags) { // no need to trace here. this is only called directly from GBA.cpp // to emulate bios initialization @@ -1221,7 +1221,7 @@ static int32_t BIOS_SndDriver_3e4(uint32_t const r0a, uint32_t const r1a) // 0x3 return v5; } -static void BIOS_SndDriverSub1(u32 p1) // 0x170a +static void BIOS_SndDriverSub1(uint32_t p1) // 0x170a { uint8_t local1 = (p1 & 0x000F0000) >> 16; // param is r0 uint32_t const puser1 = CPUReadMemory(0x3007FF0); // 7FC0 + 0x30 @@ -1298,7 +1298,7 @@ void BIOS_SndDriverInit() // 0x166a uint32_t const user1 = reg[0].I; uint32_t base3 = 0x040000BC; - //u32 base4 = 0x03007FF0; + //uint32_t base4 = 0x03007FF0; CPUWriteHalfWord(base1 + 6, 0); CPUWriteHalfWord(base1 + 12, 0); @@ -1306,7 +1306,7 @@ void BIOS_SndDriverInit() // 0x166a CPUWriteHalfWord(base2 + 4, 0x8F); CPUWriteHalfWord(base2 + 2, 0xA90E); - u16 val9 = CPUReadHalfWord(base2 + 9); + uint16_t val9 = CPUReadHalfWord(base2 + 9); CPUWriteHalfWord(base2 + 9, val9 & ADBITS_MASK); // DA? CPUWriteMemory(base3 + 0, (user1 + 0x350)); //0x350, 640int diff --git a/src/gba/bios.h b/src/gba/bios.h index 35d88659..80571c61 100644 --- a/src/gba/bios.h +++ b/src/gba/bios.h @@ -18,7 +18,7 @@ extern void BIOS_LZ77UnCompVram(); extern void BIOS_LZ77UnCompWram(); extern void BIOS_ObjAffineSet(); extern void BIOS_RegisterRamReset(); -extern void BIOS_RegisterRamReset(u32); +extern void BIOS_RegisterRamReset(uint32_t); extern void BIOS_RLUnCompVram(); extern void BIOS_RLUnCompWram(); extern void BIOS_SoftReset(); diff --git a/src/gba/debugger-expr-yacc.cpp b/src/gba/debugger-expr-yacc.cpp index 3e4dc65c..1e33a505 100644 --- a/src/gba/debugger-expr-yacc.cpp +++ b/src/gba/debugger-expr-yacc.cpp @@ -134,7 +134,7 @@ extern int dexp_error(char*); extern int dexp_lex(); extern char* dexp_text; -std::map dexp_vars; +std::map dexp_vars; #define readWord(addr) \ READ32LE((&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask])) @@ -1677,7 +1677,7 @@ yyreturn: #line 86 "src/sdl/debugger-expr.y" -bool dexp_eval(char* expr, u32* result) +bool dexp_eval(char* expr, uint32_t* result) { extern void dexp_flush(); extern char* dexprString; @@ -1701,7 +1701,7 @@ int dexp_error(char* s) return 0; } -void dexp_setVar(char* name, u32 value) +void dexp_setVar(char* name, uint32_t value) { std::string a(name); dexp_vars[a] = value; @@ -1709,7 +1709,7 @@ void dexp_setVar(char* name, u32 value) void dexp_listVars() { - std::map::iterator iter; + std::map::iterator iter; for (iter = dexp_vars.begin(); iter != dexp_vars.end(); iter++) { printf("%s = %08X\n", iter->first.c_str(), iter->second); @@ -1718,7 +1718,7 @@ void dexp_listVars() void dexp_saveVars(char* file) { - std::map::iterator iter; + std::map::iterator iter; FILE* f = fopen(file, "w"); if (!f) { @@ -1734,10 +1734,10 @@ void dexp_saveVars(char* file) void dexp_loadVars(char* file) { - std::map::iterator iter; + std::map::iterator iter; char buffer[500]; char name[500]; - u32 val; + uint32_t val; FILE* f = fopen(file, "r"); if (!f) { diff --git a/src/gba/debugger-expr.y b/src/gba/debugger-expr.y index aa27510a..7725f065 100644 --- a/src/gba/debugger-expr.y +++ b/src/gba/debugger-expr.y @@ -14,7 +14,7 @@ extern int dexp_error(char *); extern int dexp_lex(); extern char *dexp_text; -std::map dexp_vars; +std::map dexp_vars; #define readWord(addr) \ READ32LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) @@ -85,7 +85,7 @@ exp: TOK_NUMBER { $$ = $1; } ; %% -bool dexp_eval(char *expr, u32 *result) +bool dexp_eval(char *expr, uint32_t *result) { extern void dexp_flush(); extern char *dexprString; @@ -110,7 +110,7 @@ int dexp_error(char *s) return 0; } -void dexp_setVar(char *name, u32 value) +void dexp_setVar(char *name, uint32_t value) { std::string a(name); dexp_vars[a] = value; @@ -118,7 +118,7 @@ void dexp_setVar(char *name, u32 value) void dexp_listVars() { - std::map::iterator iter; + std::map::iterator iter; for (iter = dexp_vars.begin(); iter != dexp_vars.end(); iter++) { printf("%s = %08X\n", iter->first.c_str(), iter->second); @@ -127,7 +127,7 @@ void dexp_listVars() void dexp_saveVars(char *file) { - std::map::iterator iter; + std::map::iterator iter; FILE *f = fopen(file, "w"); if (!f) { @@ -143,10 +143,10 @@ void dexp_saveVars(char *file) void dexp_loadVars(char *file) { - std::map::iterator iter; + std::map::iterator iter; char buffer[500]; char name[500]; - u32 val; + uint32_t val; FILE *f = fopen(file, "r"); if (!f) { diff --git a/src/gba/gbafilter.cpp b/src/gba/gbafilter.cpp index 8dc0d933..d3ee865d 100644 --- a/src/gba/gbafilter.cpp +++ b/src/gba/gbafilter.cpp @@ -31,7 +31,7 @@ void gbafilter_pal(uint16_t* buf, int count) { short temp[3 * 3], s; unsigned pix; - u8 red, green, blue; + uint8_t red, green, blue; while (count--) { pix = *buf; @@ -105,7 +105,7 @@ void gbafilter_pal32(uint32_t* buf, int count) { short temp[3 * 3], s; unsigned pix; - u8 red, green, blue; + uint8_t red, green, blue; while (count--) { pix = *buf; @@ -178,15 +178,15 @@ void gbafilter_pal32(uint32_t* buf, int count) // for palette mode to work with the three spoony filters in 32bpp depth -void gbafilter_pad(u8* buf, int count) +void gbafilter_pad(uint8_t* buf, int count) { union { struct { - u8 r; - u8 g; - u8 b; - u8 a; + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t a; } part; unsigned whole; } mask; diff --git a/src/gba/remote.cpp b/src/gba/remote.cpp index 606f5529..264edc92 100644 --- a/src/gba/remote.cpp +++ b/src/gba/remote.cpp @@ -62,19 +62,19 @@ void remoteSetSockets(SOCKET l, SOCKET r) #endif #define debuggerReadMemory(addr) \ - (*(u32*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask]) + (*(uint32_t*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask]) #define debuggerReadHalfWord(addr) \ - (*(u16*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask]) + (*(uint16_t*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask]) #define debuggerReadByte(addr) \ map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] #define debuggerWriteMemory(addr, value) \ - *(u32*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] = (value) + *(uint32_t*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] = (value) #define debuggerWriteHalfWord(addr, value) \ - *(u16*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] = (value) + *(uint16_t*)&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] = (value) #define debuggerWriteByte(addr, value) \ map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] = (value) @@ -84,7 +84,7 @@ int debuggerNumOfDontBreak = 0; int debuggerRadix = 0; #define NUMBEROFDB 1000 -u32 debuggerNoBreakpointList[NUMBEROFDB]; +uint32_t debuggerNoBreakpointList[NUMBEROFDB]; const char* cmdAliasTable[] = { "help", "?", "h", "?", "continue", "c", "next", "n", "cpyb", "copyb", "cpyh", "copyh", "cpyw", "copyw", @@ -107,24 +107,24 @@ void debuggerHelp(int n, char** args); void printFlagHelp(); void dbgExecute(std::string& cmd); -extern bool debuggerBreakOnWrite(u32, u32, int); -extern bool debuggerBreakOnRegisterCondition(u8, u32, u32, u8); -extern bool debuggerBreakOnExecution(u32, u8); +extern bool debuggerBreakOnWrite(uint32_t, uint32_t, int); +extern bool debuggerBreakOnRegisterCondition(uint8_t, uint32_t, uint32_t, uint8_t); +extern bool debuggerBreakOnExecution(uint32_t, uint8_t); regBreak* breakRegList[16]; -u8 lowRegBreakCounter[4]; //(r0-r3) -u8 medRegBreakCounter[4]; //(r4-r7) -u8 highRegBreakCounter[4]; //(r8-r11) -u8 statusRegBreakCounter[4]; //(r12-r15) -u8* regBreakCounter[4] = { +uint8_t lowRegBreakCounter[4]; //(r0-r3) +uint8_t medRegBreakCounter[4]; //(r4-r7) +uint8_t highRegBreakCounter[4]; //(r8-r11) +uint8_t statusRegBreakCounter[4]; //(r12-r15) +uint8_t* regBreakCounter[4] = { &lowRegBreakCounter[0], &medRegBreakCounter[0], &highRegBreakCounter[0], &statusRegBreakCounter[0] }; -u32 lastWasBranch = 0; +uint32_t lastWasBranch = 0; -struct regBreak* getFromBreakRegList(u8 regnum, int location) +struct regBreak* getFromBreakRegList(uint8_t regnum, int location) { if (location > regBreakCounter[regnum >> 2][regnum & 3]) return NULL; @@ -138,20 +138,20 @@ struct regBreak* getFromBreakRegList(u8 regnum, int location) bool enableRegBreak = false; reg_pair oldReg[16]; -u32 regDiff[16]; +uint32_t regDiff[16]; void breakReg_check(int i) { struct regBreak* brkR = breakRegList[i]; bool notFound = true; - u8 counter = regBreakCounter[i >> 2][i & 3]; + uint8_t counter = regBreakCounter[i >> 2][i & 3]; for (int bri = 0; (bri < counter) && notFound; bri++) { if (!brkR) { - regBreakCounter[i >> 2][i & 3] = (u8)bri; + regBreakCounter[i >> 2][i & 3] = (uint8_t)bri; break; } else { if (brkR->flags != 0) { - u32 regVal = (i == 15 ? (armState ? reg[15].I - 4 : reg[15].I - 2) : reg[i].I); + uint32_t regVal = (i == 15 ? (armState ? reg[15].I - 4 : reg[15].I - 2) : reg[i].I); if ((brkR->flags & 0x1) && (regVal == brkR->intVal)) { debuggerBreakOnRegisterCondition(i, brkR->intVal, regVal, 1); notFound = false; @@ -201,7 +201,7 @@ void clearBreakRegList() } } -void deleteFromBreakRegList(u8 regNum, int num) +void deleteFromBreakRegList(uint8_t regNum, int num) { int counter = regBreakCounter[regNum >> 2][regNum & 3]; if (num >= counter) { @@ -222,7 +222,7 @@ void deleteFromBreakRegList(u8 regNum, int num) regBreakCounter[regNum >> 2][regNum & 3]--; } -void addBreakRegToList(u8 regnum, u8 flags, u32 value) +void addBreakRegToList(uint8_t regnum, uint8_t flags, uint32_t value) { struct regBreak* ans = (struct regBreak*)malloc(sizeof(struct regBreak)); ans->flags = flags; @@ -298,7 +298,7 @@ void printBreakRegList(bool verbose) } } -void debuggerOutput(const char* s, u32 addr) +void debuggerOutput(const char* s, uint32_t addr) { if (s) printf("%s", s); @@ -316,7 +316,7 @@ void debuggerOutput(const char* s, u32 addr) } // checks that the given address is in the DB list -bool debuggerInDB(u32 address) +bool debuggerInDB(uint32_t address) { for (int i = 0; i < debuggerNumOfDontBreak; i++) { @@ -330,7 +330,7 @@ bool debuggerInDB(u32 address) void debuggerDontBreak(int n, char** args) { if (n == 2) { - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int i = debuggerNumOfDontBreak; if (i > NUMBEROFDB) { @@ -361,7 +361,7 @@ void debuggerDontBreakClear(int n, char** args) void debuggerDumpLoad(int n, char** args) { - u32 address; + uint32_t address; char* file; FILE* f; int c; @@ -405,8 +405,8 @@ void debuggerDumpLoad(int n, char** args) void debuggerDumpSave(int n, char** args) { - u32 address; - u32 size; + uint32_t address; + uint32_t size; char* file; FILE* f; @@ -436,7 +436,7 @@ void debuggerDumpSave(int n, char** args) return; } - for (u32 i = 0; i < size; i++) { + for (uint32_t i = 0; i < size; i++) { fputc(debuggerReadByte(address), f); address++; } @@ -449,8 +449,8 @@ void debuggerDumpSave(int n, char** args) void debuggerEditByte(int n, char** args) { if (n >= 3) { - u32 address; - u32 value; + uint32_t address; + uint32_t value; if (!dexp_eval(args[1], &address)) { { sprintf(monbuf, "Invalid expression in address.\n"); @@ -465,7 +465,7 @@ void debuggerEditByte(int n, char** args) monprintf(monbuf); } } - debuggerWriteByte(address, (u16)value); + debuggerWriteByte(address, (uint16_t)value); address++; } } else @@ -475,8 +475,8 @@ void debuggerEditByte(int n, char** args) void debuggerEditHalfWord(int n, char** args) { if (n >= 3) { - u32 address; - u32 value; + uint32_t address; + uint32_t value; if (!dexp_eval(args[1], &address)) { { sprintf(monbuf, "Invalid expression in address.\n"); @@ -498,7 +498,7 @@ void debuggerEditHalfWord(int n, char** args) monprintf(monbuf); } } - debuggerWriteHalfWord(address, (u16)value); + debuggerWriteHalfWord(address, (uint16_t)value); address += 2; } } else @@ -508,8 +508,8 @@ void debuggerEditHalfWord(int n, char** args) void debuggerEditWord(int n, char** args) { if (n >= 3) { - u32 address; - u32 value; + uint32_t address; + uint32_t value; if (!dexp_eval(args[1], &address)) { { sprintf(monbuf, "Invalid expression in address.\n"); @@ -531,14 +531,14 @@ void debuggerEditWord(int n, char** args) monprintf(monbuf); } } - debuggerWriteMemory(address, (u32)value); + debuggerWriteMemory(address, (uint32_t)value); address += 4; } } else debuggerUsage("ew"); } -bool debuggerBreakOnRegisterCondition(u8 registerName, u32 compareVal, u32 regVal, u8 type) +bool debuggerBreakOnRegisterCondition(uint8_t registerName, uint32_t compareVal, uint32_t regVal, uint8_t type) { const char* typeName; switch (type) { @@ -602,7 +602,7 @@ void debuggerEditRegister(int n, char** args) { if (n == 3) { int r = getRegisterNumber(args[1]); - u32 val; + uint32_t val; if (r > 16) { { sprintf(monbuf, "Error: Register must be valid (0-16)\n"); @@ -629,7 +629,7 @@ void debuggerEditRegister(int n, char** args) void debuggerEval(int n, char** args) { if (n == 2) { - u32 result = 0; + uint32_t result = 0; if (dexp_eval(args[1], &result)) { { sprintf(monbuf, " =$%08X\n", result); @@ -648,9 +648,9 @@ void debuggerEval(int n, char** args) void debuggerFillByte(int n, char** args) { if (n == 4) { - u32 address; - u32 value; - u32 reps; + uint32_t address; + uint32_t value; + uint32_t reps; if (!dexp_eval(args[1], &address)) { { sprintf(monbuf, "Invalid expression in address.\n"); @@ -670,8 +670,8 @@ void debuggerFillByte(int n, char** args) monprintf(monbuf); } } - for (u32 i = 0; i < reps; i++) { - debuggerWriteByte(address, (u8)value); + for (uint32_t i = 0; i < reps; i++) { + debuggerWriteByte(address, (uint8_t)value); address++; } } else @@ -681,9 +681,9 @@ void debuggerFillByte(int n, char** args) void debuggerFillHalfWord(int n, char** args) { if (n == 4) { - u32 address; - u32 value; - u32 reps; + uint32_t address; + uint32_t value; + uint32_t reps; if (!dexp_eval(args[1], &address)) { { sprintf(monbuf, "Invalid expression in address.\n"); @@ -707,8 +707,8 @@ void debuggerFillHalfWord(int n, char** args) monprintf(monbuf); } } - for (u32 i = 0; i < reps; i++) { - debuggerWriteHalfWord(address, (u16)value); + for (uint32_t i = 0; i < reps; i++) { + debuggerWriteHalfWord(address, (uint16_t)value); address += 2; } } else @@ -718,9 +718,9 @@ void debuggerFillHalfWord(int n, char** args) void debuggerFillWord(int n, char** args) { if (n == 4) { - u32 address; - u32 value; - u32 reps; + uint32_t address; + uint32_t value; + uint32_t reps; if (!dexp_eval(args[1], &address)) { { sprintf(monbuf, "Invalid expression in address.\n"); @@ -744,8 +744,8 @@ void debuggerFillWord(int n, char** args) monprintf(monbuf); } } - for (u32 i = 0; i < reps; i++) { - debuggerWriteMemory(address, (u32)value); + for (uint32_t i = 0; i < reps; i++) { + debuggerWriteMemory(address, (uint32_t)value); address += 4; } } else @@ -754,11 +754,11 @@ void debuggerFillWord(int n, char** args) unsigned int SearchStart = 0xFFFFFFFF; unsigned int SearchMaxMatches = 5; -u8 SearchData[64]; // It actually doesn't make much sense to search for more than 64 bytes, does it? +uint8_t SearchData[64]; // It actually doesn't make much sense to search for more than 64 bytes, does it? unsigned int SearchLength = 0; unsigned int SearchResults; -unsigned int AddressToGBA(u8* mem) +unsigned int AddressToGBA(uint8_t* mem) { if (mem >= &bios[0] && mem <= &bios[0x3fff]) return 0x00000000 + (mem - &bios[0]); @@ -786,8 +786,8 @@ void debuggerDoSearch() while (true) { unsigned int final = SearchStart + SearchLength - 1; - u8* end; - u8* start; + uint8_t* end; + uint8_t* start; switch (SearchStart >> 24) { case 0: @@ -873,7 +873,7 @@ void debuggerDoSearch() }; end -= SearchLength - 1; - u8 firstbyte = SearchData[0]; + uint8_t firstbyte = SearchData[0]; while (start <= end) { while ((start <= end) && (*start != firstbyte)) start++; @@ -1013,10 +1013,10 @@ void debuggerFindResume(int n, char** args) void debuggerCopyByte(int n, char** args) { - u32 source; - u32 dest; - u32 number = 1; - u32 reps = 1; + uint32_t source; + uint32_t dest; + uint32_t number = 1; + uint32_t reps = 1; if (n > 5 || n < 3) { debuggerUsage("copyb"); } @@ -1051,8 +1051,8 @@ void debuggerCopyByte(int n, char** args) } } - for (u32 j = 0; j < reps; j++) { - for (u32 i = 0; i < number; i++) { + for (uint32_t j = 0; j < reps; j++) { + for (uint32_t i = 0; i < number; i++) { debuggerWriteByte(dest + i, debuggerReadByte(source + i)); } dest += number; @@ -1061,10 +1061,10 @@ void debuggerCopyByte(int n, char** args) void debuggerCopyHalfWord(int n, char** args) { - u32 source; - u32 dest; - u32 number = 2; - u32 reps = 1; + uint32_t source; + uint32_t dest; + uint32_t number = 2; + uint32_t reps = 1; if (n > 5 || n < 3) { debuggerUsage("copyh"); } @@ -1100,8 +1100,8 @@ void debuggerCopyHalfWord(int n, char** args) } } - for (u32 j = 0; j < reps; j++) { - for (u32 i = 0; i < number; i += 2) { + for (uint32_t j = 0; j < reps; j++) { + for (uint32_t i = 0; i < number; i += 2) { debuggerWriteHalfWord(dest + i, debuggerReadHalfWord(source + i)); } dest += number; @@ -1110,10 +1110,10 @@ void debuggerCopyHalfWord(int n, char** args) void debuggerCopyWord(int n, char** args) { - u32 source; - u32 dest; - u32 number = 4; - u32 reps = 1; + uint32_t source; + uint32_t dest; + uint32_t number = 4; + uint32_t reps = 1; if (n > 5 || n < 3) { debuggerUsage("copyw"); } @@ -1149,8 +1149,8 @@ void debuggerCopyWord(int n, char** args) } } - for (u32 j = 0; j < reps; j++) { - for (u32 i = 0; i < number; i += 4) { + for (uint32_t j = 0; j < reps; j++) { + for (uint32_t i = 0; i < number; i += 4) { debuggerWriteMemory(dest + i, debuggerReadMemory(source + i)); } dest += number; @@ -1452,7 +1452,7 @@ char** wordSymbol; bool isTerminator[256]; bool isNewline[256]; bool isTab[256]; -u8 largestSymbol = 1; +uint8_t largestSymbol = 1; void freeWordSymbolContents() { @@ -1501,7 +1501,7 @@ void debuggerReadCharTable(int n, char** args) return; } char buffer[30]; - u32 slot; + uint32_t slot; char* character = (char*)calloc(10, sizeof(char)); wordSymbol = (char**)calloc(256, sizeof(char*)); while (fgets(buffer, 30, tlb)) { @@ -1541,7 +1541,7 @@ void debuggerReadCharTable(int n, char** args) } } -void printCharGroup(u32 addr, bool useAscii) +void printCharGroup(uint32_t addr, bool useAscii) { for (int i = 0; i < 16; i++) { if (useWordSymbol && !useAscii) { @@ -1575,7 +1575,7 @@ void printCharGroup(u32 addr, bool useAscii) void debuggerMemoryByte(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; if (!dexp_eval(args[1], &addr)) { { @@ -1609,7 +1609,7 @@ void debuggerMemoryByte(int n, char** args) void debuggerMemoryHalfWord(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; if (!dexp_eval(args[1], &addr)) { { @@ -1646,7 +1646,7 @@ void debuggerMemoryHalfWord(int n, char** args) void debuggerMemoryWord(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; if (!dexp_eval(args[1], &addr)) { { sprintf(monbuf, "Invalid expression\n"); @@ -1680,7 +1680,7 @@ void debuggerMemoryWord(int n, char** args) void debuggerStringRead(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; if (!dexp_eval(args[1], &addr)) { { @@ -1690,7 +1690,7 @@ void debuggerStringRead(int n, char** args) return; } for (int i = 0; i < 512; i++) { - u8 slot = debuggerReadByte(addr + i); + uint8_t slot = debuggerReadByte(addr + i); if (useWordSymbol) { if (isTerminator[slot]) { @@ -1830,8 +1830,8 @@ void debuggerSetRadix(int argc, char** argv) void debuggerSymbols(int argc, char** argv) { int i = 0; - u32 value; - u32 size; + uint32_t value; + uint32_t size; int type; bool match = false; int matchSize = 0; @@ -1882,13 +1882,13 @@ void debuggerSymbols(int argc, char** argv) void debuggerWhere(int n, char** args) { - void elfPrintCallChain(u32); + void elfPrintCallChain(uint32_t); elfPrintCallChain(armNextPC); } void debuggerVar(int n, char** args) { - u32 val; + uint32_t val; if (n < 2) { dexp_listVars(); @@ -1956,7 +1956,7 @@ void debuggerVar(int n, char** args) } } -bool debuggerBreakOnExecution(u32 address, u8 state) +bool debuggerBreakOnExecution(uint32_t address, uint8_t state) { if (dontBreakNow) return false; @@ -1973,7 +1973,7 @@ bool debuggerBreakOnExecution(u32 address, u8 state) return true; } -bool debuggerBreakOnRead(u32 address, int size) +bool debuggerBreakOnRead(uint32_t address, int size) { if (dontBreakNow) return false; @@ -1994,7 +1994,7 @@ bool debuggerBreakOnRead(u32 address, int size) return true; } -bool debuggerBreakOnWrite(u32 address, u32 value, int size) +bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size) { if (dontBreakNow) return false; @@ -2002,25 +2002,25 @@ bool debuggerBreakOnWrite(u32 address, u32 value, int size) return false; if (!doesBreak(address, 0x11)) return false; - //u32 lastValue; + //uint32_t lastValue; //dexp_eval("old_value", &lastValue); //if (size == 2) // monprintf("Breakpoint (on write) address %08x old:%08x new:%08x\n", // address, lastValue, value); //else if (size == 1) // monprintf("Breakpoint (on write) address %08x old:%04x new:%04x\n", - // address, (u16)lastValue, (u16)value); + // address, (uint16_t)lastValue, (uint16_t)value); //else // monprintf("Breakpoint (on write) address %08x old:%02x new:%02x\n", - // address, (u8)lastValue, (u8)value); + // address, (uint8_t)lastValue, (uint8_t)value); debugger = true; return true; } -void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, int size, int t) +void debuggerBreakOnWrite(uint32_t address, uint32_t oldvalue, uint32_t value, int size, int t) { debuggerBreakOnWrite(address, value, size); - //u32 lastValue; + //uint32_t lastValue; //dexp_eval("old_value", &lastValue); //const char *type = "write"; @@ -2032,14 +2032,14 @@ void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, int size, int t) // type, address, oldvalue, value); //else if (size == 1) // monprintf("Breakpoint (on %s) address %08x old:%04x new:%04x\n", - // type, address, (u16)oldvalue, (u16)value); + // type, address, (uint16_t)oldvalue, (uint16_t)value); //else // monprintf("Breakpoint (on %s) address %08x old:%02x new:%02x\n", - // type, address, (u8)oldvalue, (u8)value); + // type, address, (uint8_t)oldvalue, (uint8_t)value); //debugger = true; } -u8 getFlags(char* flagName) +uint8_t getFlags(char* flagName) { for (int i = 0; flagName[i] != '\0'; i++) { @@ -2054,7 +2054,7 @@ u8 getFlags(char* flagName) return 0x0; } - u8 flag = 0; + uint8_t flag = 0; bool negate_flag = false; @@ -2096,9 +2096,9 @@ void debuggerBreakRegister(int n, char** args) printFlagHelp(); return; } - u8 reg = (u8)getRegisterNumber(args[0]); - u8 flag = getFlags(args[1]); - u32 value; + uint8_t reg = (uint8_t)getRegisterNumber(args[0]); + uint8_t flag = getFlags(args[1]); + uint32_t value; if (!dexp_eval(args[2], &value)) { { sprintf(monbuf, "Invalid expression.\n"); @@ -2153,7 +2153,7 @@ void debuggerBreakRegisterDelete(int n, char** args) } return; } - u32 num; + uint32_t num; if (!dexp_eval(args[1], &num)) { { sprintf(monbuf, "Could not parse the breakpoint number:\n Correct usage requires .\n"); @@ -2331,7 +2331,7 @@ char* breakSymbolCombo(char* command, int* length) return res; } -const char* typeMapping[] = { "'u8", "'u16", "'u32", "'u32", "'s8", "'s16", "'s32", "'s32" }; +const char* typeMapping[] = { "'uint8_t", "'uint16_t", "'uint32_t", "'uint32_t", "'int8_t", "'int16_t", "'int32_t", "'int32_t" }; const char* compareFlagMapping[] = { "Never", "==", ">", ">=", "<", "<=", "!=", "<=>" }; @@ -2393,7 +2393,7 @@ void printConditionalBreak(struct ConditionalBreak* toPrint, bool printAddress) monprintf(monbuf); } bool hasPrevCond = false; - u8 flgs = 0x80; + uint8_t flgs = 0x80; while (flgs != 0) { if (toPrint->type_flags & flgs) { if (hasPrevCond) { @@ -2455,7 +2455,7 @@ void printAllConditionals() } struct ConditionalBreak* base = conditionals[i]; int count = 1; - u32 lastAddress = base->break_address; + uint32_t lastAddress = base->break_address; { sprintf(monbuf, "Address %08x\n-------------------------\n", lastAddress); monprintf(monbuf); @@ -2485,9 +2485,9 @@ void printAllConditionals() } } -u8 printConditionalsFromAddress(u32 address) +uint8_t printConditionalsFromAddress(uint32_t address) { - u8 count = 1; + uint8_t count = 1; if (conditionals[address >> 24] != NULL) { struct ConditionalBreak* base = conditionals[address >> 24]; while (base) { @@ -2519,7 +2519,7 @@ u8 printConditionalsFromAddress(u32 address) return count; } -void printAllFlagConditionals(u8 flag, bool orMode) +void printAllFlagConditionals(uint8_t flag, bool orMode) { int count = 1; int actualCount = 1; @@ -2528,7 +2528,7 @@ void printAllFlagConditionals(u8 flag, bool orMode) bool isCondStart = true; struct ConditionalBreak* base = conditionals[i]; - u32 lastAddress = base->break_address; + uint32_t lastAddress = base->break_address; while (base) { if (lastAddress != base->break_address) { @@ -2568,7 +2568,7 @@ void printAllFlagConditionals(u8 flag, bool orMode) } } -void printAllFlagConditionalsWithAddress(u32 address, u8 flag, bool orMode) +void printAllFlagConditionalsWithAddress(uint32_t address, uint8_t flag, bool orMode) { int count = 1; int actualCount = 1; @@ -2577,7 +2577,7 @@ void printAllFlagConditionalsWithAddress(u32 address, u8 flag, bool orMode) bool isCondStart = true; struct ConditionalBreak* base = conditionals[i]; - u32 lastAddress = base->break_address; + uint32_t lastAddress = base->break_address; while (base) { if (lastAddress != base->break_address) { @@ -2617,7 +2617,7 @@ void printAllFlagConditionalsWithAddress(u32 address, u8 flag, bool orMode) } } -void makeBreak(u32 address, u8 flags, char** expression, int n) +void makeBreak(uint32_t address, uint8_t flags, char** expression, int n) { if (n >= 1) { if (tolower(expression[0][0]) == 'i' && tolower(expression[0][1]) == 'f') { @@ -2634,7 +2634,7 @@ void makeBreak(u32 address, u8 flags, char** expression, int n) return; } } -void deleteBreak(u32 address, u8 flags, char** expression, int howToDelete) +void deleteBreak(uint32_t address, uint8_t flags, char** expression, int howToDelete) { bool applyOr = true; if (howToDelete > 0) { @@ -2644,7 +2644,7 @@ void deleteBreak(u32 address, u8 flags, char** expression, int howToDelete) expression++; } if (howToDelete > 0) { - u32 number = 0; + uint32_t number = 0; if (!dexp_eval(expression[0], &number)) { { sprintf(monbuf, "Invalid expression for number format.\n"); @@ -2652,7 +2652,7 @@ void deleteBreak(u32 address, u8 flags, char** expression, int howToDelete) } return; } - removeFlagFromConditionalBreakNo(address, (u8)number, (flags | (flags >> 4))); + removeFlagFromConditionalBreakNo(address, (uint8_t)number, (flags | (flags >> 4))); { sprintf(monbuf, "Removed all specified breaks from %08x.\n", address); monprintf(monbuf); @@ -2675,7 +2675,7 @@ void deleteBreak(u32 address, u8 flags, char** expression, int howToDelete) } return; } -void clearBreaks(u32 address, u8 flags, char** expression, int howToClear) +void clearBreaks(uint32_t address, uint8_t flags, char** expression, int howToClear) { if (howToClear == 2) { removeConditionalWithFlag(flags, true); @@ -2690,7 +2690,7 @@ void clearBreaks(u32 address, u8 flags, char** expression, int howToClear) } } -void listBreaks(u32 address, u8 flags, char** expression, int howToList) +void listBreaks(uint32_t address, uint8_t flags, char** expression, int howToList) { flags |= (flags << 4); if (howToList) { @@ -2723,10 +2723,10 @@ void executeBreakCommands(int n, char** cmd) } cmd++; n--; - void (*operation)(u32, u8, char**, int) = &makeBreak; //the function to be called + void (*operation)(uint32_t, uint8_t, char**, int) = &makeBreak; //the function to be called - u8 flag = 0; - u32 address = 0; + uint8_t flag = 0; + uint32_t address = 0; //if(strlen(command) == 1){ //Cannot happen, that would mean cmd[0] != b //} @@ -3158,16 +3158,16 @@ void debuggerUsage(const char* cmd) monprintf("&& states the next condition must happen with the previous one, or the break\nfails.\n"); monprintf("|| states the next condition is independent from the last one, and break\nseparately.\n\n"); monprintf("Type can be:\n"); - monprintf(" [u8, b, byte],[u16, h, hword, halfword],[u32,w, word]\n"); - monprintf(" [s8, sb, sbyte],[s16, sh, shword, short, shalfword],[s32, int, sw, word]\n"); - monprintf("Types have to be preceded by a ' ex: 'int, 'u8\n\n"); + monprintf(" [uint8_t, b, byte],[uint16_t, h, hword, halfword],[uint32_t,w, word]\n"); + monprintf(" [int8_t, sb, sbyte],[int16_t, sh, shword, short, shalfword],[int32_t, int, sw, word]\n"); + monprintf("Types have to be preceded by a ' ex: 'int, 'uint8_t\n\n"); monprintf("Conditions may be:\n"); monprintf("C-like:\t\t[<], [<=], [>], [>=] , [==], [!= or <>]\n"); monprintf("ASM-like:\t[lt], [le], [gt], [ge] , [eq], [ne]\n\n"); - monprintf("EX: bw 0x03005008 if old_value == 'u32 [0x03005008]\n"); + monprintf("EX: bw 0x03005008 if old_value == 'uint32_t [0x03005008]\n"); monprintf("Breaks on write from 0x03005008, when the old_value variable, that is assigned\n"); monprintf("as the previous memory value when a write is performed, is equal to the new\ncontents of 0x03005008.\n\n"); - monprintf("EX: bx 0x08000500 if r0 == 1 || r0 > 1 && r2 == 0 || 'u8 [r7] == 5\n"); + monprintf("EX: bx 0x08000500 if r0 == 1 || r0 > 1 && r2 == 0 || 'uint8_t [r7] == 5\n"); monprintf("Breaks in either thumb or arm execution of 0x08000500, if r0's contents are 1,\n"); monprintf("or if r0's contents are bigger than 1 and r2 is equal to 0, or the content of\nthe address at r7(as byte) is equal to 5.\n"); monprintf("It will not break if r0 > 1 and r2 != 0.\n"); @@ -3555,7 +3555,7 @@ void remotePutPacket(const char* packet) } } -void remoteOutput(const char* s, u32 addr) +void remoteOutput(const char* s, uint32_t addr) { char buffer[16384]; @@ -3597,7 +3597,7 @@ void remoteSendStatus() char* s = buffer; s += 3; for (int i = 0; i < 15; i++) { - u32 v = reg[i].I; + uint32_t v = reg[i].I; sprintf(s, "%02x:%02x%02x%02x%02x;", i, (v & 255), (v >> 8) & 255, @@ -3605,7 +3605,7 @@ void remoteSendStatus() (v >> 24) & 255); s += 12; } - u32 v = armNextPC; + uint32_t v = armNextPC; sprintf(s, "0f:%02x%02x%02x%02x;", (v & 255), (v >> 8) & 255, (v >> 16) & 255, @@ -3625,7 +3625,7 @@ void remoteSendStatus() void remoteBinaryWrite(char* p) { - u32 address; + uint32_t address; int count; sscanf(p, "%x,%x:", &address, &count); // monprintf("Binary write for %08x %d\n", address, count); @@ -3633,7 +3633,7 @@ void remoteBinaryWrite(char* p) p = strchr(p, ':'); p++; for (int i = 0; i < count; i++) { - u8 b = *p++; + uint8_t b = *p++; switch (b) { case 0x7d: b = *p++; @@ -3652,7 +3652,7 @@ void remoteBinaryWrite(char* p) void remoteMemoryWrite(char* p) { - u32 address; + uint32_t address; int count; sscanf(p, "%x,%x:", &address, &count); // monprintf("Memory write for %08x %d\n", address, count); @@ -3660,7 +3660,7 @@ void remoteMemoryWrite(char* p) p = strchr(p, ':'); p++; for (int i = 0; i < count; i++) { - u8 v = 0; + uint8_t v = 0; char c = *p++; if (c <= '9') v = (c - '0') << 4; @@ -3680,7 +3680,7 @@ void remoteMemoryWrite(char* p) void remoteMemoryRead(char* p) { - u32 address; + uint32_t address; int count; sscanf(p, "%x,%x:", &address, &count); // monprintf("Memory read for %08x %d\n", address, count); @@ -3689,7 +3689,7 @@ void remoteMemoryRead(char* p) char* s = buffer; for (int i = 0; i < count; i++) { - u8 b = debuggerReadByte(address); + uint8_t b = debuggerReadByte(address); sprintf(s, "%02x", b); address++; s += 2; @@ -3718,8 +3718,8 @@ void remoteQuery(char* p) void remoteStepOverRange(char* p) { - u32 address; - u32 final; + uint32_t address; + uint32_t final; sscanf(p, "%x,%x", &address, & final); remotePutPacket("OK"); @@ -3738,7 +3738,7 @@ void remoteStepOverRange(char* p) void remoteSetBreakPoint(char* p) { - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3756,7 +3756,7 @@ void remoteSetBreakPoint(char* p) // return; //} - //u32 final = address + count; + //uint32_t final = address + count; //if (address < 0x2040000 && final > 0x2040000) { // remotePutPacket("E01"); @@ -3772,7 +3772,7 @@ void remoteSetBreakPoint(char* p) void remoteClearBreakPoint(char* p) { int result; - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3787,7 +3787,7 @@ void remoteClearBreakPoint(char* p) void remoteSetMemoryReadBreakPoint(char* p) { - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3805,7 +3805,7 @@ void remoteSetMemoryReadBreakPoint(char* p) // return; //} - //u32 final = address + count; + //uint32_t final = address + count; //if (address < 0x2040000 && final > 0x2040000) { // remotePutPacket("E01"); @@ -3822,7 +3822,7 @@ void remoteClearMemoryReadBreakPoint(char* p) { bool error = false; int result; - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3840,7 +3840,7 @@ void remoteClearMemoryReadBreakPoint(char* p) void remoteSetMemoryAccessBreakPoint(char* p) { - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3858,7 +3858,7 @@ void remoteSetMemoryAccessBreakPoint(char* p) // return; //} - //u32 final = address + count; + //uint32_t final = address + count; //if (address < 0x2040000 && final > 0x2040000) { // remotePutPacket("E01"); @@ -3875,7 +3875,7 @@ void remoteClearMemoryAccessBreakPoint(char* p) { bool error = false; int result; - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3893,7 +3893,7 @@ void remoteClearMemoryAccessBreakPoint(char* p) void remoteWriteWatch(char* p, bool active) { - u32 address; + uint32_t address; int count; sscanf(p, ",%x,%x#", &address, &count); @@ -3918,7 +3918,7 @@ void remoteWriteWatch(char* p, bool active) // return; //} - u32 final = address + count; + uint32_t final = address + count; //if(address < 0x2040000 && final > 0x2040000) { // remotePutPacket("E01"); @@ -3947,7 +3947,7 @@ void remoteReadRegister(char* p) sscanf(p, "%x", &r); char buffer[1024]; char* s = buffer; - u32 v = reg[r].I; + uint32_t v = reg[r].I; sprintf(s, "%02x%02x%02x%02x", v & 255, (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255); remotePutPacket(buffer); @@ -3961,13 +3961,13 @@ void remoteReadRegisters(char* p) int i; // regular registers for (i = 0; i < 15; i++) { - u32 v = reg[i].I; + uint32_t v = reg[i].I; sprintf(s, "%02x%02x%02x%02x", v & 255, (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255); s += 8; } // PC - u32 pc = armNextPC; + uint32_t pc = armNextPC; sprintf(s, "%02x%02x%02x%02x", pc & 255, (pc >> 8) & 255, (pc >> 16) & 255, (pc >> 24) & 255); s += 8; @@ -3983,7 +3983,7 @@ void remoteReadRegisters(char* p) s += 8; // CPSR CPUUpdateCPSR(); - u32 v = reg[16].I; + uint32_t v = reg[16].I; sprintf(s, "%02x%02x%02x%02x", v & 255, (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255); s += 8; @@ -4002,14 +4002,14 @@ void remoteWriteRegister(char* p) char c = *p++; - u32 v = 0; + uint32_t v = 0; - u8 data[4] = { 0, 0, 0, 0 }; + uint8_t data[4] = { 0, 0, 0, 0 }; int i = 0; while (i < 4) { - u8 b = 0; + uint8_t b = 0; if (c <= '9') b = (c - '0') << 4; else @@ -4224,7 +4224,7 @@ std::string HexToString(char* p) std::string hex(p); std::string cmd; std::stringstream ss; - u32 offset = 0; + uint32_t offset = 0; while (offset < hex.length()) { unsigned int buffer = 0; ss.clear(); @@ -4240,7 +4240,7 @@ std::string StringToHex(std::string& cmd) { std::stringstream ss; ss << std::hex; - for (u32 i = 0; i < cmd.length(); ++i) + for (uint32_t i = 0; i < cmd.length(); ++i) ss << std::setw(2) << std::setfill('0') << (int)cmd.c_str()[i]; return ss.str(); } diff --git a/src/gba/remote.h b/src/gba/remote.h index 3f5ddef2..b42084f0 100644 --- a/src/gba/remote.h +++ b/src/gba/remote.h @@ -1,79 +1,78 @@ #ifndef REMOTE_H #define REMOTE_H -#include "../common/Types.h" #include "GBA.h" -#define BitSet(array, bit) ((u8*)(array))[(bit) >> 3] |= (1 << ((bit)&7)) +#define BitSet(array, bit) ((uint8_t*)(array))[(bit) >> 3] |= (1 << ((bit)&7)) -#define BitClear(array, bit) ((u8*)(array))[(bit) >> 3] &= ~(1 << ((bit)&7)) +#define BitClear(array, bit) ((uint8_t*)(array))[(bit) >> 3] &= ~(1 << ((bit)&7)) -#define BitGet(array, bit) ((u8)((array)[(bit) >> 3]) & (u8)(1 << ((bit)&7))) +#define BitGet(array, bit) ((uint8_t)((array)[(bit) >> 3]) & (uint8_t)(1 << ((bit)&7))) #define BreakSet(array, addr, flag) \ - ((u8*)(array))[(addr) >> 1] |= ((addr & 1) ? (flag << 4) : (flag & 0xf)) + ((uint8_t*)(array))[(addr) >> 1] |= ((addr & 1) ? (flag << 4) : (flag & 0xf)) #define BreakClear(array, addr, flag) \ - ((u8*)(array))[(addr) >> 1] &= ~((addr & 1) ? (flag << 4) : (flag & 0xf)) + ((uint8_t*)(array))[(addr) >> 1] &= ~((addr & 1) ? (flag << 4) : (flag & 0xf)) // check -#define BreakThumbCheck(array, addr) ((u8*)(array))[(addr) >> 1] & ((addr & 1) ? 0x80 : 0x8) +#define BreakThumbCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x80 : 0x8) -#define BreakARMCheck(array, addr) ((u8*)(array))[(addr) >> 1] & ((addr & 1) ? 0x40 : 0x4) +#define BreakARMCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x40 : 0x4) -#define BreakReadCheck(array, addr) ((u8*)(array))[(addr) >> 1] & ((addr & 1) ? 0x20 : 0x2) +#define BreakReadCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x20 : 0x2) -#define BreakWriteCheck(array, addr) ((u8*)(array))[(addr) >> 1] & ((addr & 1) ? 0x10 : 0x1) +#define BreakWriteCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x10 : 0x1) #define BreakCheck(array, addr, flag) \ - ((u8*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf)) + ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf)) extern bool debugger; -extern bool dexp_eval(char*, u32*); -extern void dexp_setVar(char*, u32); +extern bool dexp_eval(char*, uint32_t*); +extern void dexp_setVar(char*, uint32_t); extern void dexp_listVars(); extern void dexp_saveVars(char*); extern void dexp_loadVars(char*); -void debuggerOutput(const char* s, u32 addr); +void debuggerOutput(const char* s, uint32_t addr); -bool debuggerBreakOnExecution(u32 address, u8 state); -bool debuggerBreakOnWrite(u32 address, u32 value, int size); -void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, int size, int t); -bool debuggerBreakOnRead(u32 address, int size); +bool debuggerBreakOnExecution(uint32_t address, uint8_t state); +bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size); +void debuggerBreakOnWrite(uint32_t address, uint32_t oldvalue, uint32_t value, int size, int t); +bool debuggerBreakOnRead(uint32_t address, int size); struct regBreak { - // u8 regNum; /No longer needed + // uint8_t regNum; /No longer needed // bit 0 = equal // bit 1 = greater // bit 2 = smaller // bit 3 = signed - u8 flags; - u32 intVal; + uint8_t flags; + uint32_t intVal; struct regBreak* next; }; -extern u8 lowRegBreakCounter[4]; //(r0-r3) -extern u8 medRegBreakCounter[4]; //(r4-r7) -extern u8 highRegBreakCounter[4]; //(r8-r11) -extern u8 statusRegBreakCounter[4]; //(r12-r15) +extern uint8_t lowRegBreakCounter[4]; //(r0-r3) +extern uint8_t medRegBreakCounter[4]; //(r4-r7) +extern uint8_t highRegBreakCounter[4]; //(r8-r11) +extern uint8_t statusRegBreakCounter[4]; //(r12-r15) extern bool enableRegBreak; extern regBreak* breakRegList[16]; extern void breakReg_check(int i); -struct regBreak* getFromBreakRegList(u8 regnum, int location); +struct regBreak* getFromBreakRegList(uint8_t regnum, int location); void clearBreakRegList(); void clearParticularRegListBreaks(int reg); -void deleteFromBreakRegList(u8 regnum, int location); +void deleteFromBreakRegList(uint8_t regnum, int location); -void addBreakRegToList(u8 regnum, u8 flags, u32 value); +void addBreakRegToList(uint8_t regnum, uint8_t flags, uint32_t value); void printBreakRegList(bool verbose); void remoteStubMain(); void remoteStubSignal(int sig, int number); -void remoteOutput(const char* s, u32 addr); +void remoteOutput(const char* s, uint32_t addr); void remoteSetProtocol(int p); void remoteSetPort(int port); diff --git a/src/gtk/filters.cpp b/src/gtk/filters.cpp index 0494a123..c9129f47 100644 --- a/src/gtk/filters.cpp +++ b/src/gtk/filters.cpp @@ -19,34 +19,34 @@ #include "filters.h" #include "intl.h" -void _2xSaI(u8*, u32, u8*, u8*, u32, int, int); -void _2xSaI32(u8*, u32, u8*, u8*, u32, int, int); -void Super2xSaI(u8*, u32, u8*, u8*, u32, int, int); -void Super2xSaI32(u8*, u32, u8*, u8*, u32, int, int); -void SuperEagle(u8*, u32, u8*, u8*, u32, int, int); -void SuperEagle32(u8*, u32, u8*, u8*, u32, int, int); -void Pixelate(u8*, u32, u8*, u8*, u32, int, int); -void Pixelate32(u8*, u32, u8*, u8*, u32, int, int); -void AdMame2x(u8*, u32, u8*, u8*, u32, int, int); -void AdMame2x32(u8*, u32, u8*, u8*, u32, int, int); -void Bilinear(u8*, u32, u8*, u8*, u32, int, int); -void Bilinear32(u8*, u32, u8*, u8*, u32, int, int); -void BilinearPlus(u8*, u32, u8*, u8*, u32, int, int); -void BilinearPlus32(u8*, u32, u8*, u8*, u32, int, int); -void Scanlines(u8*, u32, u8*, u8*, u32, int, int); -void Scanlines32(u8*, u32, u8*, u8*, u32, int, int); -void ScanlinesTV(u8*, u32, u8*, u8*, u32, int, int); -void ScanlinesTV32(u8*, u32, u8*, u8*, u32, int, int); -void hq2x(u8*, u32, u8*, u8*, u32, int, int); -void hq2x32(u8*, u32, u8*, u8*, u32, int, int); -void lq2x(u8*, u32, u8*, u8*, u32, int, int); -void lq2x32(u8*, u32, u8*, u8*, u32, int, int); -void xbrz2x32(u8*, u32, u8*, u8*, u32, int, int); +void _2xSaI(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void _2xSaI32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Super2xSaI(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Super2xSaI32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void SuperEagle(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void SuperEagle32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Pixelate(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Pixelate32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void AdMame2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void AdMame2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Bilinear(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Bilinear32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void BilinearPlus(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void BilinearPlus32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Scanlines(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void Scanlines32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void ScanlinesTV(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void ScanlinesTV32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void hq2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void hq2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void lq2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void lq2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +void xbrz2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); -void SmartIB(u8*, u32, int, int); -void SmartIB32(u8*, u32, int, int); -void MotionBlurIB(u8*, u32, int, int); -void MotionBlurIB32(u8*, u32, int, int); +void SmartIB(uint8_t*, uint32_t, int, int); +void SmartIB32(uint8_t*, uint32_t, int, int); +void MotionBlurIB(uint8_t*, uint32_t, int, int); +void MotionBlurIB32(uint8_t*, uint32_t, int, int); namespace VBA { diff --git a/src/gtk/filters.h b/src/gtk/filters.h index 6d143724..e90eb7e3 100644 --- a/src/gtk/filters.h +++ b/src/gtk/filters.h @@ -22,11 +22,11 @@ #include "../System.h" -int Init_2xSaI(u32); +int Init_2xSaI(uint32_t); namespace VBA { -typedef void (*Filter)(u8*, u32, u8*, u8*, u32, int, int); -typedef void (*FilterIB)(u8*, u32, int, int); +typedef void (*Filter)(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +typedef void (*FilterIB)(uint8_t*, uint32_t, int, int); enum EFilter { FirstFilter, diff --git a/src/gtk/screenarea-cairo.cpp b/src/gtk/screenarea-cairo.cpp index c22e9c60..2ec12f08 100644 --- a/src/gtk/screenarea-cairo.cpp +++ b/src/gtk/screenarea-cairo.cpp @@ -33,7 +33,7 @@ ScreenAreaCairo::ScreenAreaCairo(int _iWidth, int _iHeight, int _iScale) vUpdateSize(); } -void ScreenAreaCairo::vDrawPixels(u8* _puiData) +void ScreenAreaCairo::vDrawPixels(uint8_t* _puiData) { ScreenArea::vDrawPixels(_puiData); @@ -48,14 +48,14 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose* _pstEvent) Cairo::RefPtr poPattern; Cairo::RefPtr poContext; Cairo::Matrix oMatrix; - const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(u32); + const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(uint32_t); poContext = get_window()->create_cairo_context(); //poContext->set_identity_matrix(); poContext->scale(m_dScaleFactor, m_dScaleFactor); - poImage = Cairo::ImageSurface::create((u8*)m_puiPixels, Cairo::FORMAT_RGB24, + poImage = Cairo::ImageSurface::create((uint8_t*)m_puiPixels, Cairo::FORMAT_RGB24, m_iScaledWidth, m_iScaledHeight, iScaledPitch); //cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop); @@ -77,12 +77,12 @@ bool ScreenAreaCairo::on_draw(const Cairo::RefPtr& poContext) Cairo::RefPtr poImage; Cairo::RefPtr poPattern; Cairo::Matrix oMatrix; - const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(u32); + const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(uint32_t); //poContext->set_identity_matrix(); poContext->scale(m_dScaleFactor, m_dScaleFactor); - poImage = Cairo::ImageSurface::create((u8*)m_puiPixels, Cairo::FORMAT_RGB24, + poImage = Cairo::ImageSurface::create((uint8_t*)m_puiPixels, Cairo::FORMAT_RGB24, m_iScaledWidth, m_iScaledHeight, iScaledPitch); //cairo_matrix_init_translate(&oMatrix, -m_iAreaLeft, -m_iAreaTop); @@ -102,7 +102,7 @@ bool ScreenAreaCairo::on_draw(const Cairo::RefPtr& poContext) void ScreenAreaCairo::vDrawBlackScreen() { if (m_puiPixels && get_realized()) { - memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32)); + memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(uint32_t)); queue_draw_area(0, 0, get_width(), get_height()); } } diff --git a/src/gtk/screenarea-cairo.h b/src/gtk/screenarea-cairo.h index 860e63fa..a4b8ee11 100644 --- a/src/gtk/screenarea-cairo.h +++ b/src/gtk/screenarea-cairo.h @@ -26,7 +26,7 @@ namespace VBA { class ScreenAreaCairo : public ScreenArea { public: ScreenAreaCairo(int _iWidth, int _iHeight, int _iScale = 1); - void vDrawPixels(u8* _puiData); + void vDrawPixels(uint8_t* _puiData); void vDrawBlackScreen(); protected: diff --git a/src/gtk/screenarea-opengl.cpp b/src/gtk/screenarea-opengl.cpp index c954319b..c45369ff 100644 --- a/src/gtk/screenarea-opengl.cpp +++ b/src/gtk/screenarea-opengl.cpp @@ -101,7 +101,7 @@ void ScreenAreaGl::on_realize() glwindow->gl_end(); } -void ScreenAreaGl::vDrawPixels(u8* _puiData) +void ScreenAreaGl::vDrawPixels(uint8_t* _puiData) { ScreenArea::vDrawPixels(_puiData); @@ -111,7 +111,7 @@ void ScreenAreaGl::vDrawPixels(u8* _puiData) void ScreenAreaGl::vDrawBlackScreen() { if (m_puiPixels && get_realized()) { - memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32)); + memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(uint32_t)); queue_draw_area(0, 0, get_width(), get_height()); } } diff --git a/src/gtk/screenarea-opengl.h b/src/gtk/screenarea-opengl.h index 4bf583e6..ad7c5361 100644 --- a/src/gtk/screenarea-opengl.h +++ b/src/gtk/screenarea-opengl.h @@ -27,7 +27,7 @@ namespace VBA { class ScreenAreaGl : public ScreenArea, public Gtk::GL::Widget { public: ScreenAreaGl(int _iWidth, int _iHeight, int _iScale = 1); - void vDrawPixels(u8* _puiData); + void vDrawPixels(uint8_t* _puiData); void vDrawBlackScreen(); protected: diff --git a/src/gtk/screenarea.cpp b/src/gtk/screenarea.cpp index 9b8f6555..542c7719 100644 --- a/src/gtk/screenarea.cpp +++ b/src/gtk/screenarea.cpp @@ -173,10 +173,10 @@ bool ScreenArea::bOnCursorTimeout() return false; } -void ScreenArea::vDrawPixels(u8* _puiData) +void ScreenArea::vDrawPixels(uint8_t* _puiData) { - const int iSrcPitch = (m_iWidth + 1) * sizeof(u32); - const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(u32); + const int iSrcPitch = (m_iWidth + 1) * sizeof(uint32_t); + const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(uint32_t); if (m_vFilterIB != NULL) { m_vFilterIB(_puiData + iSrcPitch, @@ -189,7 +189,7 @@ void ScreenArea::vDrawPixels(u8* _puiData) m_vFilter2x(_puiData + iSrcPitch, iSrcPitch, m_puiDelta, - (u8*)m_puiPixels, + (uint8_t*)m_puiPixels, iScaledPitch, m_iWidth, m_iHeight); @@ -211,10 +211,10 @@ void ScreenArea::vUpdateSize() m_iScaledWidth = m_iFilterScale * m_iWidth; m_iScaledHeight = m_iFilterScale * m_iHeight; - m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; - m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)]; - memset(m_puiPixels, 0, (m_iScaledWidth + 1) * m_iScaledHeight * sizeof(u32)); - memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)); + m_puiPixels = new uint32_t[(m_iScaledWidth + 1) * m_iScaledHeight]; + m_puiDelta = new uint8_t[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(uint32_t)]; + memset(m_puiPixels, 0, (m_iScaledWidth + 1) * m_iScaledHeight * sizeof(uint32_t)); + memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(uint32_t)); vOnSizeUpdated(); diff --git a/src/gtk/screenarea.h b/src/gtk/screenarea.h index 582afc6b..fd585d68 100644 --- a/src/gtk/screenarea.h +++ b/src/gtk/screenarea.h @@ -36,7 +36,7 @@ public: void vSetFilter(EFilter _eFilter); void vSetFilterIB(EFilterIB _eFilterIB); void vSetEnableRender(bool _bEnable); - virtual void vDrawPixels(u8* _puiData); + virtual void vDrawPixels(uint8_t* _puiData); virtual void vDrawBlackScreen() = 0; protected: @@ -57,8 +57,8 @@ protected: int m_iAreaHeight; Filter m_vFilter2x; FilterIB m_vFilterIB; - u32* m_puiPixels; - u8* m_puiDelta; + uint32_t* m_puiPixels; + uint8_t* m_puiDelta; int m_iScaledWidth; int m_iScaledHeight; bool m_bEnableRender; diff --git a/src/gtk/system.cpp b/src/gtk/system.cpp index f7ccde34..c8460b8a 100644 --- a/src/gtk/system.cpp +++ b/src/gtk/system.cpp @@ -32,9 +32,9 @@ int systemColorDepth; int systemVerbose; int systemSaveUpdateCounter; int systemFrameSkip; -u32 systemColorMap32[0x10000]; -u16 systemColorMap16[0x10000]; -u16 systemGbPalette[24]; +uint32_t systemColorMap32[0x10000]; +uint16_t systemColorMap16[0x10000]; +uint16_t systemGbPalette[24]; int emulating; int RGB_LOW_BITS_MASK; @@ -66,7 +66,7 @@ bool systemReadJoypads() return true; } -u32 systemReadJoypad(int joy) +uint32_t systemReadJoypad(int joy) { return inputReadJoypad(joy); } @@ -99,7 +99,7 @@ void systemScreenCapture(int _iNum) ->vCaptureScreen(_iNum); } -u32 systemGetClock() +uint32_t systemGetClock() { Glib::TimeVal time; time.assign_current_time(); @@ -110,7 +110,7 @@ void systemUpdateMotionSensor() { } -u8 systemGetSensorDarkness() +uint8_t systemGetSensorDarkness() { return 0xE8; } @@ -134,7 +134,7 @@ void systemCartridgeRumble(bool) { } -void systemGbPrint(u8* _puiData, +void systemGbPrint(uint8_t* _puiData, int _iLen, int _iPages, int _iFeed, @@ -172,7 +172,7 @@ void systemOnSoundShutdown() { } -void systemOnWriteDataToSoundBuffer(const u16* finalWave, int length) +void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) { } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index b473d2be..1100135f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -51,8 +51,8 @@ extern int RGB_LOW_BITS_MASK; -static const u16 STATE_MAX_DEFAULT = 180u; -static const u16 STATE_INTERVAL_DEFAULT = 165u; +static const uint16_t STATE_MAX_DEFAULT = 180u; +static const uint16_t STATE_INTERVAL_DEFAULT = 165u; namespace VBA { diff --git a/src/gtk/window.h b/src/gtk/window.h index 8e1e7c5b..e8a00b4a 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -241,9 +241,9 @@ private: EShowSpeed m_eShowSpeed; /* State saving into memory & rewind to saved state */ - u16 m_state_count_max; - u16 m_rewind_interval; - static const u32 SZSTATE = 1024 * 512; + uint16_t m_state_count_max; + uint16_t m_rewind_interval; + static const uint32_t SZSTATE = 1024 * 512; std::deque m_rewind_load_q; char* m_psavestate; diff --git a/src/libretro/SoundRetro.cpp b/src/libretro/SoundRetro.cpp index 77c4c08c..44c60bca 100644 --- a/src/libretro/SoundRetro.cpp +++ b/src/libretro/SoundRetro.cpp @@ -24,7 +24,7 @@ SoundRetro::SoundRetro() { } -void SoundRetro::write(u16* finalWave, int length) +void SoundRetro::write(uint16_t* finalWave, int length) { const int16_t* wave = (const int16_t*)finalWave; int frames = length >> 1; diff --git a/src/libretro/SoundRetro.h b/src/libretro/SoundRetro.h index 64858135..53236ed3 100644 --- a/src/libretro/SoundRetro.h +++ b/src/libretro/SoundRetro.h @@ -29,7 +29,7 @@ public: virtual void pause(); virtual void reset(); virtual void resume(); - virtual void write(u16* finalWave, int length); + virtual void write(uint16_t* finalWave, int length); }; #endif // __VBA_SOUND_RETRO_H__ diff --git a/src/libretro/UtilRetro.cpp b/src/libretro/UtilRetro.cpp index 595a94e3..afc9d66a 100644 --- a/src/libretro/UtilRetro.cpp +++ b/src/libretro/UtilRetro.cpp @@ -32,7 +32,7 @@ bool utilWritePNGFile(const char* fileName, int w, int h, uint8_t* pix) return false; } -void utilPutDword(u8* p, u32 value) +void utilPutDword(uint8_t* p, uint32_t value) { *p++ = value & 255; *p++ = (value >> 8) & 255; diff --git a/src/libretro/libretro.cpp b/src/libretro/libretro.cpp index a9a1cd0a..c58e71b1 100644 --- a/src/libretro/libretro.cpp +++ b/src/libretro/libretro.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -13,7 +14,6 @@ #include "../apu/Gb_Apu.h" #include "../apu/Gb_Oscs.h" #include "../common/Port.h" -#include "../common/Types.h" #include "../gba/Cheats.h" #include "../gba/EEprom.h" #include "../gba/Flash.h" @@ -47,9 +47,9 @@ static unsigned libretro_save_size = sizeof(libretro_save_buf); int RGB_LOW_BITS_MASK = 0; -u16 systemColorMap16[0x10000]; -u32 systemColorMap32[0x10000]; -u16 systemGbPalette[24]; +uint16_t systemColorMap16[0x10000]; +uint32_t systemColorMap32[0x10000]; +uint16_t systemGbPalette[24]; int systemRedShift = 0; int systemBlueShift = 0; int systemGreenShift = 0; @@ -61,9 +61,9 @@ int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; int systemSpeed = 0; u64 startTime = 0; -u32 renderedFrames = 0; +uint32_t renderedFrames = 0; -void (*dbgOutput)(const char* s, u32 addr); +void (*dbgOutput)(const char* s, uint32_t addr); void (*dbgSignal)(int sig, int number); void* retro_get_memory_data(unsigned id) @@ -686,7 +686,7 @@ unsigned retro_get_region(void) return RETRO_REGION_NTSC; } -void systemOnWriteDataToSoundBuffer(const u16* finalWave, int length) +void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) { } @@ -747,12 +747,12 @@ int systemGetSensorZ(void) return 0; } -u32 systemReadJoypad(int which) +uint32_t systemReadJoypad(int which) { if (which == -1) which = 0; - u32 J = 0; + uint32_t J = 0; for (unsigned i = 0; i < 10; i++) { if (controller_layout[0] == 1) @@ -771,14 +771,14 @@ u32 systemReadJoypad(int which) bool systemReadJoypads() { return true; } void systemUpdateMotionSensor() {} -u8 systemGetSensorDarkness() {} +uint8_t systemGetSensorDarkness() {} void systemCartridgeRumble(bool) { } bool systemPauseOnFrame() { return false; } -void systemGbPrint(u8* data, int pages, int feed, int palette, int contrast) {} +void systemGbPrint(uint8_t* data, int pages, int feed, int palette, int contrast) {} void systemScreenCapture(int a) {} void systemScreenMessage(const char* msg) { @@ -790,7 +790,7 @@ void systemSetTitle(const char* title) {} void systemShowSpeed(int speed) {} void system10Frames(int rate) {} -u32 systemGetClock() +uint32_t systemGetClock() { return 0; } diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index c7542e57..c87319fd 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -90,7 +90,7 @@ extern void remoteInit(); extern void remoteCleanUp(); extern void remoteStubMain(); extern void remoteStubSignal(int, int); -extern void remoteOutput(const char*, u32); +extern void remoteOutput(const char*, uint32_t); extern void remoteSetProtocol(int); extern void remoteSetPort(int); @@ -132,7 +132,7 @@ int destHeight = 0; int desktopWidth = 0; int desktopHeight = 0; -u8* delta = NULL; +uint8_t* delta = NULL; static const int delta_size = 322 * 242 * 4; int filter_enlarge = 2; @@ -141,13 +141,13 @@ int cartridgeType = 3; int textureSize = 256; GLuint screenTexture = 0; -u8* filterPix = 0; +uint8_t* filterPix = 0; int emulating = 0; int RGB_LOW_BITS_MASK = 0x821; -u32 systemColorMap32[0x10000]; -u16 systemColorMap16[0x10000]; -u16 systemGbPalette[24]; +uint32_t systemColorMap32[0x10000]; +uint16_t systemColorMap16[0x10000]; +uint16_t systemGbPalette[24]; char filename[2048]; @@ -190,7 +190,7 @@ enum VIDEO_SIZE { #define _stricmp strcasecmp -u32 throttleLastTime = 0; +uint32_t throttleLastTime = 0; bool pauseNextFrame = false; int sdlMirroringEnable = 1; @@ -203,7 +203,7 @@ void systemConsoleMessage(const char*); char* home; char screenMessageBuffer[21]; -u32 screenMessageTime = 0; +uint32_t screenMessageTime = 0; #define SOUND_MAX_VOLUME 2.0 #define SOUND_ECHO 0.2 @@ -627,7 +627,7 @@ static void sdlApplyPerImagePreferences() fclose(f); } -static int sdlCalculateShift(u32 mask) +static int sdlCalculateShift(uint32_t mask) { int m = 0; @@ -795,7 +795,7 @@ static void sdlResizeVideo() if (openGL) { free(filterPix); - filterPix = (u8*)calloc(1, (systemColorDepth >> 3) * destWidth * destHeight); + filterPix = (uint8_t*)calloc(1, (systemColorDepth >> 3) * destWidth * destHeight); sdlOpenGLVideoResize(); } @@ -856,7 +856,7 @@ void sdlInitVideo() exit(-1); } - u32 rmask, gmask, bmask; + uint32_t rmask, gmask, bmask; #if 0 if(openGL) { @@ -947,7 +947,7 @@ void sdlInitVideo() int scaledHeight = screenHeight * sdlOpenglScale; free(filterPix); - filterPix = (u8 *)calloc(1, (systemColorDepth >> 3) * destWidth * destHeight); + filterPix = (uint8_t *)calloc(1, (systemColorDepth >> 3) * destWidth * destHeight); sdlOpenGLInit(screenWidth, screenHeight); if ( (!fullScreen) @@ -1833,15 +1833,15 @@ int main(int argc, char** argv) soundInit(); cartridgeType = 0; strcpy(filename, "gnu_stub"); - rom = (u8*)malloc(0x2000000); - workRAM = (u8*)calloc(1, 0x40000); - bios = (u8*)calloc(1, 0x4000); - internalRAM = (u8*)calloc(1, 0x8000); - paletteRAM = (u8*)calloc(1, 0x400); - vram = (u8*)calloc(1, 0x20000); - oam = (u8*)calloc(1, 0x400); - pix = (u8*)calloc(1, 4 * 241 * 162); - ioMem = (u8*)calloc(1, 0x400); + rom = (uint8_t*)malloc(0x2000000); + workRAM = (uint8_t*)calloc(1, 0x40000); + bios = (uint8_t*)calloc(1, 0x4000); + internalRAM = (uint8_t*)calloc(1, 0x8000); + paletteRAM = (uint8_t*)calloc(1, 0x400); + vram = (uint8_t*)calloc(1, 0x20000); + oam = (uint8_t*)calloc(1, 0x400); + pix = (uint8_t*)calloc(1, 4 * 241 * 162); + ioMem = (uint8_t*)calloc(1, 0x400); emulator = GBASystem; @@ -1917,7 +1917,7 @@ int main(int argc, char** argv) utilUpdateSystemColorMaps(); if (delta == NULL) { - delta = (u8*)malloc(delta_size); + delta = (uint8_t*)malloc(delta_size); memset(delta, 255, delta_size); } @@ -2025,7 +2025,7 @@ void systemMessage(int num, const char* msg, ...) va_end(valist); } -void drawScreenMessage(u8* screen, int pitch, int x, int y, unsigned int duration) +void drawScreenMessage(uint8_t* screen, int pitch, int x, int y, unsigned int duration) { if (screenMessage) { if (cartridgeType == 1 && gbBorderOn) { @@ -2040,7 +2040,7 @@ void drawScreenMessage(u8* screen, int pitch, int x, int y, unsigned int duratio } } -void drawSpeed(u8* screen, int pitch, int x, int y) +void drawSpeed(uint8_t* screen, int pitch, int x, int y) { char buffer[50]; if (showSpeed == 1) @@ -2056,14 +2056,14 @@ void drawSpeed(u8* screen, int pitch, int x, int y) void systemDrawScreen() { unsigned int destPitch = destWidth * (systemColorDepth >> 3); - u8* screen; + uint8_t* screen; renderedFrames++; if (openGL) screen = filterPix; else { - screen = (u8*)surface->pixels; + screen = (uint8_t*)surface->pixels; SDL_LockSurface(surface); } @@ -2077,7 +2077,7 @@ void systemDrawScreen() int bytes = (systemColorDepth >> 3); for (int i = 0; i < destWidth; i++) for (int j = 0; j < destHeight; j++) { - u8 k; + uint8_t k; k = filterPix[i * bytes + j * destPitch + 3]; filterPix[i * bytes + j * destPitch + 3] = filterPix[i * bytes + j * destPitch + 1]; filterPix[i * bytes + j * destPitch + 1] = k; @@ -2151,9 +2151,9 @@ void systemFrame() void system10Frames(int rate) { - u32 time = systemGetClock(); + uint32_t time = systemGetClock(); if (!wasPaused && autoFrameSkip) { - u32 diff = time - autoFrameSkipLastTime; + uint32_t diff = time - autoFrameSkipLastTime; int speed = 100; if (diff) @@ -2234,12 +2234,12 @@ void systemLoadRecent() // I need to be implemented } -u32 systemGetClock() +uint32_t systemGetClock() { return SDL_GetTicks(); } -void systemGbPrint(u8* data, int len, int pages, int feed, int palette, int contrast) +void systemGbPrint(uint8_t* data, int len, int pages, int feed, int palette, int contrast) { } @@ -2310,11 +2310,11 @@ bool systemReadJoypads() return true; } -u32 systemReadJoypad(int which) +uint32_t systemReadJoypad(int which) { return inputReadJoypad(which); } -//static u8 sensorDarkness = 0xE8; // total darkness (including daylight on rainy days) +//static uint8_t sensorDarkness = 0xE8; // total darkness (including daylight on rainy days) void systemUpdateSolarSensor() { @@ -2345,7 +2345,7 @@ int systemGetSensorZ() return 0; } -u8 systemGetSensorDarkness() +uint8_t systemGetSensorDarkness() { return 0xE8; } @@ -2361,7 +2361,7 @@ void systemOnSoundShutdown() { } -void systemOnWriteDataToSoundBuffer(const u16* finalWave, int length) +void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) { } diff --git a/src/sdl/debugger.cpp b/src/sdl/debugger.cpp index 05f075f8..85afb41d 100644 --- a/src/sdl/debugger.cpp +++ b/src/sdl/debugger.cpp @@ -56,13 +56,13 @@ extern struct EmulatedSystem emulator; map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] = (value) struct breakpointInfo { - u32 address; - u32 value; + uint32_t address; + uint32_t value; int size; - u32 cond_address; + uint32_t cond_address; char cond_rel; - u32 cond_value; + uint32_t cond_value; int cond_size; bool ia1; bool ia2; @@ -77,13 +77,13 @@ struct DebuggerCommand { unsigned int SearchStart = 0xFFFFFFFF; unsigned int SearchMaxMatches = 5; -u8 SearchData[64]; // It doesn't make much sense to search for more than 64 bytes +uint8_t SearchData[64]; // It doesn't make much sense to search for more than 64 bytes unsigned int SearchLength = 0; unsigned int SearchResults; static void debuggerContinueAfterBreakpoint(); void debuggerDoSearch(); -unsigned int AddressToGBA(u8* mem); +unsigned int AddressToGBA(uint8_t* mem); static void debuggerHelp(int, char**); static void debuggerNext(int, char**); @@ -199,7 +199,7 @@ bool debuggerAtBreakpoint = false; int debuggerBreakpointNumber = 0; int debuggerRadix = 0; -extern u32 cpuPrefetch[2]; +extern uint32_t cpuPrefetch[2]; #define ARM_PREFETCH \ { \ @@ -222,13 +222,13 @@ static void debuggerPrefetch() } } -static void debuggerApplyBreakpoint(u32 address, int num, int size) +static void debuggerApplyBreakpoint(uint32_t address, int num, int size) { if (size) - debuggerWriteMemory(address, (u32)(0xe1200070 | (num & 0xf) | ((num << 4) & 0xf0))); + debuggerWriteMemory(address, (uint32_t)(0xe1200070 | (num & 0xf) | ((num << 4) & 0xf0))); else debuggerWriteHalfWord(address, - (u16)(0xbe00 | num)); + (uint16_t)(0xbe00 | num)); } static void debuggerDisableBreakpoints() @@ -273,7 +273,7 @@ static void debuggerUsage(const char* cmd) } } -static void debuggerPrintBaseType(Type* t, u32 value, u32 location, +static void debuggerPrintBaseType(Type* t, uint32_t value, uint32_t location, LocationType type, int bitSize, int bitOffset) { @@ -387,12 +387,12 @@ static const char* debuggerPrintType(Type* t) return t->name; } -static void debuggerPrintValueInternal(Function*, Type*, ELFBlock*, int, int, u32); +static void debuggerPrintValueInternal(Function*, Type*, ELFBlock*, int, int, uint32_t); static void debuggerPrintValueInternal(Function* f, Type* t, int bitSize, int bitOffset, - u32 objLocation, LocationType type); + uint32_t objLocation, LocationType type); -static u32 debuggerGetValue(u32 location, LocationType type) +static uint32_t debuggerGetValue(uint32_t location, LocationType type) { switch (type) { case LOCATION_memory: @@ -405,22 +405,22 @@ static u32 debuggerGetValue(u32 location, LocationType type) return 0; } -static void debuggerPrintPointer(Type* t, u32 value) +static void debuggerPrintPointer(Type* t, uint32_t value) { printf("(%s)0x%08x", debuggerPrintType(t), value); } -static void debuggerPrintReference(Type* t, u32 value) +static void debuggerPrintReference(Type* t, uint32_t value) { printf("(%s)0x%08x", debuggerPrintType(t), value); } -static void debuggerPrintFunction(Type* t, u32 value) +static void debuggerPrintFunction(Type* t, uint32_t value) { printf("(%s)0x%08x", debuggerPrintType(t), value); } -static void debuggerPrintArray(Type* t, u32 value) +static void debuggerPrintArray(Type* t, uint32_t value) { // todo printf("(%s[])0x%08x", debuggerPrintType(t->array->type), value); @@ -428,15 +428,15 @@ static void debuggerPrintArray(Type* t, u32 value) static void debuggerPrintMember(Function* f, Member* m, - u32 objLocation, - u32 location) + uint32_t objLocation, + uint32_t location) { int bitSize = m->bitSize; if (bitSize) { - u32 value = 0; + uint32_t value = 0; int off = m->bitOffset; int size = m->byteSize; - u32 v = 0; + uint32_t v = 0; switch (size) { case 1: v = debuggerReadByte(location); @@ -482,7 +482,7 @@ static void debuggerPrintMember(Function* f, } } -static void debuggerPrintStructure(Function* f, Type* t, u32 objLocation) +static void debuggerPrintStructure(Function* f, Type* t, uint32_t objLocation) { printf("{"); int count = t->structure->memberCount; @@ -491,7 +491,7 @@ static void debuggerPrintStructure(Function* f, Type* t, u32 objLocation) Member* m = &t->structure->members[i]; printf("%s=", m->name); LocationType type; - u32 location = elfDecodeLocation(f, m->location, &type, objLocation); + uint32_t location = elfDecodeLocation(f, m->location, &type, objLocation); debuggerPrintMember(f, m, objLocation, location); i++; if (i < count) @@ -500,7 +500,7 @@ static void debuggerPrintStructure(Function* f, Type* t, u32 objLocation) printf("}"); } -static void debuggerPrintUnion(Function* f, Type* t, u32 objLocation) +static void debuggerPrintUnion(Function* f, Type* t, uint32_t objLocation) { // todo printf("{"); @@ -517,7 +517,7 @@ static void debuggerPrintUnion(Function* f, Type* t, u32 objLocation) printf("}"); } -static void debuggerPrintEnum(Type* t, u32 value) +static void debuggerPrintEnum(Type* t, uint32_t value) { int i; for (i = 0; i < t->enumeration->count; i++) { @@ -532,9 +532,9 @@ static void debuggerPrintEnum(Type* t, u32 value) static void debuggerPrintValueInternal(Function* f, Type* t, int bitSize, int bitOffset, - u32 objLocation, LocationType type) + uint32_t objLocation, LocationType type) { - u32 value = debuggerGetValue(objLocation, type); + uint32_t value = debuggerGetValue(objLocation, type); if (!t) { printf("void"); return; @@ -572,10 +572,10 @@ static void debuggerPrintValueInternal(Function* f, Type* t, static void debuggerPrintValueInternal(Function* f, Type* t, ELFBlock* loc, int bitSize, int bitOffset, - u32 objLocation) + uint32_t objLocation) { LocationType type; - u32 location; + uint32_t location; if (loc) { if (objLocation) location = elfDecodeLocation(f, loc, &type, objLocation); @@ -599,8 +599,8 @@ static void debuggerPrintValue(Function* f, Object* o) static void debuggerSymbols(int argc, char** argv) { int i = 0; - u32 value; - u32 size; + uint32_t value; + uint32_t size; int type; bool match = false; int matchSize = 0; @@ -674,7 +674,7 @@ static void debuggerPrint(int argc, char** argv) if (argc != 2 && argc != 3) { debuggerUsage(argv[0]); } else { - u32 pc = armNextPC; + uint32_t pc = armNextPC; Function* f = NULL; CompileUnit* u = NULL; @@ -780,7 +780,7 @@ static void debuggerVerbose(int n, char** args) static void debuggerWhere(int n, char** args) { - void elfPrintCallChain(u32); + void elfPrintCallChain(uint32_t); elfPrintCallChain(armNextPC); } @@ -788,7 +788,7 @@ static void debuggerLocals(int n, char** args) { Function* f = NULL; CompileUnit* u = NULL; - u32 pc = armNextPC; + uint32_t pc = armNextPC; if (elfGetCurrentFunction(pc, &f, &u)) { Object* o = f->parameters; @@ -832,7 +832,7 @@ static void debuggerNext(int n, char** args) debuggerDisableBreakpoints(); Function* f = NULL; CompileUnit* u = NULL; - u32 a = armNextPC; + uint32_t a = armNextPC; if (elfGetCurrentFunction(a, &f, &u)) { const char* file; int line = elfFindLine(u, f, a, &file); @@ -927,8 +927,8 @@ static void debuggerBreakDelete(int n, char** args) static void debuggerBreak(int n, char** args) { if (n == 2) { - u32 address = 0; - u32 value = 0; + uint32_t address = 0; + uint32_t value = 0; int type = 0; const char* s = args[1]; char c = *s; @@ -938,13 +938,13 @@ static void debuggerBreak(int n, char** args) *l++ = 0; int line = atoi(l); - u32 addr; + uint32_t addr; Function* f; CompileUnit* u; if (elfFindLineInModule(&addr, name, line)) { if (elfGetCurrentFunction(addr, &f, &u)) { - u32 addr2; + uint32_t addr2; if (elfGetSymbolAddress(f->name, &addr2, &value, &type)) { address = addr; } else { @@ -963,12 +963,12 @@ static void debuggerBreak(int n, char** args) int line = atoi(s); Function* f; CompileUnit* u; - u32 addr; + uint32_t addr; if (elfGetCurrentFunction(armNextPC, &f, &u)) { if (elfFindLineInUnit(&addr, u, line)) { if (elfGetCurrentFunction(addr, &f, &u)) { - u32 addr2; + uint32_t addr2; if (elfGetSymbolAddress(f->name, &addr2, &value, &type)) { address = addr; } else { @@ -1017,7 +1017,7 @@ static void debuggerBreak(int n, char** args) static void debuggerBreakThumb(int n, char** args) { if (n == 2) { - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int i = debuggerNumOfBreakpoints; debuggerBreakpointList[i].address = address; @@ -1033,7 +1033,7 @@ static void debuggerBreakThumb(int n, char** args) static void debuggerBreakArm(int n, char** args) { if (n == 2) { - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int i = debuggerNumOfBreakpoints; debuggerBreakpointList[i].address = address; @@ -1049,7 +1049,7 @@ static void debuggerBreakArm(int n, char** args) static void debuggerBreakWriteClear(int n, char** args) { if (n == 3) { - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); @@ -1059,12 +1059,12 @@ static void debuggerBreakWriteClear(int n, char** args) return; } - u32 final = address + n; + uint32_t final = address + n; switch (address >> 24) { case 2: { address &= 0x3ffff; final &= 0x3ffff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeWorkRAM[i] == 1) freezeWorkRAM[i] = 0; printf("Cleared break on write from %08x to %08x\n", @@ -1073,7 +1073,7 @@ static void debuggerBreakWriteClear(int n, char** args) case 3: { address &= 0x7fff; final &= 0x7fff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeInternalRAM[i] == 1) freezeInternalRAM[i] = 0; printf("Cleared break on write from %08x to %08x\n", @@ -1082,7 +1082,7 @@ static void debuggerBreakWriteClear(int n, char** args) case 5: { address &= 0x3ff; final &= 0x3ff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezePRAM[i] == 1) freezePRAM[i] = 0; printf("Cleared break on write from %08x to %08x\n", @@ -1097,7 +1097,7 @@ static void debuggerBreakWriteClear(int n, char** args) final &= 0xffff; } - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeVRAM[i] == 1) freezeVRAM[i] = 0; printf("Cleared break on write from %08x to %08x\n", @@ -1106,7 +1106,7 @@ static void debuggerBreakWriteClear(int n, char** args) case 7: { address &= 0x3ff; final &= 0x3ff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeOAM[i] == 1) freezeOAM[i] = 0; printf("Cleared break on write from %08x to %08x\n", @@ -1143,7 +1143,7 @@ static void debuggerBreakWrite(int n, char** args) printf("Cheats are enabled. Cannot continue.\n"); return; } - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); @@ -1153,7 +1153,7 @@ static void debuggerBreakWrite(int n, char** args) return; } - u32 final = address + n; + uint32_t final = address + n; if (address<0x2040000 && final> 0x2040000) { printf("Invalid byte count: %d\n", n); @@ -1205,7 +1205,7 @@ static void debuggerBreakWrite(int n, char** args) static void debuggerBreakChangeClear(int n, char** args) { if (n == 3) { - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); @@ -1215,12 +1215,12 @@ static void debuggerBreakChangeClear(int n, char** args) return; } - u32 final = address + n; + uint32_t final = address + n; switch (address >> 24) { case 2: { address &= 0x3ffff; final &= 0x3ffff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeWorkRAM[i] == 2) freezeWorkRAM[i] = 0; printf("Cleared break on change from %08x to %08x\n", @@ -1229,7 +1229,7 @@ static void debuggerBreakChangeClear(int n, char** args) case 3: { address &= 0x7fff; final &= 0x7fff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeInternalRAM[i] == 2) freezeInternalRAM[i] = 0; printf("Cleared break on change from %08x to %08x\n", @@ -1238,7 +1238,7 @@ static void debuggerBreakChangeClear(int n, char** args) case 5: { address &= 0x3ff; final &= 0x3ff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezePRAM[i] == 2) freezePRAM[i] = 0; printf("Cleared break on change from %08x to %08x\n", @@ -1252,7 +1252,7 @@ static void debuggerBreakChangeClear(int n, char** args) address &= 0xffff; final &= 0xffff; } - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeVRAM[i] == 2) freezeVRAM[i] = 0; printf("Cleared break on change from %08x to %08x\n", @@ -1261,7 +1261,7 @@ static void debuggerBreakChangeClear(int n, char** args) case 7: { address &= 0x3ff; final &= 0x3ff; - for (u32 i = address; i < final; i++) + for (uint32_t i = address; i < final; i++) if (freezeOAM[i] == 2) freezeOAM[i] = 0; printf("Cleared break on change from %08x to %08x\n", @@ -1298,7 +1298,7 @@ static void debuggerBreakChange(int n, char** args) printf("Cheats are enabled. Cannot continue.\n"); return; } - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); @@ -1308,7 +1308,7 @@ static void debuggerBreakChange(int n, char** args) return; } - u32 final = address + n; + uint32_t final = address + n; if (address<0x2040000 && final> 0x2040000) { printf("Invalid byte count: %d\n", n); @@ -1353,11 +1353,11 @@ static void debuggerBreakChange(int n, char** args) debuggerUsage("bpc"); } -static void debuggerDisassembleArm(FILE* f, u32 pc, int count) +static void debuggerDisassembleArm(FILE* f, uint32_t pc, int count) { char buffer[80]; int i = 0; - u32 len = 0; + uint32_t len = 0; char format[30]; for (i = 0; i < count; i++) { size_t l = strlen(elfGetAddressSymbol(pc + 4 * i)); @@ -1366,17 +1366,17 @@ static void debuggerDisassembleArm(FILE* f, u32 pc, int count) } sprintf(format, "%%08x %%-%ds %%s\n", len); for (i = 0; i < count; i++) { - u32 addr = pc; + uint32_t addr = pc; pc += disArm(pc, buffer, 2); fprintf(f, format, addr, elfGetAddressSymbol(addr), buffer); } } -static void debuggerDisassembleThumb(FILE* f, u32 pc, int count) +static void debuggerDisassembleThumb(FILE* f, uint32_t pc, int count) { char buffer[80]; int i = 0; - u32 len = 0; + uint32_t len = 0; char format[30]; for (i = 0; i < count; i++) { size_t l = strlen(elfGetAddressSymbol(pc + 2 * i)); @@ -1386,7 +1386,7 @@ static void debuggerDisassembleThumb(FILE* f, u32 pc, int count) sprintf(format, "%%08x %%-%ds %%s\n", len); for (i = 0; i < count; i++) { - u32 addr = pc; + uint32_t addr = pc; pc += disThumb(pc, buffer, 2); fprintf(f, format, addr, elfGetAddressSymbol(addr), buffer); } @@ -1394,7 +1394,7 @@ static void debuggerDisassembleThumb(FILE* f, u32 pc, int count) static void debuggerDisassembleArm(int n, char** args) { - u32 pc = reg[15].I; + uint32_t pc = reg[15].I; pc -= 4; int count = 20; if (n >= 2) { @@ -1412,7 +1412,7 @@ static void debuggerDisassembleArm(int n, char** args) static void debuggerDisassembleThumb(int n, char** args) { - u32 pc = reg[15].I; + uint32_t pc = reg[15].I; pc -= 2; int count = 20; if (n >= 2) { @@ -1438,7 +1438,7 @@ static void debuggerDisassemble(int n, char** args) static void debuggerFileDisassembleArm(int n, char** args) { - u32 pc = reg[15].I; + uint32_t pc = reg[15].I; pc -= 4; int count = 20; if (n < 2) { @@ -1466,7 +1466,7 @@ static void debuggerFileDisassembleArm(int n, char** args) static void debuggerFileDisassembleThumb(int n, char** args) { - u32 pc = reg[15].I; + uint32_t pc = reg[15].I; pc -= 2; int count = 20; if (n < 2) { @@ -1581,8 +1581,8 @@ void debuggerDoSearch() while (true) { unsigned int final = SearchStart + SearchLength - 1; - u8* end; - u8* start; + uint8_t* end; + uint8_t* start; switch (SearchStart >> 24) { case 0: @@ -1666,7 +1666,7 @@ void debuggerDoSearch() }; end -= SearchLength - 1; - u8 firstbyte = SearchData[0]; + uint8_t firstbyte = SearchData[0]; while (start <= end) { while ((start <= end) && (*start != firstbyte)) start++; @@ -1696,7 +1696,7 @@ void debuggerDoSearch() }; }; -unsigned int AddressToGBA(u8* mem) +unsigned int AddressToGBA(uint8_t* mem) { if (mem >= &bios[0] && mem <= &bios[0x3fff]) return 0x00000000 + (mem - &bios[0]); @@ -1890,11 +1890,11 @@ static void debuggerIo(int n, char** args) static void debuggerEditByte(int n, char** args) { if (n == 3) { - u32 address = 0x10000; - u32 byte = 0; + uint32_t address = 0x10000; + uint32_t byte = 0; sscanf(args[1], "%x", &address); sscanf(args[2], "%x", &byte); - debuggerWriteByte(address, (u8)byte); + debuggerWriteByte(address, (uint8_t)byte); } else debuggerUsage("eb"); } @@ -1902,15 +1902,15 @@ static void debuggerEditByte(int n, char** args) static void debuggerEditHalfWord(int n, char** args) { if (n == 3) { - u32 address = 0x10000; - u32 HalfWord = 0; + uint32_t address = 0x10000; + uint32_t HalfWord = 0; sscanf(args[1], "%x", &address); if (address & 1) { printf("Error: address must be half-word aligned\n"); return; } sscanf(args[2], "%x", &HalfWord); - debuggerWriteHalfWord(address, (u16)HalfWord); + debuggerWriteHalfWord(address, (uint16_t)HalfWord); } else debuggerUsage("eh"); } @@ -1919,7 +1919,7 @@ static void debuggerEditRegister(int n, char** args) { if (n == 3) { int r = 15; - u32 val; + uint32_t val; sscanf(args[1], "%d", &r); if (r > 16 || r == 15) { // don't allow PC to change @@ -1936,15 +1936,15 @@ static void debuggerEditRegister(int n, char** args) static void debuggerEdit(int n, char** args) { if (n == 3) { - u32 address; - u32 byte; + uint32_t address; + uint32_t byte; sscanf(args[1], "%x", &address); if (address & 3) { printf("Error: address must be word aligned\n"); return; } sscanf(args[2], "%x", &byte); - debuggerWriteMemory(address, (u32)byte); + debuggerWriteMemory(address, (uint32_t)byte); } else debuggerUsage("ew"); } @@ -1954,7 +1954,7 @@ static void debuggerEdit(int n, char** args) static void debuggerMemoryByte(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; sscanf(args[1], "%x", &addr); for (int _i = 0; _i < 16; _i++) { int a = debuggerReadByte(addr); @@ -1989,7 +1989,7 @@ static void debuggerMemoryByte(int n, char** args) static void debuggerMemoryHalfWord(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; sscanf(args[1], "%x", &addr); addr = addr & 0xfffffffe; for (int _i = 0; _i < 16; _i++) { @@ -2025,7 +2025,7 @@ static void debuggerMemoryHalfWord(int n, char** args) static void debuggerMemory(int n, char** args) { if (n == 2) { - u32 addr = 0; + uint32_t addr = 0; sscanf(args[1], "%x", &addr); addr = addr & 0xfffffffc; for (int _i = 0; _i < 16; _i++) { @@ -2104,7 +2104,7 @@ static void debuggerReadState(int n, char** args) static void debuggerDumpLoad(int n, char** args) { - u32 address = 0; + uint32_t address = 0; const char* file; FILE* f; int c; @@ -2139,8 +2139,8 @@ static void debuggerDumpLoad(int n, char** args) static void debuggerDumpSave(int n, char** args) { - u32 address = 0; - u32 size = 0; + uint32_t address = 0; + uint32_t size = 0; const char* file; FILE* f; @@ -2155,7 +2155,7 @@ static void debuggerDumpSave(int n, char** args) return; } - for (u32 i = 0; i < size; i++) { + for (uint32_t i = 0; i < size; i++) { fputc(debuggerReadByte(address), f); address++; } @@ -2170,7 +2170,7 @@ static void debuggerCondBreakThumb(int n, char** args) if (n > 4) { //conditional args handled separately int i = debuggerNumOfBreakpoints; - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); debuggerBreakpointList[i].address = address; @@ -2187,7 +2187,7 @@ static void debuggerCondBreakArm(int n, char** args) if (n > 4) { //conditional args handled separately int i = debuggerNumOfBreakpoints; - u32 address = 0; + uint32_t address = 0; sscanf(args[1], "%x", &address); debuggerBreakpointList[i].address = address; @@ -2216,8 +2216,8 @@ static void debuggerCondValidate(int n, char** args, int start) int rel = 0; - u32 value1 = 0; - u32 value2 = 0; + uint32_t value1 = 0; + uint32_t value2 = 0; char size = 0; int j = 1; @@ -2454,11 +2454,11 @@ static bool debuggerCondEvaluate(int num) if (debuggerBreakpointList[num].cond_rel == 0) return true; - u32 address = debuggerBreakpointList[num].cond_address; + uint32_t address = debuggerBreakpointList[num].cond_address; char size = debuggerBreakpointList[num].cond_size; - u32 value = debuggerBreakpointList[num].cond_value; - u32 value1 = 0; - u32 value2 = 0; + uint32_t value = debuggerBreakpointList[num].cond_value; + uint32_t value1 = 0; + uint32_t value2 = 0; if (address < 17) value1 = reg[address].I; @@ -2514,7 +2514,7 @@ static bool debuggerCondEvaluate(int num) } } -/*extern*/ void debuggerOutput(const char* s, u32 addr) +/*extern*/ void debuggerOutput(const char* s, uint32_t addr) { if (s) printf("%s", s); diff --git a/src/sdl/debugger.h b/src/sdl/debugger.h index 13d10b91..36829cfb 100644 --- a/src/sdl/debugger.h +++ b/src/sdl/debugger.h @@ -18,5 +18,5 @@ // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. extern void debuggerMain(); -extern void debuggerOutput(const char*, u32); +extern void debuggerOutput(const char*, uint32_t); extern void debuggerSignal(int, int); diff --git a/src/sdl/exprNode.cpp b/src/sdl/exprNode.cpp index 0dc5e754..d1bee523 100644 --- a/src/sdl/exprNode.cpp +++ b/src/sdl/exprNode.cpp @@ -164,7 +164,7 @@ bool exprNodeDotResolve(Node* n, Function* f, CompileUnit* u) TypeEnum tt = n->expression->type->type; if (tt == TYPE_struct || tt == TYPE_union) { - u32 loc = n->expression->location; + uint32_t loc = n->expression->location; Type* t = n->expression->type; int count = t->structure->memberCount; int i = 0; @@ -225,7 +225,7 @@ bool exprNodeArrowResolve(Node* n, Function* f, CompileUnit* u) tt = n->expression->type->pointer->type; if (tt == TYPE_struct || tt == TYPE_union) { - u32 loc = debuggerReadMemory(n->expression->location); + uint32_t loc = debuggerReadMemory(n->expression->location); Type* t = n->expression->type->pointer; int count = t->structure->memberCount; int i = 0; @@ -367,7 +367,7 @@ bool exprNodeArrayResolve(Node* n, Function* f, CompileUnit* u) if (tt == TYPE_array) { Array* a = n->expression->type->array; - u32 loc = n->expression->location; + uint32_t loc = n->expression->location; Type* t = a->type; if (a->maxBounds > 1) { int index = n->expression->index; @@ -390,7 +390,7 @@ bool exprNodeArrayResolve(Node* n, Function* f, CompileUnit* u) n->locType = LOCATION_memory; } else { Type* t = n->expression->type->pointer; - u32 loc = n->expression->location; + uint32_t loc = n->expression->location; if (n->expression->locType == LOCATION_register) loc = reg[loc].I; else diff --git a/src/sdl/exprNode.h b/src/sdl/exprNode.h index 4fa14b2a..89be8289 100644 --- a/src/sdl/exprNode.h +++ b/src/sdl/exprNode.h @@ -19,8 +19,8 @@ struct Node { Type* type; - u32 location; - u32 objLocation; + uint32_t location; + uint32_t objLocation; LocationType locType; int value; int index; diff --git a/src/sdl/filters.cpp b/src/sdl/filters.cpp index 16db52f7..dd858b26 100644 --- a/src/sdl/filters.cpp +++ b/src/sdl/filters.cpp @@ -26,45 +26,45 @@ // Screen filters // -extern int Init_2xSaI(u32); +extern int Init_2xSaI(uint32_t); extern void hq2x_init(unsigned); extern bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth); -extern void sdlStretch1x(u8*, u32, u8*, u8*, u32, int, int); -extern void sdlStretch2x(u8*, u32, u8*, u8*, u32, int, int); -extern void sdlStretch3x(u8*, u32, u8*, u8*, u32, int, int); -extern void sdlStretch4x(u8*, u32, u8*, u8*, u32, int, int); -extern void _2xSaI(u8*, u32, u8*, u8*, u32, int, int); -extern void _2xSaI32(u8*, u32, u8*, u8*, u32, int, int); -extern void Super2xSaI(u8*, u32, u8*, u8*, u32, int, int); -extern void Super2xSaI32(u8*, u32, u8*, u8*, u32, int, int); -extern void SuperEagle(u8*, u32, u8*, u8*, u32, int, int); -extern void SuperEagle32(u8*, u32, u8*, u8*, u32, int, int); -extern void Pixelate(u8*, u32, u8*, u8*, u32, int, int); -extern void Pixelate32(u8*, u32, u8*, u8*, u32, int, int); -extern void AdMame2x(u8*, u32, u8*, u8*, u32, int, int); -extern void AdMame2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void Bilinear(u8*, u32, u8*, u8*, u32, int, int); -extern void Bilinear32(u8*, u32, u8*, u8*, u32, int, int); -extern void BilinearPlus(u8*, u32, u8*, u8*, u32, int, int); -extern void BilinearPlus32(u8*, u32, u8*, u8*, u32, int, int); -extern void Scanlines(u8*, u32, u8*, u8*, u32, int, int); -extern void Scanlines32(u8*, u32, u8*, u8*, u32, int, int); -extern void ScanlinesTV(u8*, u32, u8*, u8*, u32, int, int); -extern void ScanlinesTV32(u8*, u32, u8*, u8*, u32, int, int); -extern void hq2x(u8*, u32, u8*, u8*, u32, int, int); -extern void hq2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void lq2x(u8*, u32, u8*, u8*, u32, int, int); -extern void lq2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void hq3x16(u8*, u32, u8*, u8*, u32, int, int); -extern void hq4x16(u8*, u32, u8*, u8*, u32, int, int); -extern void hq3x32_32(u8*, u32, u8*, u8*, u32, int, int); -extern void hq4x32_32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz3x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz4x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz5x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz6x32(u8*, u32, u8*, u8*, u32, int, int); +extern void sdlStretch1x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void sdlStretch2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void sdlStretch3x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void sdlStretch4x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void _2xSaI(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void _2xSaI32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Super2xSaI(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Super2xSaI32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void SuperEagle(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void SuperEagle32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Pixelate(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Pixelate32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void AdMame2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void AdMame2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Bilinear(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Bilinear32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void BilinearPlus(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void BilinearPlus32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Scanlines(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Scanlines32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void ScanlinesTV(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void ScanlinesTV32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void lq2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void lq2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq3x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq4x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq3x32_32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq4x32_32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz3x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz4x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz5x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz6x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); struct FilterDesc { char name[30]; @@ -168,10 +168,10 @@ FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth) // Interframe blending filters // -extern void SmartIB(u8*, u32, int, int); -extern void SmartIB32(u8*, u32, int, int); -extern void MotionBlurIB(u8*, u32, int, int); -extern void MotionBlurIB32(u8*, u32, int, int); +extern void SmartIB(uint8_t*, uint32_t, int, int); +extern void SmartIB32(uint8_t*, uint32_t, int, int); +extern void MotionBlurIB(uint8_t*, uint32_t, int, int); +extern void MotionBlurIB32(uint8_t*, uint32_t, int, int); struct IFBFilterDesc { char name[30]; @@ -216,7 +216,7 @@ char* getIFBFilterName(const IFBFilter f) // #ifndef C_CORE -u8 sdlStretcher[16384]; +uint8_t sdlStretcher[16384]; #ifdef _MSC_VER #define SDL_CALL_STRETCHER \ @@ -229,7 +229,7 @@ u8 sdlStretcher[16384]; #endif #define SDL_LONG(val) \ - *((u32*)&sdlStretcher[sdlStretcherPos]) = val; \ + *((uint32_t*)&sdlStretcher[sdlStretcherPos]) = val; \ sdlStretcherPos += 4; #define SDL_AND_EAX(val) \ @@ -466,13 +466,13 @@ void sdlMakeStretcher(int width, int sizeOption) #else // C_CORE -void (*sdlStretcher)(u8*, u8*, int) = 0; +void (*sdlStretcher)(uint8_t*, uint8_t*, int) = 0; #define SDL_CALL_STRETCHER \ sdlStretcher(srcPtr, dstPtr, width) template -void sdlStretchx1(u8* src, u8* dest, int width) +void sdlStretchx1(uint8_t* src, uint8_t* dest, int width) { T* s = (T*)src; T* d = (T*)dest; @@ -481,7 +481,7 @@ void sdlStretchx1(u8* src, u8* dest, int width) } template -void sdlStretchx2(u8* src, u8* dest, int width) +void sdlStretchx2(uint8_t* src, uint8_t* dest, int width) { T* s = (T*)src; T* d = (T*)dest; @@ -492,7 +492,7 @@ void sdlStretchx2(u8* src, u8* dest, int width) } template -void sdlStretchx3(u8* src, u8* dest, int width) +void sdlStretchx3(uint8_t* src, uint8_t* dest, int width) { T* s = (T*)src; T* d = (T*)dest; @@ -504,7 +504,7 @@ void sdlStretchx3(u8* src, u8* dest, int width) } template -void sdlStretchx4(u8* src, u8* dest, int width) +void sdlStretchx4(uint8_t* src, uint8_t* dest, int width) { T* s = (T*)src; T* d = (T*)dest; @@ -516,24 +516,24 @@ void sdlStretchx4(u8* src, u8* dest, int width) } } -void (*sdlStretcher16[4])(u8*, u8*, int) = { - sdlStretchx1, - sdlStretchx2, - sdlStretchx3, - sdlStretchx4 +void (*sdlStretcher16[4])(uint8_t*, uint8_t*, int) = { + sdlStretchx1, + sdlStretchx2, + sdlStretchx3, + sdlStretchx4 }; -void (*sdlStretcher32[4])(u8*, u8*, int) = { - sdlStretchx1, - sdlStretchx2, - sdlStretchx3, - sdlStretchx4 +void (*sdlStretcher32[4])(uint8_t*, uint8_t*, int) = { + sdlStretchx1, + sdlStretchx2, + sdlStretchx3, + sdlStretchx4 }; -void sdlStretch24x1(u8* src, u8* dest, int width) +void sdlStretch24x1(uint8_t* src, uint8_t* dest, int width) { - u8* s = src; - u8* d = dest; + uint8_t* s = src; + uint8_t* d = dest; for (int i = 0; i < width; i++) { *d++ = *s++; *d++ = *s++; @@ -541,10 +541,10 @@ void sdlStretch24x1(u8* src, u8* dest, int width) } } -void sdlStretch24x2(u8* src, u8* dest, int width) +void sdlStretch24x2(uint8_t* src, uint8_t* dest, int width) { - u8* s = (u8*)src; - u8* d = (u8*)dest; + uint8_t* s = (uint8_t*)src; + uint8_t* d = (uint8_t*)dest; for (int i = 0; i < width; i++) { *d++ = *s; *d++ = *(s + 1); @@ -557,10 +557,10 @@ void sdlStretch24x2(u8* src, u8* dest, int width) } } -void sdlStretch24x3(u8* src, u8* dest, int width) +void sdlStretch24x3(uint8_t* src, uint8_t* dest, int width) { - u8* s = (u8*)src; - u8* d = (u8*)dest; + uint8_t* s = (uint8_t*)src; + uint8_t* d = (uint8_t*)dest; for (int i = 0; i < width; i++) { *d++ = *s; *d++ = *(s + 1); @@ -577,10 +577,10 @@ void sdlStretch24x3(u8* src, u8* dest, int width) } } -void sdlStretch24x4(u8* src, u8* dest, int width) +void sdlStretch24x4(uint8_t* src, uint8_t* dest, int width) { - u8* s = (u8*)src; - u8* d = (u8*)dest; + uint8_t* s = (uint8_t*)src; + uint8_t* d = (uint8_t*)dest; for (int i = 0; i < width; i++) { *d++ = *s; *d++ = *(s + 1); @@ -601,7 +601,7 @@ void sdlStretch24x4(u8* src, u8* dest, int width) } } -void (*sdlStretcher24[4])(u8*, u8*, int) = { +void (*sdlStretcher24[4])(uint8_t*, uint8_t*, int) = { sdlStretch24x1, sdlStretch24x2, sdlStretch24x3, @@ -632,11 +632,11 @@ bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth) return true; } -void sdlStretch1x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height) +void sdlStretch1x(uint8_t* srcPtr, uint32_t srcPitch, uint8_t* /* deltaPtr */, uint8_t* dstPtr, uint32_t dstPitch, int width, int height) { int i; #ifndef C_CORE - u32* stretcher = (u32*)sdlStretcher; + uint32_t* stretcher = (uint32_t*)sdlStretcher; #endif for (i = 0; i < height; i++) { SDL_CALL_STRETCHER; @@ -644,11 +644,11 @@ void sdlStretch1x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPtr += dstPitch; } } -void sdlStretch2x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height) +void sdlStretch2x(uint8_t* srcPtr, uint32_t srcPitch, uint8_t* /* deltaPtr */, uint8_t* dstPtr, uint32_t dstPitch, int width, int height) { int i; #ifndef C_CORE - u32* stretcher = (u32*)sdlStretcher; + uint32_t* stretcher = (uint32_t*)sdlStretcher; #endif for (i = 0; i < height; i++) { SDL_CALL_STRETCHER; @@ -658,11 +658,11 @@ void sdlStretch2x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPtr += dstPitch; } } -void sdlStretch3x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height) +void sdlStretch3x(uint8_t* srcPtr, uint32_t srcPitch, uint8_t* /* deltaPtr */, uint8_t* dstPtr, uint32_t dstPitch, int width, int height) { int i; #ifndef C_CORE - u32* stretcher = (u32*)sdlStretcher; + uint32_t* stretcher = (uint32_t*)sdlStretcher; #endif for (i = 0; i < height; i++) { SDL_CALL_STRETCHER; @@ -674,11 +674,11 @@ void sdlStretch3x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPtr += dstPitch; } } -void sdlStretch4x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height) +void sdlStretch4x(uint8_t* srcPtr, uint32_t srcPitch, uint8_t* /* deltaPtr */, uint8_t* dstPtr, uint32_t dstPitch, int width, int height) { int i; #ifndef C_CORE - u32* stretcher = (u32*)sdlStretcher; + uint32_t* stretcher = (uint32_t*)sdlStretcher; #endif for (i = 0; i < height; i++) { SDL_CALL_STRETCHER; diff --git a/src/sdl/filters.h b/src/sdl/filters.h index dd0f9d09..46033e7c 100644 --- a/src/sdl/filters.h +++ b/src/sdl/filters.h @@ -19,6 +19,8 @@ #ifndef VBA_SDL_FILTERS_H #define VBA_SDL_FILTERS_H +#include + #include "../System.h" // @@ -53,7 +55,7 @@ enum Filter { }; // Function pointer type for a filter function -typedef void (*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int); +typedef void (*FilterFunc)(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); // Initialize a filter and get the corresponding filter function pointer FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth); @@ -75,7 +77,7 @@ enum IFBFilter { kIFBNone, kInvalidIFBFilter }; // Function pointer type for an IFB filter function -typedef void (*IFBFilterFunc)(u8*, u32, int, int); +typedef void (*IFBFilterFunc)(uint8_t*, uint32_t, int, int); // Initialize an IFB filter and get the corresponding filter function pointer IFBFilterFunc initIFBFilter(const int f, const int colorDepth); diff --git a/src/sdl/text.cpp b/src/sdl/text.cpp index c299ea92..5b1dc115 100644 --- a/src/sdl/text.cpp +++ b/src/sdl/text.cpp @@ -24,7 +24,7 @@ extern int RGB_LOW_BITS_MASK; -static const u8 fontdata2[2048] = { +static const uint8_t fontdata2[2048] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e, 0x36, 0x7f, 0x7f, 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x1c, 0x3e, 0x1c, 0x7f, 0x7f, 0x3e, 0x1c, 0x3e, 0x08, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x3e, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xf0, 0xe0, 0xf0, 0xbe, 0x33, 0x33, 0x33, 0x1e, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0xfc, 0xcc, 0xfc, 0x0c, 0x0c, 0x0e, 0x0f, 0x07, 0xfe, 0xc6, 0xfe, 0xc6, 0xc6, 0xe6, 0x67, 0x03, 0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99, 0x01, 0x07, 0x1f, 0x7f, 0x1f, 0x07, 0x01, 0x00, 0x40, 0x70, 0x7c, 0x7f, 0x7c, 0x70, 0x40, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, 0xfe, 0xdb, 0xdb, 0xde, 0xd8, 0xd8, 0xd8, 0x00, 0x7c, 0xc6, 0x1c, 0x36, 0x36, 0x1c, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x18, 0x30, 0x7f, 0x30, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x7f, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x7f, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1e, 0x1e, 0x0c, 0x0c, 0x00, 0x0c, 0x00, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x7f, 0x36, 0x36, 0x00, 0x0c, 0x3e, 0x03, 0x1e, 0x30, 0x1f, 0x0c, 0x00, 0x00, 0x63, 0x33, 0x18, 0x0c, 0x66, 0x63, 0x00, 0x1c, 0x36, 0x1c, 0x6e, 0x3b, 0x33, 0x6e, 0x00, 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x00, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x01, 0x00, 0x3e, 0x63, 0x73, 0x7b, 0x6f, 0x67, 0x3e, 0x00, 0x0c, 0x0e, 0x0c, 0x0c, 0x0c, 0x0c, 0x3f, 0x00, 0x1e, 0x33, 0x30, 0x1c, 0x06, 0x33, 0x3f, 0x00, 0x1e, 0x33, 0x30, 0x1c, 0x30, 0x33, 0x1e, 0x00, 0x38, 0x3c, 0x36, 0x33, 0x7f, 0x30, 0x78, 0x00, 0x3f, 0x03, 0x1f, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x1c, 0x06, 0x03, 0x1f, 0x33, 0x33, 0x1e, 0x00, 0x3f, 0x33, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x00, 0x1e, 0x33, 0x33, 0x1e, 0x33, 0x33, 0x1e, 0x00, 0x1e, 0x33, 0x33, 0x3e, 0x30, 0x18, 0x0e, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x06, 0x18, 0x0c, 0x06, 0x03, 0x06, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x1e, 0x33, 0x30, 0x18, 0x0c, 0x00, 0x0c, 0x00, 0x3e, 0x63, 0x7b, 0x7b, 0x7b, 0x03, 0x1e, 0x00, 0x0c, 0x1e, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x00, 0x3f, 0x66, 0x66, 0x3e, 0x66, 0x66, 0x3f, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3c, 0x00, 0x1f, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1f, 0x00, 0x7f, 0x46, 0x16, 0x1e, 0x16, 0x46, 0x7f, 0x00, 0x7f, 0x46, 0x16, 0x1e, 0x16, 0x06, 0x0f, 0x00, 0x3c, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7c, 0x00, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1e, 0x00, 0x67, 0x66, 0x36, 0x1e, 0x36, 0x66, 0x67, 0x00, 0x0f, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7f, 0x00, 0x63, 0x77, 0x7f, 0x7f, 0x6b, 0x63, 0x63, 0x00, 0x63, 0x67, 0x6f, 0x7b, 0x73, 0x63, 0x63, 0x00, 0x1c, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1c, 0x00, 0x3f, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x0f, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x3b, 0x1e, 0x38, 0x00, 0x3f, 0x66, 0x66, 0x3e, 0x36, 0x66, 0x67, 0x00, 0x1e, 0x33, 0x07, 0x0e, 0x38, 0x33, 0x1e, 0x00, 0x3f, 0x2d, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3f, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x00, 0x63, 0x63, 0x63, 0x6b, 0x7f, 0x77, 0x63, 0x00, 0x63, 0x63, 0x36, 0x1c, 0x1c, 0x36, 0x63, 0x00, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x0c, 0x1e, 0x00, 0x7f, 0x63, 0x31, 0x18, 0x4c, 0x66, 0x7f, 0x00, 0x1e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1e, 0x00, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, @@ -35,7 +35,7 @@ static const u8 fontdata2[2048] = { 0x00, 0x00, 0x6e, 0x3b, 0x13, 0x3b, 0x6e, 0x00, 0x00, 0x1e, 0x33, 0x1f, 0x33, 0x1f, 0x03, 0x03, 0x00, 0x3f, 0x33, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x7f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x3f, 0x33, 0x06, 0x0c, 0x06, 0x33, 0x3f, 0x00, 0x00, 0x00, 0x7e, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x03, 0x00, 0x6e, 0x3b, 0x18, 0x18, 0x18, 0x18, 0x00, 0x3f, 0x0c, 0x1e, 0x33, 0x33, 0x1e, 0x0c, 0x3f, 0x1c, 0x36, 0x63, 0x7f, 0x63, 0x36, 0x1c, 0x00, 0x1c, 0x36, 0x63, 0x63, 0x36, 0x36, 0x77, 0x00, 0x38, 0x0c, 0x18, 0x3e, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x60, 0x30, 0x7e, 0xdb, 0xdb, 0x7e, 0x06, 0x03, 0x1c, 0x06, 0x03, 0x1f, 0x03, 0x06, 0x1c, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x00, 0x3f, 0x00, 0x06, 0x0c, 0x18, 0x0c, 0x06, 0x00, 0x3f, 0x00, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x00, 0x3f, 0x00, 0x70, 0xd8, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x1b, 0x0e, 0x0c, 0x0c, 0x00, 0x3f, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x6e, 0x3b, 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x37, 0x36, 0x3c, 0x38, 0x1e, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x0c, 0x06, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -void drawText(u8* screen, int pitch, int x, int y, +void drawText(uint8_t* screen, int pitch, int x, int y, const char* string, bool trans) { screen += y * pitch; @@ -54,11 +54,11 @@ void drawText(u8* screen, int pitch, int x, int y, case 16: { while (*string) { char c = *string++; - u8* scr = screen; + uint8_t* scr = screen; - u16 mask = ~RGB_LOW_BITS_MASK; + uint16_t mask = ~RGB_LOW_BITS_MASK; int h, w; - u16* s = (u16*)scr; + uint16_t* s = (uint16_t*)scr; for (h = 0; h < 8; h++) { for (w = 0; w < 8; w++, s++) { int on = (fontdata2[(c << 3) + h] >> w) & 1; @@ -72,7 +72,7 @@ void drawText(u8* screen, int pitch, int x, int y, } } scr += pitch; - s = (u16*)scr; + s = (uint16_t*)scr; } screen += inc * 8; } @@ -80,24 +80,24 @@ void drawText(u8* screen, int pitch, int x, int y, case 24: { while (*string) { char c = *string++; - u8* scr = screen; + uint8_t* scr = screen; int h, w; - u8* s = (u8*)scr; + uint8_t* s = (uint8_t*)scr; for (h = 0; h < 8; h++) { for (w = 0; w < 8; w++, s += 3) { int on = (fontdata2[(c << 3) + h] >> w) & 1; if (trans) { if (on) { - u32 color = (0x1f) << systemRedShift; + uint32_t color = (0x1f) << systemRedShift; *s = ((color & 255) >> 1) + (*s >> 1); *(s + 1) = (((color >> 8) & 255) >> 1) + (*(s + 1) >> 1); *(s + 2) = (((color >> 16) & 255) >> 1) + (*(s + 2) >> 1); } } else { if (on) { - u32 color = (0x1f) << systemRedShift; + uint32_t color = (0x1f) << systemRedShift; *s = (color & 255); *(s + 1) = (color >> 8) & 255; *(s + 2) = (color >> 16) & 255; @@ -105,7 +105,7 @@ void drawText(u8* screen, int pitch, int x, int y, } } scr += pitch; - s = (u8*)scr; + s = (uint8_t*)scr; } screen += inc * 8; } @@ -113,11 +113,11 @@ void drawText(u8* screen, int pitch, int x, int y, case 32: { while (*string) { char c = *string++; - u8* scr = screen; + uint8_t* scr = screen; int h, w; - u32 mask = 0xfefefe; - u32* s = (u32*)scr; + uint32_t mask = 0xfefefe; + uint32_t* s = (uint32_t*)scr; for (h = 0; h < 8; h++) { for (w = 0; w < 8; w++, s++) { int on = (fontdata2[(c << 3) + h] >> w) & 1; @@ -131,7 +131,7 @@ void drawText(u8* screen, int pitch, int x, int y, } } scr += pitch; - s = (u32*)scr; + s = (uint32_t*)scr; } screen += inc * 8; } diff --git a/src/sdl/text.h b/src/sdl/text.h index fd3e9564..061d105e 100644 --- a/src/sdl/text.h +++ b/src/sdl/text.h @@ -17,4 +17,4 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -extern void drawText(u8*, int, int, int, const char*, bool); +extern void drawText(uint8_t*, int, int, int, const char*, bool); diff --git a/src/win32/BitmapControl.cpp b/src/win32/BitmapControl.cpp index 05f11542..24f546e2 100644 --- a/src/win32/BitmapControl.cpp +++ b/src/win32/BitmapControl.cpp @@ -210,7 +210,7 @@ void BitmapControl::setBmpInfo(BITMAPINFO* info) bmpInfo = info; } -void BitmapControl::setData(u8* d) +void BitmapControl::setData(uint8_t* d) { data = d; } diff --git a/src/win32/BitmapControl.h b/src/win32/BitmapControl.h index 4e4edc62..c1467057 100644 --- a/src/win32/BitmapControl.h +++ b/src/win32/BitmapControl.h @@ -30,7 +30,7 @@ public: void refresh(); void setSize(int w1, int h1); void setSelectedRectangle(int x, int y, int width, int height); - void setData(u8* d); + void setData(uint8_t* d); void setBmpInfo(BITMAPINFO* info); static bool isRegistered; @@ -64,9 +64,9 @@ protected: private: void registerClass(); bool stretch; - u8 colors[3 * 64]; + uint8_t colors[3 * 64]; BITMAPINFO* bmpInfo; - u8* data; + uint8_t* data; int h; int w; RECT boxreigon; diff --git a/src/win32/BugReport.cpp b/src/win32/BugReport.cpp index f9c086bc..e83c2450 100644 --- a/src/win32/BugReport.cpp +++ b/src/win32/BugReport.cpp @@ -150,9 +150,9 @@ CString BugReport::createReport() char buffer[20]; if (theApp.cartridgeType == 0) { - u32 check = 0; + uint32_t check = 0; for (int i = 0; i < 0x4000; i += 4) { - check += *((u32*)&bios[i]); + check += *((uint32_t*)&bios[i]); } AppendFormat(report, "BIOS Checksum: %08X\r\n", check); @@ -165,10 +165,10 @@ CString BugReport::createReport() AppendFormat(report, "Game code : %s\r\n", buffer); CString res = ""; - u32* p = (u32*)rom; - u32* end = (u32*)((char*)rom + theApp.romSize); + uint32_t* p = (uint32_t*)rom; + uint32_t* end = (uint32_t*)((char*)rom + theApp.romSize); while (p < end) { - u32 d = READ32LE(p); + uint32_t d = READ32LE(p); if (d == 0x52504545) { if (memcmp(p, "EEPROM_", 7) == 0) { diff --git a/src/win32/ColorButton.cpp b/src/win32/ColorButton.cpp index e4f0e30f..7cdce544 100644 --- a/src/win32/ColorButton.cpp +++ b/src/win32/ColorButton.cpp @@ -73,7 +73,7 @@ void ColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) DeleteObject(br); } -void ColorButton::setColor(u16 c) +void ColorButton::setColor(uint16_t c) { color = c; Invalidate(); diff --git a/src/win32/ColorButton.h b/src/win32/ColorButton.h index 9c5de1af..9a93f16b 100644 --- a/src/win32/ColorButton.h +++ b/src/win32/ColorButton.h @@ -32,8 +32,8 @@ public: // Implementation public: - void setColor(u16 c); - u16 color; + void setColor(uint16_t c); + uint16_t color; virtual ~ColorButton(); void registerClass(); diff --git a/src/win32/ColorControl.cpp b/src/win32/ColorControl.cpp index 3b67400a..9cf5da80 100644 --- a/src/win32/ColorControl.cpp +++ b/src/win32/ColorControl.cpp @@ -55,7 +55,7 @@ BOOL ColorControl::OnEraseBkgnd(CDC* pDC) return TRUE; } -void ColorControl::setColor(u16 c) +void ColorControl::setColor(uint16_t c) { color = c; Invalidate(); diff --git a/src/win32/ColorControl.h b/src/win32/ColorControl.h index af4c8a8e..3dfc248a 100644 --- a/src/win32/ColorControl.h +++ b/src/win32/ColorControl.h @@ -30,8 +30,8 @@ public: // Implementation public: - void setColor(u16 c); - u16 color; + void setColor(uint16_t c); + uint16_t color; virtual ~ColorControl(); // Generated message map functions diff --git a/src/win32/Direct3D.cpp b/src/win32/Direct3D.cpp index d3d958dd..c1fa9880 100644 --- a/src/win32/Direct3D.cpp +++ b/src/win32/Direct3D.cpp @@ -29,7 +29,7 @@ #include // contains debug functions #include // main include file -extern int Init_2xSaI(u32); // initializes all pixel filters +extern int Init_2xSaI(uint32_t); // initializes all pixel filters extern int systemSpeed; #ifdef _DEBUG @@ -45,12 +45,12 @@ extern bool detectMMX(); #endif struct PFTHREAD_DATA { - void (*filterFunction)(u8*, u32, u8*, u8*, u32, int, int); - u8* sourcePointer; - u32 sourcePitch; - u8* deltaPointer; - u8* destPointer; - u32 destPitch; + void (*filterFunction)(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); + uint8_t* sourcePointer; + uint32_t sourcePitch; + uint8_t* deltaPointer; + uint8_t* destPointer; + uint32_t destPitch; int width; int height; }; @@ -381,17 +381,17 @@ void Direct3DDisplay::render() DXTRACE_ERR_MSGBOX(_T("Can not lock texture"), hr); return; } else { - u32 pitch = sizeX * (systemColorDepth >> 3) + 4; + uint32_t pitch = sizeX * (systemColorDepth >> 3) + 4; if (theApp.filterFunction) { if (filterMT) { - u8* start = pix + pitch; + uint8_t* start = pix + pitch; int src_height_per_thread = sizeY / nThreads; int src_height_remaining = sizeY - ((sizeY / nThreads) * nThreads); - u32 src_bytes_per_thread = pitch * src_height_per_thread; + uint32_t src_bytes_per_thread = pitch * src_height_per_thread; int dst_height_per_thread = src_height_per_thread * filterMagnification; - u32 dst_bytes_per_thread = lr.Pitch * dst_height_per_thread; + uint32_t dst_bytes_per_thread = lr.Pitch * dst_height_per_thread; unsigned int i = nThreads - 1; @@ -404,8 +404,8 @@ void Direct3DDisplay::render() pfthread_data[i].filterFunction = theApp.filterFunction; pfthread_data[i].sourcePointer = start + (i * src_bytes_per_thread); pfthread_data[i].sourcePitch = pitch; - pfthread_data[i].deltaPointer = (u8*)theApp.delta; // TODO: check if thread-safe - pfthread_data[i].destPointer = ((u8*)lr.pBits) + (i * dst_bytes_per_thread); + pfthread_data[i].deltaPointer = (uint8_t*)theApp.delta; // TODO: check if thread-safe + pfthread_data[i].destPointer = ((uint8_t*)lr.pBits) + (i * dst_bytes_per_thread); pfthread_data[i].destPitch = lr.Pitch; pfthread_data[i].width = sizeX; @@ -444,8 +444,8 @@ void Direct3DDisplay::render() theApp.filterFunction( pix + pitch, pitch, - (u8*)theApp.delta, - (u8*)lr.pBits, + (uint8_t*)theApp.delta, + (uint8_t*)lr.pBits, lr.Pitch, sizeX, sizeY); diff --git a/src/win32/DirectInput.cpp b/src/win32/DirectInput.cpp index 59065e29..792a8c39 100644 --- a/src/win32/DirectInput.cpp +++ b/src/win32/DirectInput.cpp @@ -31,7 +31,7 @@ public: virtual bool initialize(); virtual bool readDevices(); - virtual u32 readDevice(int which); + virtual uint32_t readDevice(int which); virtual CString getKeyName(LONG_PTR key); virtual void checkKeys(); virtual void checkMotionKeys(); @@ -592,9 +592,9 @@ bool DirectInput::readDevices() return ok; } -u32 DirectInput::readDevice(int which) +uint32_t DirectInput::readDevice(int which) { - u32 res = 0; + uint32_t res = 0; int i = joypadDefault; if (which >= 0 && which <= 3) i = which; diff --git a/src/win32/DirectSound.cpp b/src/win32/DirectSound.cpp index 30d36db3..d6b6ab30 100644 --- a/src/win32/DirectSound.cpp +++ b/src/win32/DirectSound.cpp @@ -41,7 +41,7 @@ public: void pause(); // pause the secondary sound buffer void reset(); // stop and reset the secondary sound buffer void resume(); // resume the secondary sound buffer - void write(u16* finalWave, int length); // write the emulated sound to the secondary sound buffer + void write(uint16_t* finalWave, int length); // write the emulated sound to the secondary sound buffer }; DirectSound::DirectSound() @@ -219,7 +219,7 @@ void DirectSound::resume() dsbSecondary->Play(0, 0, DSBPLAY_LOOPING); } -void DirectSound::write(u16* finalWave, int length) +void DirectSound::write(uint16_t* finalWave, int length) { if (!pDirectSound) return; diff --git a/src/win32/Disassemble.cpp b/src/win32/Disassemble.cpp index fc821abf..fcaa318b 100644 --- a/src/win32/Disassemble.cpp +++ b/src/win32/Disassemble.cpp @@ -133,13 +133,13 @@ void Disassemble::OnNext() if (rom != NULL) { CPULoop(1); if (armState) { - u32 total = address + count * 4; + uint32_t total = address + count * 4; if (armNextPC >= address && armNextPC < total) { } else { OnGopc(); } } else { - u32 total = address + count * 2; + uint32_t total = address + count * 2; if (armNextPC >= address && armNextPC < total) { } else { OnGopc(); @@ -282,7 +282,7 @@ void Disassemble::refresh() return; char buffer[80]; - u32 addr = address; + uint32_t addr = address; int i; int sel = -1; for (i = 0; i < count; i++) { diff --git a/src/win32/Disassemble.h b/src/win32/Disassemble.h index b7709e09..457fcf0e 100644 --- a/src/win32/Disassemble.h +++ b/src/win32/Disassemble.h @@ -21,7 +21,7 @@ public: void refresh(); int count; bool autoUpdate; - u32 address; + uint32_t address; Disassemble(CWnd* pParent = NULL); // standard constructor // Dialog Data diff --git a/src/win32/GBACheats.cpp b/src/win32/GBACheats.cpp index 26bf829b..2c5f2222 100644 --- a/src/win32/GBACheats.cpp +++ b/src/win32/GBACheats.cpp @@ -84,16 +84,16 @@ void GBACheatSearch::OnStart() CheatSearchBlock* block = &cheatSearchData.blocks[0]; block->size = 0x40000; block->offset = 0x2000000; - block->bits = (u8*)malloc(0x40000 >> 3); + block->bits = (uint8_t*)malloc(0x40000 >> 3); block->data = workRAM; - block->saved = (u8*)malloc(0x40000); + block->saved = (uint8_t*)malloc(0x40000); block = &cheatSearchData.blocks[1]; block->size = 0x8000; block->offset = 0x3000000; - block->bits = (u8*)malloc(0x8000 >> 3); + block->bits = (uint8_t*)malloc(0x8000 >> 3); block->data = internalRAM; - block->saved = (u8*)malloc(0x8000); + block->saved = (uint8_t*)malloc(0x8000); cheatSearchData.count = 2; } @@ -151,7 +151,7 @@ void GBACheatSearch::OnAddCheat() item.mask = LVIF_PARAM; item.iItem = mark; if (m_list.GetItem(&item)) { - AddCheat dlg((u32)item.lParam); + AddCheat dlg((uint32_t)item.lParam); dlg.DoModal(); } } @@ -341,7 +341,7 @@ void GBACheatSearch::addChanges(bool showMsgs) } } -void GBACheatSearch::addChange(int index, u32 address, u32 oldValue, u32 newValue) +void GBACheatSearch::addChange(int index, uint32_t address, uint32_t oldValue, uint32_t newValue) { data[index].addr = address; sprintf(data[index].address, "%08x", address); @@ -474,7 +474,7 @@ void GBACheatSearch::OnSizeType(UINT id) ///////////////////////////////////////////////////////////////////////////// // AddCheat dialog -AddCheat::AddCheat(u32 address, CWnd* pParent /*=NULL*/) +AddCheat::AddCheat(uint32_t address, CWnd* pParent /*=NULL*/) : CDialog(AddCheat::IDD, pParent) { //{{AFX_DATA_INIT(AddCheat) @@ -602,7 +602,7 @@ bool AddCheat::addCheat() CString code; m_address.GetWindowText(buffer); - u32 address = 0; + uint32_t address = 0; sscanf(buffer, "%x", &address); if ((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000)) { } else { @@ -621,7 +621,7 @@ bool AddCheat::addCheat() return false; } } - u32 value; + uint32_t value; m_value.GetWindowText(buffer); if (buffer.IsEmpty()) { diff --git a/src/win32/GBACheats.h b/src/win32/GBACheats.h index 7bb39b2d..e77eae00 100644 --- a/src/win32/GBACheats.h +++ b/src/win32/GBACheats.h @@ -12,7 +12,7 @@ // GBACheatSearch dialog struct WinCheatsData { - u32 addr; + uint32_t addr; char address[9]; char oldValue[12]; char newValue[12]; @@ -25,7 +25,7 @@ public: afx_msg void OnNumberType(UINT id); afx_msg void OnSearchType(UINT id); afx_msg void OnValueType(UINT id); - void addChange(int index, u32 address, u32 oldValue, u32 newValue); + void addChange(int index, uint32_t address, uint32_t oldValue, uint32_t newValue); GBACheatSearch(CWnd* pParent = NULL); // standard constructor ~GBACheatSearch(); @@ -76,8 +76,8 @@ public: bool addCheat(); afx_msg void OnSizeType(UINT id); afx_msg void OnNumberType(UINT id); - u32 address; - AddCheat(u32 address, CWnd* pParent = NULL); // standard constructor + uint32_t address; + AddCheat(uint32_t address, CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(AddCheat) diff --git a/src/win32/GBCheatsDlg.cpp b/src/win32/GBCheatsDlg.cpp index 2edfacf9..c529f34a 100644 --- a/src/win32/GBCheatsDlg.cpp +++ b/src/win32/GBCheatsDlg.cpp @@ -99,7 +99,7 @@ void GBCheatSearch::OnAddCheat() item.mask = LVIF_PARAM; item.iItem = mark; if (m_list.GetItem(&item)) { - AddGBCheat dlg((u32)item.lParam); + AddGBCheat dlg((uint32_t)item.lParam); dlg.DoModal(); } } @@ -156,32 +156,32 @@ void GBCheatSearch::OnStart() block->data = gbRam; else block->data = &gbMemory[0xa000]; - block->saved = (u8*)malloc(gbRamSize); + block->saved = (uint8_t*)malloc(gbRamSize); block->size = gbRamSize; - block->bits = (u8*)malloc(gbRamSize >> 3); + block->bits = (uint8_t*)malloc(gbRamSize >> 3); i++; } block = &cheatSearchData.blocks[i]; if (gbCgbMode) { block->offset = 0xc000; block->data = &gbMemory[0xc000]; - block->saved = (u8*)malloc(0x1000); + block->saved = (uint8_t*)malloc(0x1000); block->size = 0x1000; - block->bits = (u8*)malloc(0x1000 >> 3); + block->bits = (uint8_t*)malloc(0x1000 >> 3); i++; block = &cheatSearchData.blocks[i]; block->offset = 0xd000; block->data = gbWram; - block->saved = (u8*)malloc(0x8000); + block->saved = (uint8_t*)malloc(0x8000); block->size = 0x8000; - block->bits = (u8*)malloc(0x8000 >> 3); + block->bits = (uint8_t*)malloc(0x8000 >> 3); i++; } else { block->offset = 0xc000; block->data = &gbMemory[0xc000]; - block->saved = (u8*)malloc(0x2000); + block->saved = (uint8_t*)malloc(0x2000); block->size = 0x2000; - block->bits = (u8*)malloc(0x2000 >> 3); + block->bits = (uint8_t*)malloc(0x2000 >> 3); i++; } cheatSearchData.count = i; @@ -285,7 +285,7 @@ void GBCheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(m_list.GetSelectionMark() != -1); } -int GBCheatSearch::getBank(u16 addr, int j) +int GBCheatSearch::getBank(uint16_t addr, int j) { switch (addr >> 12) { case 0x0a: @@ -296,7 +296,7 @@ int GBCheatSearch::getBank(u16 addr, int j) return 0; } -void GBCheatSearch::addChange(int index, int bank, u16 address, int offset, u32 oldValue, u32 newValue) +void GBCheatSearch::addChange(int index, int bank, uint16_t address, int offset, uint32_t oldValue, uint32_t newValue) { data[index].bank = bank; if (bank) { @@ -532,7 +532,7 @@ void GBCheatSearch::OnSizeType(UINT id) ///////////////////////////////////////////////////////////////////////////// // AddGBCheat dialog -AddGBCheat::AddGBCheat(u32 addr, CWnd* pParent /*=NULL*/) +AddGBCheat::AddGBCheat(uint32_t addr, CWnd* pParent /*=NULL*/) : CDialog(AddGBCheat::IDD, pParent) { //{{AFX_DATA_INIT(AddGBCheat) @@ -584,7 +584,7 @@ bool AddGBCheat::addCheat() CString buffer; CString code; - u32 value; + uint32_t value; m_value.GetWindowText(buffer); if (buffer.IsEmpty()) { diff --git a/src/win32/GBCheatsDlg.h b/src/win32/GBCheatsDlg.h index 97a4f4bd..ebc13b6a 100644 --- a/src/win32/GBCheatsDlg.h +++ b/src/win32/GBCheatsDlg.h @@ -12,7 +12,7 @@ struct WinGbCheatsData { int bank; - u16 addr; + uint16_t addr; char address[9]; char oldValue[12]; char newValue[12]; @@ -26,8 +26,8 @@ public: afx_msg void OnSearchType(UINT id); afx_msg void OnValueType(UINT id); void addChanges(bool showMsg); - void addChange(int index, int bank, u16 address, int offset, u32 oldValue, u32 newValue); - int getBank(u16 addr, int j); + void addChange(int index, int bank, uint16_t address, int offset, uint32_t oldValue, uint32_t newValue); + int getBank(uint16_t addr, int j); GBCheatSearch(CWnd* pParent = NULL); // standard constructor ~GBCheatSearch(); @@ -77,7 +77,7 @@ public: afx_msg void OnSizeType(UINT id); afx_msg void OnNumberType(UINT id); bool addCheat(); - AddGBCheat(u32 addr, CWnd* pParent = NULL); // standard constructor + AddGBCheat(uint32_t addr, CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(AddGBCheat) diff --git a/src/win32/GBColorDlg.cpp b/src/win32/GBColorDlg.cpp index 64ca81d4..3d7b5709 100644 --- a/src/win32/GBColorDlg.cpp +++ b/src/win32/GBColorDlg.cpp @@ -7,9 +7,9 @@ extern int gbPaletteOption; extern int emulating; extern int cartridgeType; -extern u16 gbPalette[128]; +extern uint16_t gbPalette[128]; -static u16 defaultPalettes[][24] = { +static uint16_t defaultPalettes[][24] = { { 0x7FFF, 0x56B5, 0x318C, 0x0000, 0x7FFF, 0x56B5, 0x318C, 0x0000, }, @@ -188,7 +188,7 @@ void GBColorDlg::setWhich(int w) } } -u16* GBColorDlg::getColors() +uint16_t* GBColorDlg::getColors() { return colors; } @@ -197,7 +197,7 @@ void GBColorDlg::OnColorClicked(UINT id) { id -= IDC_COLOR_BG0; - u16 color = colors[which * 8 + id]; + uint16_t color = colors[which * 8 + id]; COLORREF colorInit = RGB((color & 0x1f) << 3, ((color >> 5) & 0x1f) << 3, ((color >> 10) & 0x1f) << 3); @@ -207,7 +207,7 @@ void GBColorDlg::OnColorClicked(UINT id) if (IDOK == dlg.DoModal()) { COLORREF c = dlg.GetColor(); - colors[which * 8 + id] = (u16)((c >> 3) & 0x1f | ((c >> 11) & 0x1f) << 5 | ((c >> 19) & 0x1f) << 10); + colors[which * 8 + id] = (uint16_t)((c >> 3) & 0x1f | ((c >> 11) & 0x1f) << 5 | ((c >> 19) & 0x1f) << 10); colorControls[id].setColor(colors[which * 8 + id]); } diff --git a/src/win32/GBColorDlg.h b/src/win32/GBColorDlg.h index 610a42c5..e53c2310 100644 --- a/src/win32/GBColorDlg.h +++ b/src/win32/GBColorDlg.h @@ -17,9 +17,9 @@ class GBColorDlg : public CDialog { public: int getWhich(); afx_msg void OnColorClicked(UINT id); - u16* getColors(); + uint16_t* getColors(); void setWhich(int w); - u16 colors[24]; + uint16_t colors[24]; ColorButton colorControls[8]; GBColorDlg(CWnd* pParent = NULL); // standard constructor diff --git a/src/win32/GBDisassemble.cpp b/src/win32/GBDisassemble.cpp index 0a7ddd74..d84a9d7a 100644 --- a/src/win32/GBDisassemble.cpp +++ b/src/win32/GBDisassemble.cpp @@ -18,9 +18,9 @@ extern gbRegister DE; extern gbRegister HL; extern gbRegister SP; extern gbRegister PC; -extern u8 register_LY; -extern u16 IFF; -extern int gbDis(char*, u16); +extern uint8_t register_LY; +extern uint16_t IFF; +extern int gbDis(char*, uint16_t); ///////////////////////////////////////////////////////////////////////////// // GBDisassemble dialog @@ -193,7 +193,7 @@ void GBDisassemble::refresh() return; char buffer[80]; - u16 addr = address; + uint16_t addr = address; int i; int sel = -1; for (i = 0; i < count; i++) { diff --git a/src/win32/GBDisassemble.h b/src/win32/GBDisassemble.h index 7aefeb30..df99ea20 100644 --- a/src/win32/GBDisassemble.h +++ b/src/win32/GBDisassemble.h @@ -18,10 +18,10 @@ class GBDisassemble : public ResizeDlg, IUpdateListener { // Construction public: void refresh(); - u16 lastAddress; + uint16_t lastAddress; int count; bool autoUpdate; - u16 address; + uint16_t address; GBDisassemble(CWnd* pParent = NULL); // standard constructor virtual void update(); diff --git a/src/win32/GBMapView.cpp b/src/win32/GBMapView.cpp index effe05d7..908b5557 100644 --- a/src/win32/GBMapView.cpp +++ b/src/win32/GBMapView.cpp @@ -14,7 +14,7 @@ extern "C" { #include } -extern u8 gbInvertTab[256]; +extern uint8_t gbInvertTab[256]; #ifdef _DEBUG #define new DEBUG_NEW @@ -41,7 +41,7 @@ GBMapView::GBMapView(CWnd* pParent /*=NULL*/) bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data = (u8*)calloc(1, 3 * 1024 * 1024); + data = (uint8_t*)calloc(1, 3 * 1024 * 1024); mapView.setData(data); mapView.setBmpInfo(&bmpInfo); @@ -88,7 +88,7 @@ GBMapView::~GBMapView() void GBMapView::saveBMP(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -98,29 +98,29 @@ void GBMapView::saveBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + w * h * 3; + uint32_t fsz = sizeof(bmpheader) + w * h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -132,12 +132,12 @@ void GBMapView::saveBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data + 3 * w * (h - 1); + uint8_t* pixU8 = (uint8_t*)data + 3 * w * (h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { *b++ = *pixU8++; // B @@ -155,7 +155,7 @@ void GBMapView::saveBMP(const char* name) void GBMapView::savePNG(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -201,12 +201,12 @@ void GBMapView::savePNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data; + uint8_t* pixU8 = (uint8_t*)data; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int blue = *pixU8++; @@ -264,8 +264,8 @@ void GBMapView::OnSave() void GBMapView::render() { - u8* bank0; - u8* bank1; + uint8_t* bank0; + uint8_t* bank1; if (gbCgbMode) { bank0 = &gbVram[0x0000]; bank1 = &gbVram[0x2000]; @@ -288,11 +288,11 @@ void GBMapView::render() int tile = 0; for (int y = 0; y < 32; y++) { for (int x = 0; x < 32; x++) { - u8* bmp = &data[y * 8 * 32 * 24 + x * 24]; - u8 attrs = 0; + uint8_t* bmp = &data[y * 8 * 32 * 24 + x * 24]; + uint8_t attrs = 0; if (bank1 != NULL) attrs = bank1[tile_map_address]; - u8 tile = bank0[tile_map_address]; + uint8_t tile = bank0[tile_map_address]; tile_map_address++; if (bank == 1) { @@ -304,8 +304,8 @@ void GBMapView::render() for (int j = 0; j < 8; j++) { int tile_pattern_address = attrs & 0x40 ? tile_pattern + tile * 16 + (7 - j) * 2 : tile_pattern + tile * 16 + j * 2; - u8 tile_a = 0; - u8 tile_b = 0; + uint8_t tile_a = 0; + uint8_t tile_b = 0; if (attrs & 0x08) { tile_a = bank1[tile_pattern_address++]; @@ -320,16 +320,16 @@ void GBMapView::render() tile_b = gbInvertTab[tile_b]; } - u8 mask = 0x80; + uint8_t mask = 0x80; while (mask > 0) { - u8 c = (tile_a & mask) ? 1 : 0; + uint8_t c = (tile_a & mask) ? 1 : 0; c += (tile_b & mask) ? 2 : 0; if (gbCgbMode) c = c + (attrs & 7) * 4; - u16 color = gbPalette[c]; + uint16_t color = gbPalette[c]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -461,9 +461,9 @@ void GBMapView::OnClose() DestroyWindow(); } -u32 GBMapView::GetClickAddress(int x, int y) +uint32_t GBMapView::GetClickAddress(int x, int y) { - u32 base = 0x9800; + uint32_t base = 0x9800; if (bg == 1) base = 0x9c00; @@ -472,7 +472,7 @@ u32 GBMapView::GetClickAddress(int x, int y) LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam) { - u8* colors = (u8*)lParam; + uint8_t* colors = (uint8_t*)lParam; mapViewZoom.setColors(colors); int x = (int)(wParam & 0xffff); @@ -482,13 +482,13 @@ LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam) buffer.Format("(%d,%d)", x, y); GetDlgItem(IDC_XY)->SetWindowText(buffer); - u32 address = GetClickAddress(x, y); + uint32_t address = GetClickAddress(x, y); buffer.Format("0x%08X", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); - u8 attrs = 0; + uint8_t attrs = 0; - u8 tile = gbMemoryMap[9][address & 0xfff]; + uint8_t tile = gbMemoryMap[9][address & 0xfff]; if (gbCgbMode) { attrs = gbVram[0x2000 + address - 0x8000]; tile = gbVram[address & 0x1fff]; @@ -527,7 +527,7 @@ LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam) LRESULT GBMapView::OnColInfo(WPARAM wParam, LPARAM) { - u16 c = (u16)wParam; + uint16_t c = (uint16_t)wParam; color.setColor(c); diff --git a/src/win32/GBMapView.h b/src/win32/GBMapView.h index 250fc70f..ae94488a 100644 --- a/src/win32/GBMapView.h +++ b/src/win32/GBMapView.h @@ -20,7 +20,7 @@ class GBMapView : public ResizeDlg, IUpdateListener { private: BITMAPINFO bmpInfo; - u8* data; + uint8_t* data; int bank; int bg; int w; @@ -33,7 +33,7 @@ private: public: afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); - u32 GetClickAddress(int x, int y); + uint32_t GetClickAddress(int x, int y); void update(); void paint(); void render(); diff --git a/src/win32/GBMemoryViewerDlg.cpp b/src/win32/GBMemoryViewerDlg.cpp index a2cc13c0..0482ed42 100644 --- a/src/win32/GBMemoryViewerDlg.cpp +++ b/src/win32/GBMemoryViewerDlg.cpp @@ -21,9 +21,9 @@ GBMemoryViewer::GBMemoryViewer() setAddressSize(1); } -void GBMemoryViewer::readData(u32 address, int len, u8* data) +void GBMemoryViewer::readData(uint32_t address, int len, uint8_t* data) { - u16 addr = address & 0xffff; + uint16_t addr = address & 0xffff; if (emulating && gbRom != NULL) { for (int i = 0; i < len; i++) { *data++ = gbMemoryMap[addr >> 12][addr & 0xfff]; @@ -43,28 +43,28 @@ void GBMemoryViewer::readData(u32 address, int len, u8* data) #define GB_WRITEBYTE_QUICK(addr, v) \ gbMemoryMap[(addr) >> 12][(addr)&0xfff] = (v) -void GBMemoryViewer::editData(u32 address, int size, int mask, u32 value) +void GBMemoryViewer::editData(uint32_t address, int size, int mask, uint32_t value) { - u32 oldValue; - u16 addr = (u16)address & 0xffff; + uint32_t oldValue; + uint16_t addr = (uint16_t)address & 0xffff; switch (size) { case 8: oldValue = GB_READBYTE_QUICK(addr); oldValue &= mask; - oldValue |= (u8)value; + oldValue |= (uint8_t)value; GB_WRITEBYTE_QUICK(addr, oldValue); break; case 16: oldValue = GB_READBYTE_QUICK(addr) | (GB_READBYTE_QUICK(addr + 1) << 8); oldValue &= mask; - oldValue |= (u16)value; + oldValue |= (uint16_t)value; GB_WRITEBYTE_QUICK(addr, (oldValue & 255)); GB_WRITEBYTE_QUICK(addr + 1, (oldValue >> 8)); break; case 32: oldValue = GB_READBYTE_QUICK(addr) | (GB_READBYTE_QUICK(addr + 1) << 8) | (GB_READBYTE_QUICK(addr + 2) << 16) | (GB_READBYTE_QUICK(addr + 3) << 24); oldValue &= mask; - oldValue |= (u32)value; + oldValue |= (uint32_t)value; GB_WRITEBYTE_QUICK(addr, (oldValue & 255)); GB_WRITEBYTE_QUICK(addr + 1, (oldValue >> 8)); GB_WRITEBYTE_QUICK(addr + 2, (oldValue >> 16)); @@ -240,7 +240,7 @@ void GBMemoryViewerDlg::OnGo() m_address.GetWindowText(buffer); - u32 address; + uint32_t address; sscanf(buffer, "%x", &address); if (m_viewer.getSize() == 1) address &= ~1; @@ -281,7 +281,7 @@ void GBMemoryViewerDlg::OnSelchangeAddresses() } } -void GBMemoryViewerDlg::setCurrentAddress(u32 address) +void GBMemoryViewerDlg::setCurrentAddress(uint32_t address) { CString buffer; @@ -321,7 +321,7 @@ void GBMemoryViewerDlg::OnSave() } int size = dlg.getSize(); - u16 addr = dlg.getAddress() & 0xffff; + uint16_t addr = dlg.getAddress() & 0xffff; for (int i = 0; i < size; i++) { fputc(gbMemoryMap[addr >> 12][addr & 0xfff], f); @@ -372,7 +372,7 @@ void GBMemoryViewerDlg::OnLoad() if (dlg.DoModal() == IDOK) { int size = dlg.getSize(); - u16 addr = dlg.getAddress() & 0xffff; + uint16_t addr = dlg.getAddress() & 0xffff; for (int i = 0; i < size; i++) { int c = fgetc(f); diff --git a/src/win32/GBMemoryViewerDlg.h b/src/win32/GBMemoryViewerDlg.h index d328172f..57b449dc 100644 --- a/src/win32/GBMemoryViewerDlg.h +++ b/src/win32/GBMemoryViewerDlg.h @@ -13,8 +13,8 @@ class GBMemoryViewer : public MemoryViewer { public: GBMemoryViewer(); - virtual void readData(u32, int, u8*); - virtual void editData(u32, int, int, u32); + virtual void readData(uint32_t, int, uint8_t*); + virtual void editData(uint32_t, int, int, uint32_t); }; ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ class GBMemoryViewerDlg : public ResizeDlg, IUpdateListener, IMemoryViewerDlg { bool autoUpdate; // Construction public: - void setCurrentAddress(u32 address); + void setCurrentAddress(uint32_t address); GBMemoryViewerDlg(CWnd* pParent = NULL); // standard constructor virtual void update(); diff --git a/src/win32/GBOamView.cpp b/src/win32/GBOamView.cpp index 5dd3ffb8..f92d60fd 100644 --- a/src/win32/GBOamView.cpp +++ b/src/win32/GBOamView.cpp @@ -39,7 +39,7 @@ GBOamView::GBOamView(CWnd* pParent /*=NULL*/) bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data = (u8*)calloc(1, 3 * 8 * 16); + data = (uint8_t*)calloc(1, 3 * 8 * 16); oamView.setData(data); oamView.setBmpInfo(&bmpInfo); @@ -142,26 +142,26 @@ void GBOamView::render() if (gbRom == NULL) return; - u16 addr = number * 4 + 0xfe00; + uint16_t addr = number * 4 + 0xfe00; int size = register_LCDC & 4; - u8 y = gbMemory[addr++]; - u8 x = gbMemory[addr++]; - u8 tile = gbMemory[addr++]; + uint8_t y = gbMemory[addr++]; + uint8_t x = gbMemory[addr++]; + uint8_t tile = gbMemory[addr++]; if (size) tile &= 254; - u8 flags = gbMemory[addr++]; + uint8_t flags = gbMemory[addr++]; - u8* bmp = data; + uint8_t* bmp = data; w = 8; h = size ? 16 : 8; setAttributes(y, x, tile, flags); - u8* bank0; - u8* bank1; + uint8_t* bank0; + uint8_t* bank1; if (gbCgbMode) { bank0 = &gbVram[0x0000]; bank1 = &gbVram[0x2000]; @@ -172,7 +172,7 @@ void GBOamView::render() int init = 0x0000; - u8* pal = gbObp0; + uint8_t* pal = gbObp0; if ((flags & 0x10)) pal = gbObp1; @@ -191,8 +191,8 @@ void GBOamView::render() } for (int xx = 0; xx < 8; xx++) { - u8 mask = 1 << (7 - xx); - u8 c = 0; + uint8_t mask = 1 << (7 - xx); + uint8_t c = 0; if ((a & mask)) c++; if ((b & mask)) @@ -205,7 +205,7 @@ void GBOamView::render() c = pal[c]; } - u16 color = gbPalette[c]; + uint16_t color = gbPalette[c]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = (color & 0x1f) << 3; @@ -215,7 +215,7 @@ void GBOamView::render() void GBOamView::saveBMP(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -225,29 +225,29 @@ void GBOamView::saveBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + w * h * 3; + uint32_t fsz = sizeof(bmpheader) + w * h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -259,12 +259,12 @@ void GBOamView::saveBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data + 3 * w * (h - 1); + uint8_t* pixU8 = (uint8_t*)data + 3 * w * (h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { *b++ = *pixU8++; // B @@ -282,7 +282,7 @@ void GBOamView::saveBMP(const char* name) void GBOamView::savePNG(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -328,12 +328,12 @@ void GBOamView::savePNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data; + uint8_t* pixU8 = (uint8_t*)data; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int blue = *pixU8++; @@ -467,7 +467,7 @@ void GBOamView::OnClose() LRESULT GBOamView::OnMapInfo(WPARAM, LPARAM lParam) { - u8* colors = (u8*)lParam; + uint8_t* colors = (uint8_t*)lParam; oamZoom.setColors(colors); return TRUE; @@ -475,7 +475,7 @@ LRESULT GBOamView::OnMapInfo(WPARAM, LPARAM lParam) LRESULT GBOamView::OnColInfo(WPARAM wParam, LPARAM lParam) { - u16 c = (u16)wParam; + uint16_t c = (uint16_t)wParam; color.setColor(c); diff --git a/src/win32/GBOamView.h b/src/win32/GBOamView.h index acbd8d6e..f21429b7 100644 --- a/src/win32/GBOamView.h +++ b/src/win32/GBOamView.h @@ -20,7 +20,7 @@ class GBOamView : public ResizeDlg, IUpdateListener { private: BITMAPINFO bmpInfo; - u8* data; + uint8_t* data; int w; int h; int number; diff --git a/src/win32/GBPaletteView.cpp b/src/win32/GBPaletteView.cpp index dc14b9e7..2d023a76 100644 --- a/src/win32/GBPaletteView.cpp +++ b/src/win32/GBPaletteView.cpp @@ -176,8 +176,8 @@ void GBPaletteView::OnClose() LRESULT GBPaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) { - u16 color = (u16)wParam; - u32 address = (u32)lParam; + uint16_t color = (uint16_t)wParam; + uint32_t address = (uint32_t)lParam; CString buffer; bool isOBJ = address >= 32; diff --git a/src/win32/GBPrinterDlg.cpp b/src/win32/GBPrinterDlg.cpp index ff1c7470..66ac04d5 100644 --- a/src/win32/GBPrinterDlg.cpp +++ b/src/win32/GBPrinterDlg.cpp @@ -25,7 +25,7 @@ static char THIS_FILE[] = __FILE__; GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/) : CDialog(GBPrinterDlg::IDD, pParent) { - bitmapData = new u8[160 * 144]; + bitmapData = new uint8_t[160 * 144]; //{{AFX_DATA_INIT(GBPrinterDlg) m_scale = -1; //}}AFX_DATA_INIT @@ -83,7 +83,7 @@ END_MESSAGE_MAP() void GBPrinterDlg::saveAsBMP(const char* name) { - u8 writeBuffer[512 * 3]; + uint8_t writeBuffer[512 * 3]; FILE* fp = fopen(name, "wb"); @@ -93,29 +93,29 @@ void GBPrinterDlg::saveAsBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + 160 * 144 * 3; + uint32_t fsz = sizeof(bmpheader) + 160 * 144 * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -127,12 +127,12 @@ void GBPrinterDlg::saveAsBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; - u8* data = (u8*)bitmapData; - u8* p = data + (160 * 143); + uint8_t* b = writeBuffer; + uint8_t* data = (uint8_t*)bitmapData; + uint8_t* p = data + (160 * 143); for (int y = 0; y < 144; y++) { for (int x = 0; x < 160; x++) { - u8 c = *p++; + uint8_t c = *p++; *b++ = bitmap->bmiColors[c].rgbBlue; *b++ = bitmap->bmiColors[c].rgbGreen; @@ -149,7 +149,7 @@ void GBPrinterDlg::saveAsBMP(const char* name) void GBPrinterDlg::saveAsPNG(const char* name) { - u8 writeBuffer[160 * 3]; + uint8_t writeBuffer[160 * 3]; FILE* fp = fopen(name, "wb"); @@ -196,15 +196,15 @@ void GBPrinterDlg::saveAsPNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = 160; int sizeY = 144; - u8* pixU8 = bitmapData; + uint8_t* pixU8 = bitmapData; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u8 c = *pixU8++; + uint8_t c = *pixU8++; *b++ = bitmap->bmiColors[c].rgbRed; *b++ = bitmap->bmiColors[c].rgbGreen; *b++ = bitmap->bmiColors[c].rgbBlue; @@ -348,7 +348,7 @@ void GBPrinterDlg::OnPrint() } } -void GBPrinterDlg::processData(u8* data) +void GBPrinterDlg::processData(uint8_t* data) { for (int y = 0; y < 0x12; y++) { for (int x = 0; x < 0x14; x++) { @@ -448,7 +448,7 @@ void GBPrinterDlg::OnPaint() SRCCOPY); } -void systemGbPrint(u8* data, +void systemGbPrint(uint8_t* data, int datalen, int pages, int feed, diff --git a/src/win32/GBPrinterDlg.h b/src/win32/GBPrinterDlg.h index edc307a6..5037861f 100644 --- a/src/win32/GBPrinterDlg.h +++ b/src/win32/GBPrinterDlg.h @@ -12,13 +12,13 @@ class GBPrinterDlg : public CDialog { private: - u8 bitmapHeader[sizeof(BITMAPINFO) + 4 * sizeof(RGBQUAD)]; + uint8_t bitmapHeader[sizeof(BITMAPINFO) + 4 * sizeof(RGBQUAD)]; BITMAPINFO* bitmap; - u8* bitmapData; + uint8_t* bitmapData; int scale; // Construction public: - void processData(u8* data); + void processData(uint8_t* data); void saveAsPNG(const char* name); void saveAsBMP(const char* name); GBPrinterDlg(CWnd* pParent = NULL); // standard constructor diff --git a/src/win32/GBTileView.cpp b/src/win32/GBTileView.cpp index 953ff0df..d4d86e80 100644 --- a/src/win32/GBTileView.cpp +++ b/src/win32/GBTileView.cpp @@ -41,7 +41,7 @@ GBTileView::GBTileView(CWnd* pParent /*=NULL*/) bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data = (u8*)calloc(1, 3 * 32 * 32 * 64); + data = (uint8_t*)calloc(1, 3 * 32 * 32 * 64); tileView.setData(data); tileView.setBmpInfo(&bmpInfo); @@ -93,7 +93,7 @@ END_MESSAGE_MAP() void GBTileView::saveBMP(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -103,29 +103,29 @@ void GBTileView::saveBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + w * h * 3; + uint32_t fsz = sizeof(bmpheader) + w * h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -137,12 +137,12 @@ void GBTileView::saveBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data + 3 * w * (h - 1); + uint8_t* pixU8 = (uint8_t*)data + 3 * w * (h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { *b++ = *pixU8++; // B @@ -160,7 +160,7 @@ void GBTileView::saveBMP(const char* name) void GBTileView::savePNG(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -206,12 +206,12 @@ void GBTileView::savePNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data; + uint8_t* pixU8 = (uint8_t*)data; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int blue = *pixU8++; @@ -270,17 +270,17 @@ void GBTileView::OnSave() savePNG(captureBuffer); } -void GBTileView::renderTile(int tile, int x, int y, u8* charBase) +void GBTileView::renderTile(int tile, int x, int y, uint8_t* charBase) { - u8* bmp = &data[24 * x + 8 * 16 * 24 * y]; + uint8_t* bmp = &data[24 * x + 8 * 16 * 24 * y]; for (int j = 0; j < 8; j++) { - u8 mask = 0x80; - u8 tile_a = charBase[tile * 16 + j * 2]; - u8 tile_b = charBase[tile * 16 + j * 2 + 1]; + uint8_t mask = 0x80; + uint8_t tile_a = charBase[tile * 16 + j * 2]; + uint8_t tile_b = charBase[tile * 16 + j * 2 + 1]; for (int i = 0; i < 8; i++) { - u8 c = (tile_a & mask) ? 1 : 0; + uint8_t c = (tile_a & mask) ? 1 : 0; c += ((tile_b & mask) ? 2 : 0); if (gbCgbMode) { @@ -289,7 +289,7 @@ void GBTileView::renderTile(int tile, int x, int y, u8* charBase) c = gbBgp[c]; } - u16 color = gbPalette[c]; + uint16_t color = gbPalette[c]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -306,7 +306,7 @@ void GBTileView::render() int tiles = 0x0000; if (charBase) tiles = 0x0800; - u8* charBase = (gbVram != NULL) ? (bank ? &gbVram[0x2000 + tiles] : &gbVram[tiles]) : &gbMemory[0x8000 + tiles]; + uint8_t* charBase = (gbVram != NULL) ? (bank ? &gbVram[0x2000 + tiles] : &gbVram[tiles]) : &gbMemory[0x8000 + tiles]; int tile = 0; for (int y = 0; y < 16; y++) { @@ -426,7 +426,7 @@ void GBTileView::OnStretch() LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam) { - u8* colors = (u8*)lParam; + uint8_t* colors = (uint8_t*)lParam; zoom.setColors(colors); int x = (int)((wParam & 0xffff) / 8); @@ -435,7 +435,7 @@ LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam) int tiles = 0x0000; if (charBase) tiles = 0x0800; - u32 address = 0x8000 + tiles; + uint32_t address = 0x8000 + tiles; int tile = 16 * y + x; address += 16 * tile; @@ -452,7 +452,7 @@ LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam) LRESULT GBTileView::OnColInfo(WPARAM wParam, LPARAM) { - u16 c = (u16)wParam; + uint16_t c = (uint16_t)wParam; color.setColor(c); diff --git a/src/win32/GBTileView.h b/src/win32/GBTileView.h index 6dd5baca..4df32f4e 100644 --- a/src/win32/GBTileView.h +++ b/src/win32/GBTileView.h @@ -21,7 +21,7 @@ class GBTileView : public ResizeDlg, IUpdateListener { int bank; BitmapControl tileView; BITMAPINFO bmpInfo; - u8* data; + uint8_t* data; ZoomControl zoom; ColorControl color; int w; @@ -31,7 +31,7 @@ class GBTileView : public ResizeDlg, IUpdateListener { public: void paint(); void render(); - void renderTile(int tile, int x, int y, u8* charBase); + void renderTile(int tile, int x, int y, uint8_t* charBase); void savePNG(const char* name); void saveBMP(const char* name); GBTileView(CWnd* pParent = NULL); // standard constructor diff --git a/src/win32/IOViewer.cpp b/src/win32/IOViewer.cpp index 42865b77..b9821d56 100644 --- a/src/win32/IOViewer.cpp +++ b/src/win32/IOViewer.cpp @@ -75,7 +75,7 @@ void IOViewer::OnClose() void IOViewer::bitChange() { CString buffer; - u16 data = 0; + uint16_t data = 0; for (int i = 0; i < 16; i++) { CButton* pWnd = (CButton*)GetDlgItem(IDC_BIT_0 + i); @@ -174,7 +174,7 @@ void IOViewer::update() CString buffer; const IOData* sel = &ioViewRegisters[selected]; - u16 data = sel->address ? *sel->address : (ioMem ? *((u16*)&ioMem[sel->offset]) : 0); + uint16_t data = sel->address ? *sel->address : (ioMem ? *((uint16_t*)&ioMem[sel->offset]) : 0); for (int i = 0; i < 16; i++) { CButton* pWnd = (CButton*)GetDlgItem(IDC_BIT_0 + i); @@ -198,7 +198,7 @@ void IOViewer::OnApply() { if (rom != NULL) { const IOData* sel = &ioViewRegisters[selected]; - u16 res = 0; + uint16_t res = 0; for (int i = 0; i < 16; i++) { CButton* pWnd = (CButton*)GetDlgItem(IDC_BIT_0 + i); diff --git a/src/win32/IOViewerRegs.h b/src/win32/IOViewerRegs.h index a8a30266..4ba08c12 100644 --- a/src/win32/IOViewerRegs.h +++ b/src/win32/IOViewerRegs.h @@ -1,8 +1,8 @@ struct IOData { - u16* address; - u16 offset; + uint16_t* address; + uint16_t offset; char* name; - u16 write; + uint16_t write; char* bits[16]; }; diff --git a/src/win32/Input.h b/src/win32/Input.h index 9d7ea9c1..e6c171fa 100644 --- a/src/win32/Input.h +++ b/src/win32/Input.h @@ -38,7 +38,7 @@ public: virtual bool initialize() = 0; virtual bool readDevices() = 0; - virtual u32 readDevice(int which) = 0; + virtual uint32_t readDevice(int which) = 0; virtual CString getKeyName(LONG_PTR key) = 0; virtual void checkKeys() = 0; virtual void checkMotionKeys() = 0; diff --git a/src/win32/MainWndFile.cpp b/src/win32/MainWndFile.cpp index 07a64650..647756b8 100644 --- a/src/win32/MainWndFile.cpp +++ b/src/win32/MainWndFile.cpp @@ -708,7 +708,7 @@ bool MainWnd::fileImportGSACodeFile(CString& fileName) return false; } - u32 len; + uint32_t len; fread(&len, 1, 4, f); if (len != 14) { fclose(f); diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index 624452ef..9d8565a0 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -1077,9 +1077,9 @@ void MainWnd::OnOptionsGameboyColors() GBColorDlg dlg; if (dlg.DoModal()) { gbPaletteOption = dlg.getWhich(); - memcpy(systemGbPalette, dlg.getColors(), 24 * sizeof(u16)); + memcpy(systemGbPalette, dlg.getColors(), 24 * sizeof(uint16_t)); if (emulating && theApp.cartridgeType == 1) { - memcpy(gbPalette, &systemGbPalette[dlg.getWhich() * 8], 8 * sizeof(u16)); + memcpy(gbPalette, &systemGbPalette[dlg.getWhich() * 8], 8 * sizeof(uint16_t)); } } } diff --git a/src/win32/MainWndTools.cpp b/src/win32/MainWndTools.cpp index 11ec9714..926b1822 100644 --- a/src/win32/MainWndTools.cpp +++ b/src/win32/MainWndTools.cpp @@ -474,7 +474,7 @@ void MainWnd::OnToolsRecordStopmovierecording() // record the last joypad change so that the correct time can be // recorded fwrite(&movieFrame, 1, sizeof(int), theApp.movieFile); - fwrite(&movieLastJoypad, 1, sizeof(u32), theApp.movieFile); + fwrite(&movieLastJoypad, 1, sizeof(uint32_t), theApp.movieFile); fclose(theApp.movieFile); theApp.movieFile = NULL; } diff --git a/src/win32/MapView.cpp b/src/win32/MapView.cpp index b6741475..db0a490e 100644 --- a/src/win32/MapView.cpp +++ b/src/win32/MapView.cpp @@ -39,7 +39,7 @@ MapView::MapView(CWnd* pParent /*=NULL*/) bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data = (u8*)calloc(1, 3 * 1024 * 1024); + data = (uint8_t*)calloc(1, 3 * 1024 * 1024); mapView.setData(data); mapView.setBmpInfo(&bmpInfo); @@ -95,12 +95,12 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MapView message handlers -void MapView::renderTextScreen(u16 control) +void MapView::renderTextScreen(uint16_t control) { - u16* palette = (u16*)paletteRAM; - u8* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; - u16* screenBase = (u16*)&vram[((control >> 8) & 0x1f) * 0x800]; - u8* bmp = data; + uint16_t* palette = (uint16_t*)paletteRAM; + uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + uint16_t* screenBase = (uint16_t*)&vram[((control >> 8) & 0x1f) * 0x800]; + uint8_t* bmp = data; int sizeX = 256; int sizeY = 256; @@ -131,10 +131,10 @@ void MapView::renderTextScreen(u16 control) if (sizeX > 256) screenBase += 0x400; } - u16* screenSource = screenBase + ((yy >> 3) * 32); + uint16_t* screenSource = screenBase + ((yy >> 3) * 32); for (int x = 0; x < sizeX; x++) { - u16 data = *screenSource; + uint16_t data = *screenSource; int tile = data & 0x3FF; int tileX = (x & 7); @@ -145,9 +145,9 @@ void MapView::renderTextScreen(u16 control) if (data & 0x0800) tileY = 7 - tileY; - u8 c = charBase[tile * 64 + tileY * 8 + tileX]; + uint8_t c = charBase[tile * 64 + tileY * 8 + tileX]; - u16 color = palette[c]; + uint16_t color = palette[c]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -172,10 +172,10 @@ void MapView::renderTextScreen(u16 control) if (sizeX > 256) screenBase += 0x400; } - u16* screenSource = screenBase + ((yy >> 3) * 32); + uint16_t* screenSource = screenBase + ((yy >> 3) * 32); for (int x = 0; x < sizeX; x++) { - u16 data = *screenSource; + uint16_t data = *screenSource; int tile = data & 0x3FF; int tileX = (x & 7); @@ -186,7 +186,7 @@ void MapView::renderTextScreen(u16 control) if (data & 0x0800) tileY = 7 - tileY; - u8 color = charBase[tile * 32 + tileY * 4 + (tileX >> 1)]; + uint8_t color = charBase[tile * 32 + tileY * 4 + (tileX >> 1)]; if (tileX & 1) { color = (color >> 4); @@ -195,7 +195,7 @@ void MapView::renderTextScreen(u16 control) } int pal = (*screenSource >> 8) & 0xF0; - u16 color2 = palette[pal + color]; + uint16_t color2 = palette[pal + color]; *bmp++ = ((color2 >> 10) & 0x1f) << 3; *bmp++ = ((color2 >> 5) & 0x1f) << 3; @@ -251,12 +251,12 @@ void MapView::renderTextScreen(u16 control) */ } -void MapView::renderRotScreen(u16 control) +void MapView::renderRotScreen(uint16_t control) { - u16* palette = (u16*)paletteRAM; - u8* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; - u8* screenBase = (u8*)&vram[((control >> 8) & 0x1f) * 0x800]; - u8* bmp = data; + uint16_t* palette = (uint16_t*)paletteRAM; + uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + uint8_t* screenBase = (uint8_t*)&vram[((control >> 8) & 0x1f) * 0x800]; + uint8_t* bmp = data; int sizeX = 128; int sizeY = 128; @@ -284,8 +284,8 @@ void MapView::renderRotScreen(u16 control) int tileX = (x & 7); int tileY = y & 7; - u8 color = charBase[tile * 64 + tileY * 8 + tileX]; - u16 color2 = palette[color]; + uint8_t color = charBase[tile * 64 + tileY * 8 + tileX]; + uint16_t color2 = palette[color]; *bmp++ = ((color2 >> 10) & 0x1f) << 3; *bmp++ = ((color2 >> 5) & 0x1f) << 3; @@ -293,8 +293,8 @@ void MapView::renderRotScreen(u16 control) } } - u32 xx; - u32 yy; + uint32_t xx; + uint32_t yy; switch (bg) { case 2: @@ -365,15 +365,15 @@ void MapView::renderMode2() void MapView::renderMode3() { - u8* bmp = data; - u16* src = (u16*)&vram[0]; + uint8_t* bmp = data; + uint16_t* src = (uint16_t*)&vram[0]; w = 240; h = 160; for (int y = 0; y < 160; y++) { for (int x = 0; x < 240; x++) { - u16 data = *src++; + uint16_t data = *src++; *bmp++ = ((data >> 10) & 0x1f) << 3; *bmp++ = ((data >> 5) & 0x1f) << 3; *bmp++ = (data & 0x1f) << 3; @@ -384,17 +384,17 @@ void MapView::renderMode3() void MapView::renderMode4() { - u8* bmp = data; - u8* src = frame ? &vram[0xa000] : &vram[0]; - u16* pal = (u16*)&paletteRAM[0]; + uint8_t* bmp = data; + uint8_t* src = frame ? &vram[0xa000] : &vram[0]; + uint16_t* pal = (uint16_t*)&paletteRAM[0]; w = 240; h = 160; for (int y = 0; y < 160; y++) { for (int x = 0; x < 240; x++) { - u8 c = *src++; - u16 data = pal[c]; + uint8_t c = *src++; + uint16_t data = pal[c]; *bmp++ = ((data >> 10) & 0x1f) << 3; *bmp++ = ((data >> 5) & 0x1f) << 3; *bmp++ = (data & 0x1f) << 3; @@ -405,15 +405,15 @@ void MapView::renderMode4() void MapView::renderMode5() { - u8* bmp = data; - u16* src = (u16*)(frame ? &vram[0xa000] : &vram[0]); + uint8_t* bmp = data; + uint16_t* src = (uint16_t*)(frame ? &vram[0xa000] : &vram[0]); w = 160; h = 128; for (int y = 0; y < 128; y++) { for (int x = 0; x < 160; x++) { - u16 data = *src++; + uint16_t data = *src++; *bmp++ = ((data >> 10) & 0x1f) << 3; *bmp++ = ((data >> 5) & 0x1f) << 3; *bmp++ = (data & 0x1f) << 3; @@ -493,8 +493,8 @@ void MapView::paint() CString buffer; - u32 charBase = ((control >> 2) & 0x03) * 0x4000 + 0x6000000; - u32 screenBase = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; + uint32_t charBase = ((control >> 2) & 0x03) * 0x4000 + 0x6000000; + uint32_t screenBase = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; buffer.Format("%d", mode); m_mode.SetWindowText(buffer); @@ -697,7 +697,7 @@ void MapView::OnClose() DestroyWindow(); } -u32 MapView::GetTextClickAddress(u32 base, int x, int y) +uint32_t MapView::GetTextClickAddress(uint32_t base, int x, int y) { if (y > 255 && h > 256) { base += 0x800; @@ -713,11 +713,11 @@ u32 MapView::GetTextClickAddress(u32 base, int x, int y) return base; } -u32 MapView::GetClickAddress(int x, int y) +uint32_t MapView::GetClickAddress(int x, int y) { int mode = DISPCNT & 7; - u32 base = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; + uint32_t base = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; // all text bgs (16 bits) if (mode == 0 || (mode < 3 && bg < 2) || mode == 6 || mode == 7) { @@ -737,7 +737,7 @@ u32 MapView::GetClickAddress(int x, int y) LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) { - u8* colors = (u8*)lParam; + uint8_t* colors = (uint8_t*)lParam; mapViewZoom.setColors(colors); int x = (int)(wParam & 0xffff); @@ -747,7 +747,7 @@ LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) buffer.Format("(%d,%d)", x, y); GetDlgItem(IDC_XY)->SetWindowText(buffer); - u32 address = GetClickAddress(x, y); + uint32_t address = GetClickAddress(x, y); buffer.Format("0x%08X", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); @@ -759,7 +759,7 @@ LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) GetDlgItem(IDC_PALETTE_NUM)->SetWindowText("---"); } else if (mode == 0 || bg < 2) { // text bgs - u16 value = *((u16*)&vram[address - 0x6000000]); + uint16_t value = *((uint16_t*)&vram[address - 0x6000000]); int tile = value & 1023; buffer.Format("%d", tile); @@ -786,7 +786,7 @@ LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) LRESULT MapView::OnColInfo(WPARAM wParam, LPARAM lParam) { - u16 c = (u16)wParam; + uint16_t c = (uint16_t)wParam; color.setColor(c); @@ -809,7 +809,7 @@ LRESULT MapView::OnColInfo(WPARAM wParam, LPARAM lParam) void MapView::saveBMP(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -819,29 +819,29 @@ void MapView::saveBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + w * h * 3; + uint32_t fsz = sizeof(bmpheader) + w * h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -853,12 +853,12 @@ void MapView::saveBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data + 3 * w * (h - 1); + uint8_t* pixU8 = (uint8_t*)data + 3 * w * (h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { *b++ = *pixU8++; // B @@ -876,7 +876,7 @@ void MapView::saveBMP(const char* name) void MapView::savePNG(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -922,12 +922,12 @@ void MapView::savePNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data; + uint8_t* pixU8 = (uint8_t*)data; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int blue = *pixU8++; diff --git a/src/win32/MapView.h b/src/win32/MapView.h index eb18660d..42e6f4f1 100644 --- a/src/win32/MapView.h +++ b/src/win32/MapView.h @@ -20,9 +20,9 @@ class MapView : public ResizeDlg, IUpdateListener { private: BITMAPINFO bmpInfo; - u8* data; + uint8_t* data; int frame; - u16 control; + uint16_t control; int bg; int w; int h; @@ -37,8 +37,8 @@ public: void saveBMP(const char* name); afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); - u32 GetClickAddress(int x, int y); - u32 GetTextClickAddress(u32 base, int x, int y); + uint32_t GetClickAddress(int x, int y); + uint32_t GetTextClickAddress(uint32_t base, int x, int y); void update(); void enableButtons(int mode); void paint(); @@ -48,8 +48,8 @@ public: void renderMode2(); void renderMode1(); void renderMode0(); - void renderRotScreen(u16 control); - void renderTextScreen(u16 control); + void renderRotScreen(uint16_t control); + void renderTextScreen(uint16_t control); MapView(CWnd* pParent = NULL); // standard constructor ~MapView(); diff --git a/src/win32/MemoryViewer.cpp b/src/win32/MemoryViewer.cpp index 17b9d07d..b09071e2 100644 --- a/src/win32/MemoryViewer.cpp +++ b/src/win32/MemoryViewer.cpp @@ -60,13 +60,13 @@ void MemoryViewer::setDialog(IMemoryViewerDlg* d) dlg = d; } -void MemoryViewer::setAddress(u32 a) +void MemoryViewer::setAddress(uint32_t a) { address = a; if (displayedLines) { if (addressSize) { - u16 addr = address; - if ((u16)(addr + (displayedLines << 4)) < addr) { + uint16_t addr = address; + if ((uint16_t)(addr + (displayedLines << 4)) < addr) { address = 0xffff - (displayedLines << 4) + 1; } } else { @@ -149,11 +149,11 @@ void MemoryViewer::OnPaint() updateScrollInfo(lines); - u32 addr = address; + uint32_t addr = address; memDC.SetTextColor(RGB(0, 0, 0)); - u8 data[32]; + uint8_t data[32]; RECT r; r.top = 3; @@ -447,7 +447,7 @@ void MemoryViewer::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) } } -void MemoryViewer::moveAddress(s32 offset, int nibbleOff) +void MemoryViewer::moveAddress(int32_t offset, int nibbleOff) { if (offset == 0) { if (nibbleOff == -1) { @@ -456,7 +456,7 @@ void MemoryViewer::moveAddress(s32 offset, int nibbleOff) editAddress -= (maxNibble + 1) >> 1; editNibble = maxNibble; } - if (address == 0 && (editAddress >= (u32)(displayedLines << 4))) { + if (address == 0 && (editAddress >= (uint32_t)(displayedLines << 4))) { editAddress = 0; editNibble = 0; beep(); @@ -522,7 +522,7 @@ bool MemoryViewer::OnEditInput(UINT c) if (!editAscii) c = tolower(c); - u32 value = 256; + uint32_t value = 256; if (c >= 'a' && c <= 'f') value = 10 + (c - 'a'); @@ -535,7 +535,7 @@ bool MemoryViewer::OnEditInput(UINT c) } else { if (value != 256) { value <<= 4 * (maxNibble - editNibble); - u32 mask = ~(15 << 4 * (maxNibble - editNibble)); + uint32_t mask = ~(15 << 4 * (maxNibble - editNibble)); switch (dataSize) { case 0: editData(editAddress, 8, mask, value); @@ -581,7 +581,7 @@ void MemoryViewer::setAddressSize(int s) addressSize = s; } -u32 MemoryViewer::getCurrentAddress() +uint32_t MemoryViewer::getCurrentAddress() { return editAddress; } diff --git a/src/win32/MemoryViewer.h b/src/win32/MemoryViewer.h index 54dff13b..d49df94c 100644 --- a/src/win32/MemoryViewer.h +++ b/src/win32/MemoryViewer.h @@ -13,11 +13,11 @@ class IMemoryViewerDlg { public: - virtual void setCurrentAddress(u32 address) = 0; + virtual void setCurrentAddress(uint32_t address) = 0; }; class MemoryViewer : public CWnd { - u32 address; + uint32_t address; int addressSize; int dataSize; bool hasCaret; @@ -25,7 +25,7 @@ class MemoryViewer : public CWnd { int caretHeight; HFONT font; CSize fontSize; - u32 editAddress; + uint32_t editAddress; int editNibble; int maxNibble; int displayedLines; @@ -43,8 +43,8 @@ public: public: // Operations public: - virtual void readData(u32, int, u8*) = 0; - virtual void editData(u32, int, int, u32) = 0; + virtual void readData(uint32_t, int, uint8_t*) = 0; + virtual void editData(uint32_t, int, int, uint32_t) = 0; // Overrides // ClassWizard generated virtual function overrides @@ -54,18 +54,18 @@ public: // Implementation public: int getSize(); - u32 getCurrentAddress(); + uint32_t getCurrentAddress(); void setAddressSize(int s); void registerClass(); void beep(); bool OnEditInput(UINT c); - void moveAddress(s32 offset, int nibbleOff); + void moveAddress(int32_t offset, int nibbleOff); void setCaretPos(); void destroyEditCaret(); void createEditCaret(int w, int h); void updateScrollInfo(int lines); void setSize(int s); - void setAddress(u32 a); + void setAddress(uint32_t a); void setDialog(IMemoryViewerDlg* d); virtual ~MemoryViewer(); diff --git a/src/win32/MemoryViewerAddressSize.cpp b/src/win32/MemoryViewerAddressSize.cpp index dcc550af..6530e8a4 100644 --- a/src/win32/MemoryViewerAddressSize.cpp +++ b/src/win32/MemoryViewerAddressSize.cpp @@ -11,7 +11,7 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // MemoryViewerAddressSize dialog -MemoryViewerAddressSize::MemoryViewerAddressSize(u32 a, int s, CWnd* pParent /*=NULL*/) +MemoryViewerAddressSize::MemoryViewerAddressSize(uint32_t a, int s, CWnd* pParent /*=NULL*/) : CDialog(MemoryViewerAddressSize::IDD, pParent) { //{{AFX_DATA_INIT(MemoryViewerAddressSize) @@ -90,7 +90,7 @@ void MemoryViewerAddressSize::OnCancel() EndDialog(FALSE); } -void MemoryViewerAddressSize::setAddress(u32 a) +void MemoryViewerAddressSize::setAddress(uint32_t a) { address = a; } @@ -100,7 +100,7 @@ void MemoryViewerAddressSize::setSize(int s) size = s; } -u32 MemoryViewerAddressSize::getAddress() +uint32_t MemoryViewerAddressSize::getAddress() { return address; } diff --git a/src/win32/MemoryViewerAddressSize.h b/src/win32/MemoryViewerAddressSize.h index ff2f0adf..a111aef7 100644 --- a/src/win32/MemoryViewerAddressSize.h +++ b/src/win32/MemoryViewerAddressSize.h @@ -12,15 +12,15 @@ // MemoryViewerAddressSize dialog class MemoryViewerAddressSize : public CDialog { - u32 address; + uint32_t address; int size; // Construction public: int getSize(); - u32 getAddress(); + uint32_t getAddress(); void setSize(int s); - void setAddress(u32 a); - MemoryViewerAddressSize(u32 a = 0xffffff, int s = -1, CWnd* pParent = NULL); // standard + void setAddress(uint32_t a); + MemoryViewerAddressSize(uint32_t a = 0xffffff, int s = -1, CWnd* pParent = NULL); // standard // constructor // Dialog Data diff --git a/src/win32/MemoryViewerDlg.cpp b/src/win32/MemoryViewerDlg.cpp index ef2f6443..e361525f 100644 --- a/src/win32/MemoryViewerDlg.cpp +++ b/src/win32/MemoryViewerDlg.cpp @@ -23,13 +23,13 @@ extern int emulating; #define CPUWriteByteQuick(addr, b) \ ::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask] = (b) #define CPUReadHalfWordQuick(addr) \ - *((u16*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) + *((uint16_t*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) #define CPUWriteHalfWordQuick(addr, b) \ - *((u16*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) = (b) + *((uint16_t*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) = (b) #define CPUReadMemoryQuick(addr) \ - *((u32*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) + *((uint32_t*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) #define CPUWriteMemoryQuick(addr, b) \ - *((u32*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) = (b) + *((uint32_t*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask]) = (b) ///////////////////////////////////////////////////////////////////////////// // GBAMemoryViewer control @@ -40,7 +40,7 @@ GBAMemoryViewer::GBAMemoryViewer() setAddressSize(0); } -void GBAMemoryViewer::readData(u32 address, int len, u8* data) +void GBAMemoryViewer::readData(uint32_t address, int len, uint8_t* data) { if (emulating && rom != NULL) { for (int i = 0; i < len; i++) { @@ -55,9 +55,9 @@ void GBAMemoryViewer::readData(u32 address, int len, u8* data) } } -void GBAMemoryViewer::editData(u32 address, int size, int mask, u32 value) +void GBAMemoryViewer::editData(uint32_t address, int size, int mask, uint32_t value) { - u32 oldValue; + uint32_t oldValue; switch (size) { case 8: @@ -242,7 +242,7 @@ void MemoryViewerDlg::OnGo() m_address.GetWindowText(buffer); - u32 address; + uint32_t address; sscanf(buffer, "%x", &address); if (m_viewer.getSize() == 1) address &= ~1; @@ -283,7 +283,7 @@ void MemoryViewerDlg::OnSelchangeAddresses() } } -void MemoryViewerDlg::setCurrentAddress(u32 address) +void MemoryViewerDlg::setCurrentAddress(uint32_t address) { CString buffer; @@ -325,7 +325,7 @@ void MemoryViewerDlg::OnSave() } int size = dlg.getSize(); - u32 addr = dlg.getAddress(); + uint32_t addr = dlg.getAddress(); for (int i = 0; i < size; i++) { fputc(CPUReadByteQuick(addr), f); @@ -379,7 +379,7 @@ void MemoryViewerDlg::OnLoad() if (dlg.DoModal() == IDOK) { int size = dlg.getSize(); - u32 addr = dlg.getAddress(); + uint32_t addr = dlg.getAddress(); for (int i = 0; i < size; i++) { int c = fgetc(f); diff --git a/src/win32/MemoryViewerDlg.h b/src/win32/MemoryViewerDlg.h index 90eca07a..748cdf97 100644 --- a/src/win32/MemoryViewerDlg.h +++ b/src/win32/MemoryViewerDlg.h @@ -14,8 +14,8 @@ class GBAMemoryViewer : public MemoryViewer { public: GBAMemoryViewer(); - virtual void readData(u32, int, u8*); - virtual void editData(u32, int, int, u32); + virtual void readData(uint32_t, int, uint8_t*); + virtual void editData(uint32_t, int, int, uint32_t); }; ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ class MemoryViewerDlg : public ResizeDlg, IUpdateListener, IMemoryViewerDlg { GBAMemoryViewer m_viewer; // Construction public: - void setCurrentAddress(u32 address); + void setCurrentAddress(uint32_t address); bool autoUpdate; void update(); MemoryViewerDlg(CWnd* pParent = NULL); // standard constructor diff --git a/src/win32/OamView.cpp b/src/win32/OamView.cpp index 6f351a70..d6b7db3d 100644 --- a/src/win32/OamView.cpp +++ b/src/win32/OamView.cpp @@ -46,7 +46,7 @@ OamViewable::OamViewable(int index, CDialog* parent) bmpInfo.bmiHeader.biCompression = BI_RGB; w = 64; h = 64; - data = (u8*)calloc(1, 3 * 64 * 64); + data = (uint8_t*)calloc(1, 3 * 64 * 64); oamView.setSize(64, 64); oamView.setData(data); oamView.setBmpInfo(&bmpInfo); @@ -70,7 +70,7 @@ OamView::OamView(CWnd* pParent /*=NULL*/) bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data_screen = (u8*)calloc(1, 3 * 240 * 160); + data_screen = (uint8_t*)calloc(1, 3 * 240 * 160); oamScreen.setSize(240, 160); oamScreen.setData(data_screen); oamScreen.setBmpInfo(&bmpInfo); @@ -99,13 +99,13 @@ void OamView::paint() } void OamView::UpdateOAM(int index) { - u16* sprites = &((u16*)oam)[4 * index]; - u16* spritePalette = &((u16*)paletteRAM)[0x100]; - u8* bmp = oamViews[index]->data; + uint16_t* sprites = &((uint16_t*)oam)[4 * index]; + uint16_t* spritePalette = &((uint16_t*)paletteRAM)[0x100]; + uint8_t* bmp = oamViews[index]->data; - u16 a0 = *sprites++; - u16 a1 = *sprites++; - u16 a2 = *sprites++; + uint16_t a0 = *sprites++; + uint16_t a1 = *sprites++; + uint16_t a2 = *sprites++; int sizeY = 8; int sizeX = 8; @@ -169,7 +169,7 @@ void OamView::UpdateOAM(int index) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 8 + (x >> 3) * 64 + (x & 7)) & 0x7FFF)]; + uint32_t color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 8 + (x >> 3) * 64 + (x & 7)) & 0x7FFF)]; color = spritePalette[color]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -187,7 +187,7 @@ void OamView::UpdateOAM(int index) int palette = (a2 >> 8) & 0xF0; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 4 + (x >> 3) * 32 + ((x & 7) >> 1)) & 0x7FFF)]; + uint32_t color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 4 + (x >> 3) * 32 + ((x & 7) >> 1)) & 0x7FFF)]; if (x & 1) color >>= 4; else @@ -213,14 +213,14 @@ void OamView::render() for (int i = 0; i < 128; i++) { UpdateOAM(i); } - u16* sprites = &((u16*)oam)[4 * selectednumber]; - u16 a0 = *sprites++; - u16 a1 = *sprites++; - u16 a2 = *sprites++; + uint16_t* sprites = &((uint16_t*)oam)[4 * selectednumber]; + uint16_t a0 = *sprites++; + uint16_t a1 = *sprites++; + uint16_t a2 = *sprites++; setAttributes(a0, a1, a2); } -void OamView::setAttributes(u16 a0, u16 a1, u16 a2) +void OamView::setAttributes(uint16_t a0, uint16_t a1, uint16_t a2) { CString buffer; @@ -384,7 +384,7 @@ END_MESSAGE_MAP() void OamView::saveBMP(const char* name) { OamViewable* ov = oamViews[selectednumber]; - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -394,29 +394,29 @@ void OamView::saveBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + ov->w * ov->h * 3; + uint32_t fsz = sizeof(bmpheader) + ov->w * ov->h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -428,12 +428,12 @@ void OamView::saveBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = ov->w; int sizeY = ov->h; - u8* pixU8 = (u8*)ov->data + 3 * ov->w * (ov->h - 1); + uint8_t* pixU8 = (uint8_t*)ov->data + 3 * ov->w * (ov->h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { *b++ = *pixU8++; // B @@ -452,7 +452,7 @@ void OamView::saveBMP(const char* name) void OamView::savePNG(const char* name) { OamViewable* ov = oamViews[selectednumber]; - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -498,12 +498,12 @@ void OamView::savePNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = ov->w; int sizeY = ov->h; - u8* pixU8 = (u8*)ov->data; + uint8_t* pixU8 = (uint8_t*)ov->data; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int blue = *pixU8++; diff --git a/src/win32/OamView.h b/src/win32/OamView.h index a6a0d8ea..c5703826 100644 --- a/src/win32/OamView.h +++ b/src/win32/OamView.h @@ -10,7 +10,7 @@ class OamViewable { public: BITMAPINFO bmpInfo; BitmapControl oamView; - u8* data; + uint8_t* data; OamViewable(int index, CDialog* parent); int w; int h; @@ -23,7 +23,7 @@ public: void savePNG(const char* name); void saveBMP(const char* name); void render(); - void setAttributes(u16 a0, u16 a1, u16 a2); + void setAttributes(uint16_t a0, uint16_t a1, uint16_t a2); void paint(); virtual ~OamView(); @@ -36,7 +36,7 @@ public: private: OamViewable* oamViews[128]; BITMAPINFO bmpInfo; - u8* data_screen; + uint8_t* data_screen; BitmapControl oamScreen; BitmapControl oamPreview; void UpdateOAM(int index); diff --git a/src/win32/OpenAL.cpp b/src/win32/OpenAL.cpp index 24c240c2..ee14b76e 100644 --- a/src/win32/OpenAL.cpp +++ b/src/win32/OpenAL.cpp @@ -40,7 +40,7 @@ public: void pause(); // pause the secondary sound buffer void reset(); // stop and reset the secondary sound buffer void resume(); // play/resume the secondary sound buffer - void write(u16* finalWave, int length); // write the emulated sound to a sound buffer + void write(uint16_t* finalWave, int length); // write the emulated sound to a sound buffer private: OPENALFNTABLE ALFunction; @@ -235,7 +235,7 @@ void OpenAL::reset() debugState(); } -void OpenAL::write(u16* finalWave, int length) +void OpenAL::write(uint16_t* finalWave, int length) { if (!initialized) return; diff --git a/src/win32/OpenGL.cpp b/src/win32/OpenGL.cpp index a1d6e5a5..ec28363a 100644 --- a/src/win32/OpenGL.cpp +++ b/src/win32/OpenGL.cpp @@ -28,7 +28,7 @@ #include // main include file #include typedef BOOL(APIENTRY* PFNWGLSWAPINTERVALFARPROC)(int); -extern int Init_2xSaI(u32); +extern int Init_2xSaI(uint32_t); extern void winlog(const char*, ...); extern int systemSpeed; @@ -50,12 +50,12 @@ private: GLuint texture; int width, height; float size; - u8* filterData; + uint8_t* filterData; RECT destRect; bool failed; GLFONT font; int pitch; - u8* data; + uint8_t* data; DWORD currentAdapter; void initializeMatrices(int w, int h); @@ -374,8 +374,8 @@ void OpenGLDisplay::render() theApp.filterFunction( pix + pitch, pitch, - (u8*)theApp.delta, - (u8*)filterData, + (uint8_t*)theApp.delta, + (uint8_t*)filterData, width * 4, filterWidth, filterHeight); @@ -580,7 +580,7 @@ bool OpenGLDisplay::changeRenderSize(int w, int h) } if (filterData) free(filterData); - filterData = (u8*)malloc(4 * w * h); + filterData = (uint8_t*)malloc(4 * w * h); } return true; diff --git a/src/win32/PaletteView.cpp b/src/win32/PaletteView.cpp index b18f4339..2528ae79 100644 --- a/src/win32/PaletteView.cpp +++ b/src/win32/PaletteView.cpp @@ -177,8 +177,8 @@ void PaletteView::OnClose() LRESULT PaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) { - u16 color = (u16)wParam; - u32 address = (u32)lParam; + uint16_t color = (uint16_t)wParam; + uint32_t address = (uint32_t)lParam; CString buffer; if (address >= 0x200) diff --git a/src/win32/PaletteViewControl.cpp b/src/win32/PaletteViewControl.cpp index b080aa4f..7b6d3945 100644 --- a/src/win32/PaletteViewControl.cpp +++ b/src/win32/PaletteViewControl.cpp @@ -25,7 +25,7 @@ PaletteViewControl::PaletteViewControl() bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data = (u8*)malloc(3 * 256 * 256); + data = (uint8_t*)malloc(3 * 256 * 256); w = 256; h = 256; @@ -75,17 +75,17 @@ bool PaletteViewControl::saveAdobe(const char* name) return false; for (int i = 0; i < colors; i++) { - u16 c = palette[i]; + uint16_t c = palette[i]; int r = (c & 0x1f) << 3; int g = (c & 0x3e0) >> 2; int b = (c & 0x7c00) >> 7; - u8 data[3] = { r, g, b }; + uint8_t data[3] = { r, g, b }; fwrite(data, 1, 3, f); } if (colors < 256) { for (int i = colors; i < 256; i++) { - u8 data[3] = { 0, 0, 0 }; + uint8_t data[3] = { 0, 0, 0 }; fwrite(data, 1, 3, f); } } @@ -101,14 +101,14 @@ bool PaletteViewControl::saveMSPAL(const char* name) if (!f) return false; - u8 data[4] = { 'R', 'I', 'F', 'F' }; + uint8_t data[4] = { 'R', 'I', 'F', 'F' }; fwrite(data, 1, 4, f); utilPutDword(data, 256 * 4 + 16); fwrite(data, 1, 4, f); - u8 data3[4] = { 'P', 'A', 'L', ' ' }; + uint8_t data3[4] = { 'P', 'A', 'L', ' ' }; fwrite(data3, 1, 4, f); - u8 data4[4] = { 'd', 'a', 't', 'a' }; + uint8_t data4[4] = { 'd', 'a', 't', 'a' }; fwrite(data4, 1, 4, f); utilPutDword(data, 256 * 4 + 4); fwrite(data, 1, 4, f); @@ -117,17 +117,17 @@ bool PaletteViewControl::saveMSPAL(const char* name) fwrite(data, 1, 4, f); for (int i = 0; i < colors; i++) { - u16 c = palette[i]; + uint16_t c = palette[i]; int r = (c & 0x1f) << 3; int g = (c & 0x3e0) >> 2; int b = (c & 0x7c00) >> 7; - u8 data7[4] = { r, g, b, 0 }; + uint8_t data7[4] = { r, g, b, 0 }; fwrite(data7, 1, 4, f); } if (colors < 256) { for (int i = colors; i < 256; i++) { - u8 data7[4] = { 0, 0, 0, 0 }; + uint8_t data7[4] = { 0, 0, 0, 0 }; fwrite(data7, 1, 4, f); } } @@ -146,7 +146,7 @@ bool PaletteViewControl::saveJASCPAL(const char* name) fprintf(f, "JASC-PAL\r\n0100\r\n256\r\n"); for (int i = 0; i < colors; i++) { - u16 c = palette[i]; + uint16_t c = palette[i]; int r = (c & 0x1f) << 3; int g = (c & 0x3e0) >> 2; int b = (c & 0x7c00) >> 7; @@ -173,9 +173,9 @@ void PaletteViewControl::setSelected(int s) InvalidateRect(NULL, FALSE); } -void PaletteViewControl::render(u16 color, int x, int y) +void PaletteViewControl::render(uint16_t color, int x, int y) { - u8* start = data + y * 16 * w * 3 + x * 16 * 3; + uint8_t* start = data + y * 16 * w * 3 + x * 16 * 3; int skip = w * 3 - 16 * 3; int r = (color & 0x1f) << 3; diff --git a/src/win32/PaletteViewControl.h b/src/win32/PaletteViewControl.h index 22c91a73..afdeb0e8 100644 --- a/src/win32/PaletteViewControl.h +++ b/src/win32/PaletteViewControl.h @@ -15,13 +15,13 @@ class PaletteViewControl : public CWnd { int w; int h; int colors; - u8* data; + uint8_t* data; BITMAPINFO bmpInfo; static bool isRegistered; int selected; protected: - u16 palette[256]; + uint16_t palette[256]; int paletteAddress; // Construction public: @@ -42,7 +42,7 @@ public: public: void registerClass(); void refresh(); - void render(u16 color, int x, int y); + void render(uint16_t color, int x, int y); void setSelected(int s); void setPaletteAddress(int address); bool saveJASCPAL(const char* name); diff --git a/src/win32/RomInfo.cpp b/src/win32/RomInfo.cpp index 6ebc4869..5483b170 100644 --- a/src/win32/RomInfo.cpp +++ b/src/win32/RomInfo.cpp @@ -254,7 +254,7 @@ static LPCTSTR winGBARomInfoFindMakerCode(LPCTSTR code) ///////////////////////////////////////////////////////////////////////////// // RomInfoGB dialog -RomInfoGB::RomInfoGB(u8* rom, CWnd* pParent /*=NULL*/) +RomInfoGB::RomInfoGB(uint8_t* rom, CWnd* pParent /*=NULL*/) : CDialog(RomInfoGB::IDD, pParent) { //{{AFX_DATA_INIT(RomInfoGB) @@ -463,7 +463,7 @@ BOOL RomInfoGB::OnInitDialog() sprintf(buffer, "%02x", rom[0x14c]); GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer); - u8 crc = 25; + uint8_t crc = 25; int i; for (i = 0x134; i < 0x14d; i++) { crc += rom[i]; @@ -474,7 +474,7 @@ BOOL RomInfoGB::OnInitDialog() sprintf(buffer, "%02x (%02x)", crc, rom[0x14d]); GetDlgItem(IDC_ROM_CRC)->SetWindowText(buffer); - u16 crc16 = 0; + uint16_t crc16 = 0; for (i = 0; i < gbRomSize; i++) { crc16 += rom[i]; } @@ -492,7 +492,7 @@ BOOL RomInfoGB::OnInitDialog() ///////////////////////////////////////////////////////////////////////////// // RomInfoGBA dialog -RomInfoGBA::RomInfoGBA(u8* rom, CWnd* pParent /*=NULL*/) +RomInfoGBA::RomInfoGBA(uint8_t* rom, CWnd* pParent /*=NULL*/) : CDialog(RomInfoGBA::IDD, pParent) { //{{AFX_DATA_INIT(RomInfoGBA) @@ -555,7 +555,7 @@ BOOL RomInfoGBA::OnInitDialog() sprintf(buffer, "%02x", rom[0xbc]); GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer); - u8 crc = 0x19; + uint8_t crc = 0x19; for (int i = 0xa0; i < 0xbd; i++) { crc += rom[i]; } diff --git a/src/win32/RomInfo.h b/src/win32/RomInfo.h index 8f9a0aec..912af9e3 100644 --- a/src/win32/RomInfo.h +++ b/src/win32/RomInfo.h @@ -13,7 +13,7 @@ class RomInfoGB : public CDialog { // Construction public: - RomInfoGB(u8* rom, CWnd* pParent = NULL); // standard constructor + RomInfoGB(uint8_t* rom, CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(RomInfoGB) @@ -27,7 +27,7 @@ public: protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL - u8* rom; + uint8_t* rom; // Implementation protected: @@ -45,14 +45,14 @@ protected: class RomInfoGBA : public CDialog { // Construction public: - RomInfoGBA(u8* rom, CWnd* pParent = NULL); // standard constructor + RomInfoGBA(uint8_t* rom, CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(RomInfoGBA) enum { IDD = IDD_GBA_ROM_INFO }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA - u8* rom; + uint8_t* rom; // Overrides // ClassWizard generated virtual function overrides diff --git a/src/win32/TileView.cpp b/src/win32/TileView.cpp index d05f280e..4b853c1d 100644 --- a/src/win32/TileView.cpp +++ b/src/win32/TileView.cpp @@ -42,7 +42,7 @@ TileView::TileView(CWnd* pParent /*=NULL*/) bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biBitCount = 24; bmpInfo.bmiHeader.biCompression = BI_RGB; - data = (u8*)calloc(1, 3 * 32 * 32 * 64); + data = (uint8_t*)calloc(1, 3 * 32 * 32 * 64); tileView.setData(data); tileView.setBmpInfo(&bmpInfo); @@ -97,7 +97,7 @@ END_MESSAGE_MAP() void TileView::saveBMP(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -107,29 +107,29 @@ void TileView::saveBMP(const char* name) } struct { - u8 ident[2]; - u8 filesize[4]; - u8 reserved[4]; - u8 dataoffset[4]; - u8 headersize[4]; - u8 width[4]; - u8 height[4]; - u8 planes[2]; - u8 bitsperpixel[2]; - u8 compression[4]; - u8 datasize[4]; - u8 hres[4]; - u8 vres[4]; - u8 colors[4]; - u8 importantcolors[4]; - u8 pad[2]; + uint8_t ident[2]; + uint8_t filesize[4]; + uint8_t reserved[4]; + uint8_t dataoffset[4]; + uint8_t headersize[4]; + uint8_t width[4]; + uint8_t height[4]; + uint8_t planes[2]; + uint8_t bitsperpixel[2]; + uint8_t compression[4]; + uint8_t datasize[4]; + uint8_t hres[4]; + uint8_t vres[4]; + uint8_t colors[4]; + uint8_t importantcolors[4]; + uint8_t pad[2]; } bmpheader; memset(&bmpheader, 0, sizeof(bmpheader)); bmpheader.ident[0] = 'B'; bmpheader.ident[1] = 'M'; - u32 fsz = sizeof(bmpheader) + w * h * 3; + uint32_t fsz = sizeof(bmpheader) + w * h * 3; utilPutDword(bmpheader.filesize, fsz); utilPutDword(bmpheader.dataoffset, 0x38); utilPutDword(bmpheader.headersize, 0x28); @@ -141,12 +141,12 @@ void TileView::saveBMP(const char* name) fwrite(&bmpheader, 1, sizeof(bmpheader), fp); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data + 3 * w * (h - 1); + uint8_t* pixU8 = (uint8_t*)data + 3 * w * (h - 1); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { *b++ = *pixU8++; // B @@ -164,7 +164,7 @@ void TileView::saveBMP(const char* name) void TileView::savePNG(const char* name) { - u8 writeBuffer[1024 * 3]; + uint8_t writeBuffer[1024 * 3]; FILE* fp = fopen(name, "wb"); @@ -210,12 +210,12 @@ void TileView::savePNG(const char* name) png_write_info(png_ptr, info_ptr); - u8* b = writeBuffer; + uint8_t* b = writeBuffer; int sizeX = w; int sizeY = h; - u8* pixU8 = (u8*)data; + uint8_t* pixU8 = (uint8_t*)data; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int blue = *pixU8++; @@ -276,15 +276,15 @@ void TileView::OnSave() } } -void TileView::renderTile256(int tile, int x, int y, u8* charBase, u16* palette) +void TileView::renderTile256(int tile, int x, int y, uint8_t* charBase, uint16_t* palette) { - u8* bmp = &data[24 * x + 8 * 32 * 24 * y]; + uint8_t* bmp = &data[24 * x + 8 * 32 * 24 * y]; for (int j = 0; j < 8; j++) { for (int i = 0; i < 8; i++) { - u8 c = charBase[tile * 64 + j * 8 + i]; + uint8_t c = charBase[tile * 64 + j * 8 + i]; - u16 color = palette[c]; + uint16_t color = palette[c]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -294,9 +294,9 @@ void TileView::renderTile256(int tile, int x, int y, u8* charBase, u16* palette) } } -void TileView::renderTile16(int tile, int x, int y, u8* charBase, u16* palette) +void TileView::renderTile16(int tile, int x, int y, uint8_t* charBase, uint16_t* palette) { - u8* bmp = &data[24 * x + 8 * 32 * 24 * y]; + uint8_t* bmp = &data[24 * x + 8 * 32 * 24 * y]; int pal = this->palette; @@ -305,14 +305,14 @@ void TileView::renderTile16(int tile, int x, int y, u8* charBase, u16* palette) for (int j = 0; j < 8; j++) { for (int i = 0; i < 8; i++) { - u8 c = charBase[tile * 32 + j * 4 + (i >> 1)]; + uint8_t c = charBase[tile * 32 + j * 4 + (i >> 1)]; if (i & 1) c = c >> 4; else c = c & 15; - u16 color = palette[pal * 16 + c]; + uint16_t color = palette[pal * 16 + c]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -324,8 +324,8 @@ void TileView::renderTile16(int tile, int x, int y, u8* charBase, u16* palette) void TileView::render() { - u16* palette = (u16*)paletteRAM; - u8* charBase = &vram[this->charBase * 0x4000]; + uint16_t* palette = (uint16_t*)paletteRAM; + uint8_t* charBase = &vram[this->charBase * 0x4000]; int maxY; @@ -494,13 +494,13 @@ void TileView::OnStretch() LRESULT TileView::OnMapInfo(WPARAM wParam, LPARAM lParam) { - u8* colors = (u8*)lParam; + uint8_t* colors = (uint8_t*)lParam; zoom.setColors(colors); int x = (int)((wParam & 0xFFFF) / 8); int y = (int)(((wParam >> 16) & 0xFFFF) / 8); - u32 address = 0x6000000 + 0x4000 * charBase; + uint32_t address = 0x6000000 + 0x4000 * charBase; int tile = 32 * y + x; if (is256Colors) tile *= 2; @@ -518,7 +518,7 @@ LRESULT TileView::OnMapInfo(WPARAM wParam, LPARAM lParam) LRESULT TileView::OnColInfo(WPARAM wParam, LPARAM) { - u16 c = (u16)wParam; + uint16_t c = (uint16_t)wParam; color.setColor(c); diff --git a/src/win32/TileView.h b/src/win32/TileView.h index 4b1bd693..24f41765 100644 --- a/src/win32/TileView.h +++ b/src/win32/TileView.h @@ -22,7 +22,7 @@ class TileView : public ResizeDlg, IUpdateListener { int palette; BitmapControl tileView; BITMAPINFO bmpInfo; - u8* data; + uint8_t* data; ZoomControl zoom; ColorControl color; int w; @@ -32,8 +32,8 @@ class TileView : public ResizeDlg, IUpdateListener { public: void paint(); void render(); - void renderTile16(int tile, int x, int y, u8* charBase, u16* palette); - void renderTile256(int tile, int x, int y, u8* charBase, u16* palette); + void renderTile16(int tile, int x, int y, uint8_t* charBase, uint16_t* palette); + void renderTile256(int tile, int x, int y, uint8_t* charBase, uint16_t* palette); void savePNG(const char* name); void saveBMP(const char* name); TileView(CWnd* pParent = NULL); // standard constructor diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 6fb939aa..3715ab37 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -44,50 +44,50 @@ #include "../gba/GBALink.h" /* ---------------- */ -extern void Pixelate(u8*, u32, u8*, u8*, u32, int, int); -extern void Pixelate32(u8*, u32, u8*, u8*, u32, int, int); -extern void _2xSaI(u8*, u32, u8*, u8*, u32, int, int); -extern void _2xSaI32(u8*, u32, u8*, u8*, u32, int, int); -extern void Super2xSaI(u8*, u32, u8*, u8*, u32, int, int); -extern void Super2xSaI32(u8*, u32, u8*, u8*, u32, int, int); -extern void SuperEagle(u8*, u32, u8*, u8*, u32, int, int); -extern void SuperEagle32(u8*, u32, u8*, u8*, u32, int, int); -extern void AdMame2x(u8*, u32, u8*, u8*, u32, int, int); -extern void AdMame2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void Bilinear(u8*, u32, u8*, u8*, u32, int, int); -extern void Bilinear32(u8*, u32, u8*, u8*, u32, int, int); -extern void BilinearPlus(u8*, u32, u8*, u8*, u32, int, int); -extern void BilinearPlus32(u8*, u32, u8*, u8*, u32, int, int); -extern void Scanlines(u8*, u32, u8*, u8*, u32, int, int); -extern void Scanlines32(u8*, u32, u8*, u8*, u32, int, int); -extern void ScanlinesTV(u8*, u32, u8*, u8*, u32, int, int); -extern void ScanlinesTV32(u8*, u32, u8*, u8*, u32, int, int); -extern void hq2x(u8*, u32, u8*, u8*, u32, int, int); -extern void hq2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void lq2x(u8*, u32, u8*, u8*, u32, int, int); -extern void lq2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void Simple2x16(u8*, u32, u8*, u8*, u32, int, int); -extern void Simple2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void Simple3x16(u8*, u32, u8*, u8*, u32, int, int); -extern void Simple3x32(u8*, u32, u8*, u8*, u32, int, int); -extern void Simple4x16(u8*, u32, u8*, u8*, u32, int, int); -extern void Simple4x32(u8*, u32, u8*, u8*, u32, int, int); +extern void Pixelate(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Pixelate32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void _2xSaI(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void _2xSaI32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Super2xSaI(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Super2xSaI32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void SuperEagle(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void SuperEagle32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void AdMame2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void AdMame2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Bilinear(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Bilinear32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void BilinearPlus(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void BilinearPlus32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Scanlines(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Scanlines32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void ScanlinesTV(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void ScanlinesTV32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void lq2x(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void lq2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Simple2x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Simple2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Simple3x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Simple3x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Simple4x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void Simple4x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); #ifndef WIN64 -extern void hq3x16(u8*, u32, u8*, u8*, u32, int, int); -extern void hq4x16(u8*, u32, u8*, u8*, u32, int, int); -extern void hq3x32(u8*, u32, u8*, u8*, u32, int, int); -extern void hq4x32(u8*, u32, u8*, u8*, u32, int, int); +extern void hq3x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq4x16(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq3x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void hq4x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); #endif -extern void xbrz2x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz3x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz4x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz5x32(u8*, u32, u8*, u8*, u32, int, int); -extern void xbrz6x32(u8*, u32, u8*, u8*, u32, int, int); +extern void xbrz2x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz3x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz4x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz5x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); +extern void xbrz6x32(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); -extern void SmartIB(u8*, u32, int, int); -extern void SmartIB32(u8*, u32, int, int); -extern void MotionBlurIB(u8*, u32, int, int); -extern void MotionBlurIB32(u8*, u32, int, int); +extern void SmartIB(uint8_t*, uint32_t, int, int); +extern void SmartIB32(uint8_t*, uint32_t, int, int); +extern void MotionBlurIB(uint8_t*, uint32_t, int, int); +extern void MotionBlurIB32(uint8_t*, uint32_t, int, int); extern IDisplay* newGDIDisplay(); extern IDisplay* newDirectDrawDisplay(); @@ -109,7 +109,7 @@ extern SoundDriver* newXAudio2_Output(); #endif extern void remoteStubSignal(int, int); -extern void remoteOutput(char*, u32); +extern void remoteOutput(char*, uint32_t); extern void remoteStubMain(); extern void remoteSetProtocol(int); extern void remoteCleanUp(); @@ -134,9 +134,9 @@ int RGB_LOW_BITS_MASK = 0; bool b16to32Video = false; int systemFrameSkip = 0; int systemSpeed = 0; -u32 systemColorMap32[0x10000]; -u16 systemColorMap16[0x10000]; -u16 systemGbPalette[24]; +uint32_t systemColorMap32[0x10000]; +uint16_t systemColorMap16[0x10000]; +uint16_t systemGbPalette[24]; int systemRedShift = 0; int systemBlueShift = 0; int systemGreenShift = 0; @@ -149,7 +149,7 @@ int systemVerbose = 0; int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; bool soundBufferLow = 0; void winSignal(int, int); -void winOutput(const char*, u32); +void winOutput(const char*, uint32_t); #ifdef MMX extern "C" bool cpu_mmx; @@ -160,10 +160,10 @@ float K_fCpuSpeed = 100.0f; // was 98.0f before, but why? float K_fTargetFps = 60.0f * K_fCpuSpeed / 100; float K_fDT = 1000.0f / K_fTargetFps; -u32 dwTimeElapse; -u32 dwTime0; -u32 dwTime1; -u32 nFrameCnt; +uint32_t dwTimeElapse; +uint32_t dwTime0; +uint32_t dwTime1; +uint32_t nFrameCnt; float fWantFPS; float fCurFPS; bool bLastSkip; @@ -369,7 +369,7 @@ VBA::~VBA() // record the last joypad change so that the correct time can be // recorded fwrite(&movieFrame, 1, sizeof(int), movieFile); - fwrite(&movieLastJoypad, 1, sizeof(u32), movieFile); + fwrite(&movieLastJoypad, 1, sizeof(uint32_t), movieFile); fclose(movieFile); movieFile = NULL; } @@ -899,14 +899,14 @@ bool systemReadJoypads() return false; } -u32 systemReadJoypad(int which) +uint32_t systemReadJoypad(int which) { if (theApp.input) return theApp.input->readDevice(which); return 0; } -static u8 sensorDarkness = 0xE8; // total darkness (including daylight on rainy days) +static uint8_t sensorDarkness = 0xE8; // total darkness (including daylight on rainy days) // TODO: implement void systemCartridgeRumble(bool) {} @@ -914,7 +914,7 @@ void systemPossibleCartridgeRumble(bool) {} void updateRumbleFrame() {} int systemGetSensorZ() { return 0; } -u8 systemGetSensorDarkness() +uint8_t systemGetSensorDarkness() { return sensorDarkness; } @@ -983,7 +983,7 @@ void systemScreenCapture(int captureNumber) ((MainWnd*)theApp.m_pMainWnd)->screenCapture(captureNumber); } -u32 systemGetClock() +uint32_t systemGetClock() { return GetTickCount(); } @@ -1049,8 +1049,8 @@ void system10Frames(int rate) { if (autoFrameSkip) { - u32 time = systemGetClock(); - u32 diff = time - autoFrameSkipLastTime; + uint32_t time = systemGetClock(); + uint32_t diff = time - autoFrameSkipLastTime; autoFrameSkipLastTime = time; if (diff) { // countermeasure against div/0 when debugging @@ -1104,7 +1104,7 @@ void systemScreenMessage(const char* msg) void systemUpdateSolarSensor() { - u8 sun = 0x0; //sun = 0xE8 - 0xE8 (case 0 and default) + uint8_t sun = 0x0; //sun = 0xE8 - 0xE8 (case 0 and default) int level = sunBars / 10; switch (level) { case 1: @@ -1217,11 +1217,11 @@ void systemOnSoundShutdown() soundRecording = false; } -void systemOnWriteDataToSoundBuffer(const u16* finalWave, int length) +void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) { if (soundRecording) { if (theApp.soundRecorder) { - theApp.soundRecorder->AddSound((const u8*)finalWave, length); + theApp.soundRecorder->AddSound((const uint8_t*)finalWave, length); } else { WAVEFORMATEX format; format.cbSize = 0; @@ -1242,7 +1242,7 @@ void systemOnWriteDataToSoundBuffer(const u16* finalWave, int length) if (theApp.skipAudioFrames) { theApp.skipAudioFrames--; } else { - if (false == theApp.aviRecorder->AddAudioFrame((u8*)finalWave)) { + if (false == theApp.aviRecorder->AddAudioFrame((uint8_t*)finalWave)) { systemMessage(IDS_AVI_CANNOT_WRITE_AUDIO, "Cannot write audio frame to AVI file."); delete theApp.aviRecorder; theApp.aviRecorder = NULL; @@ -1608,7 +1608,7 @@ void VBA::loadSettings() gbPaletteOption = 2; regQueryBinaryValue("gbPalette", (char*)systemGbPalette, - 24 * sizeof(u16)); + 24 * sizeof(uint16_t)); rewindTimer = regQueryDwordValue("rewindTimer", 0); @@ -2393,7 +2393,7 @@ void VBA::movieReadNext() bool movieEnd = false; if (fread(&moviePlayFrame, 1, sizeof(int), movieFile) == sizeof(int)) { - if (fread(&movieNextJoypad, 1, sizeof(u32), movieFile) == sizeof(int)) { + if (fread(&movieNextJoypad, 1, sizeof(uint32_t), movieFile) == sizeof(int)) { // make sure we don't have spurious entries on the movie that can // cause us to play it forever if (moviePlayFrame <= movieFrame) @@ -2530,7 +2530,7 @@ void VBA::saveSettings() regSetDwordValue("gbPaletteOption", gbPaletteOption); regSetBinaryValue("gbPalette", (char*)systemGbPalette, - 24 * sizeof(u16)); + 24 * sizeof(uint16_t)); regSetDwordValue("rewindTimer", rewindTimer / 6); @@ -2593,7 +2593,7 @@ void winSignal(int, int) #define CPUReadByteQuick(addr) \ map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] -void winOutput(const char* s, u32 addr) +void winOutput(const char* s, uint32_t addr) { if (s) { toolsLog(s); @@ -2670,8 +2670,8 @@ bool Sm60FPS_CanSkipFrame() void Sm60FPS_Sleep() { if (autoFrameSkip) { - u32 dwTimePass = Sm60FPS::dwTimeElapse + (GetTickCount() - Sm60FPS::dwTime0); - u32 dwTimeShould = (u32)(Sm60FPS::nFrameCnt * Sm60FPS::K_fDT); + uint32_t dwTimePass = Sm60FPS::dwTimeElapse + (GetTickCount() - Sm60FPS::dwTime0); + uint32_t dwTimeShould = (uint32_t)(Sm60FPS::nFrameCnt * Sm60FPS::K_fDT); if (dwTimeShould > dwTimePass && !gba_joybus_active) { Sleep(dwTimeShould - dwTimePass); } diff --git a/src/win32/VBA.h b/src/win32/VBA.h index e93f9367..63620b34 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -115,11 +115,11 @@ public: Input* input; - u8* delta[257 * 244 * 4]; + uint8_t* delta[257 * 244 * 4]; unsigned int maxCpuCores; // maximum number of CPU cores VBA should use, 0 means auto-detect unsigned int skipAudioFrames; - void (*filterFunction)(u8*, u32, u8*, u8*, u32, int, int); - void (*ifbFunction)(u8*, u32, int, int); + void (*filterFunction)(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); + void (*ifbFunction)(uint8_t*, uint32_t, int, int); WavWriter* soundRecorder; bool changingVideoSize; diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index 0452555f..acffecf3 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -144,7 +144,7 @@ CAPTION "Waiting for players" FONT 8, "MS Sans Serif" BEGIN PUSHBUTTON "Cancel",IDCANCEL,63,69,50,14 - CONTROL "Progress1",IDC_SERVERWAIT,"msctls_progress32",WS_BORDER,33,50,120,13 + CONTROL "Progress1",IDC_SERVERWAIT,"msctls_progresint32_t",WS_BORDER,33,50,120,13 LTEXT "",IDC_STATIC1,7,7,154,8 LTEXT "",IDC_STATIC2,7,17,105,8 LTEXT "",IDC_STATIC3,7,25,105,8 diff --git a/src/win32/WavWriter.cpp b/src/win32/WavWriter.cpp index 056cfce5..3ea0f870 100644 --- a/src/win32/WavWriter.cpp +++ b/src/win32/WavWriter.cpp @@ -31,9 +31,9 @@ WavWriter::~WavWriter() void WavWriter::Close() { // calculate the total file length - u32 len = ftell(m_file) - 8; + uint32_t len = ftell(m_file) - 8; fseek(m_file, 4, SEEK_SET); - u8 data[4]; + uint8_t data[4]; utilPutDword(data, len); fwrite(data, 1, 4, m_file); // write out the size of the data section @@ -53,13 +53,13 @@ bool WavWriter::Open(const char* name) if (!m_file) return false; // RIFF header - u8 data[4] = { 'R', 'I', 'F', 'F' }; + uint8_t data[4] = { 'R', 'I', 'F', 'F' }; fwrite(data, 1, 4, m_file); utilPutDword(data, 0); // write 0 for now. Will get filled during close fwrite(data, 1, 4, m_file); // write WAVE header - u8 data2[4] = { 'W', 'A', 'V', 'E' }; + uint8_t data2[4] = { 'W', 'A', 'V', 'E' }; fwrite(data2, 1, 4, m_file); return true; } @@ -69,14 +69,14 @@ void WavWriter::SetFormat(const WAVEFORMATEX* format) if (m_file == NULL) return; // write fmt header - u8 data[4] = { 'f', 'm', 't', ' ' }; + uint8_t data[4] = { 'f', 'm', 't', ' ' }; fwrite(data, 1, 4, m_file); - u32 value = sizeof(WAVEFORMATEX); + uint32_t value = sizeof(WAVEFORMATEX); utilPutDword(data, value); fwrite(data, 1, 4, m_file); fwrite(format, 1, sizeof(WAVEFORMATEX), m_file); // start data header - u8 data2[4] = { 'd', 'a', 't', 'a' }; + uint8_t data2[4] = { 'd', 'a', 't', 'a' }; fwrite(data2, 1, 4, m_file); m_posSize = ftell(m_file); @@ -85,7 +85,7 @@ void WavWriter::SetFormat(const WAVEFORMATEX* format) fwrite(data, 1, 4, m_file); } -void WavWriter::AddSound(const u8* data, int len) +void WavWriter::AddSound(const uint8_t* data, int len) { if (m_file == NULL) return; diff --git a/src/win32/WavWriter.h b/src/win32/WavWriter.h index 27dd6b5d..2a7bee24 100644 --- a/src/win32/WavWriter.h +++ b/src/win32/WavWriter.h @@ -19,7 +19,7 @@ public: bool Open(const char* name); void SetFormat(const WAVEFORMATEX* format); - void AddSound(const u8* data, int len); + void AddSound(const uint8_t* data, int len); private: void Close(); diff --git a/src/win32/XAudio2.cpp b/src/win32/XAudio2.cpp index 603d8bee..357f9934 100644 --- a/src/win32/XAudio2.cpp +++ b/src/win32/XAudio2.cpp @@ -175,7 +175,7 @@ public: bool init(long sampleRate); // Sound Data Feed - void write(u16* finalWave, int length); + void write(uint16_t* finalWave, int length); // Play Control void pause(); @@ -440,7 +440,7 @@ bool XAudio2_Output::init(long sampleRate) return true; } -void XAudio2_Output::write(u16* finalWave, int length) +void XAudio2_Output::write(uint16_t* finalWave, int length) { if (!initialized || failed) return; diff --git a/src/win32/ZoomControl.cpp b/src/win32/ZoomControl.cpp index 286ce3aa..6b9e9f9c 100644 --- a/src/win32/ZoomControl.cpp +++ b/src/win32/ZoomControl.cpp @@ -143,7 +143,7 @@ void ZoomControl::OnLButtonDown(UINT nFlags, CPoint point) selected = point.x / multX + 8 * (point.y / multY); int c = point.x / multX + 8 * (point.y / multY); - u16 color = colors[c * 3] << 7 | colors[c * 3 + 1] << 2 | (colors[c * 3 + 2] >> 3); + uint16_t color = colors[c * 3] << 7 | colors[c * 3 + 1] << 2 | (colors[c * 3 + 2] >> 3); GetParent()->PostMessage(WM_COLINFO, color, @@ -157,7 +157,7 @@ BOOL ZoomControl::OnEraseBkgnd(CDC* pDC) return TRUE; } -void ZoomControl::setColors(const u8* c) +void ZoomControl::setColors(const uint8_t* c) { memcpy(colors, c, 3 * 64); selected = -1; diff --git a/src/win32/ZoomControl.h b/src/win32/ZoomControl.h index 81107e02..bcd9875e 100644 --- a/src/win32/ZoomControl.h +++ b/src/win32/ZoomControl.h @@ -30,7 +30,7 @@ public: // Implementation public: - void setColors(const u8* c); + void setColors(const uint8_t* c); static bool isRegistered; virtual ~ZoomControl(); @@ -44,7 +44,7 @@ protected: DECLARE_MESSAGE_MAP() private: int selected; - u8 colors[3 * 64]; + uint8_t colors[3 * 64]; void registerClass(); }; diff --git a/src/win32/rpi.cpp b/src/win32/rpi.cpp index 658da595..192d1a8f 100644 --- a/src/win32/rpi.cpp +++ b/src/win32/rpi.cpp @@ -2,7 +2,7 @@ #include "VBA.h" #include "stdafx.h" -extern void SuperEagle(u8*, u32, u8*, u8*, u32, int, int); +extern void SuperEagle(uint8_t*, uint32_t, uint8_t*, uint8_t*, uint32_t, int, int); static HINSTANCE rpiDLL = NULL; static RENDPLUG_Output fnOutput = NULL; @@ -14,8 +14,8 @@ static int nScaleFactor; extern int systemRedShift, systemGreenShift, systemBlueShift; extern int realsystemRedShift, realsystemGreenShift, realsystemBlueShift; extern int realsystemColorDepth; -u8* pBuffer16 = NULL; -u32 Buffer16Size = 0; +uint8_t* pBuffer16 = NULL; +uint32_t Buffer16Size = 0; bool rpiInit(const char* sPluginName) { @@ -67,19 +67,19 @@ bool rpiInit(const char* sPluginName) return true; } -void rpiFilter(u8* srcPtr, u32 srcPitch, u8* deltaPtr, u8* dstPtr, u32 dstPitch, int width, int height) +void rpiFilter(uint8_t* srcPtr, uint32_t srcPitch, uint8_t* deltaPtr, uint8_t* dstPtr, uint32_t dstPitch, int width, int height) { - u8* pBuff; + uint8_t* pBuff; if (realsystemColorDepth == 32) { // Kega filters are 16 bit only. Assumes we've forced 16 bit input ASSERT(systemColorDepth == 16); - u32 bufferNeeded = dstPitch * (height + nScaleFactor) * nScaleFactor; + uint32_t bufferNeeded = dstPitch * (height + nScaleFactor) * nScaleFactor; if (Buffer16Size < bufferNeeded) { Buffer16Size = bufferNeeded; if (pBuffer16) free(pBuffer16); - pBuffer16 = (u8*)malloc(Buffer16Size); + pBuffer16 = (uint8_t*)malloc(Buffer16Size); } pBuff = pBuffer16; } else @@ -110,11 +110,11 @@ void rpiFilter(u8* srcPtr, u32 srcPitch, u8* deltaPtr, u8* dstPtr, u32 dstPitch, int gshiftDiff = realsystemGreenShift - systemGreenShift; int bshiftDiff = realsystemBlueShift - systemBlueShift; - u16 *pI, *pICur; - u32 *pO, *pOCur; + uint16_t *pI, *pICur; + uint32_t *pO, *pOCur; - pI = pICur = (u16*)pBuff; - pO = pOCur = (u32*)dstPtr; + pI = pICur = (uint16_t*)pBuff; + pO = pOCur = (uint32_t*)dstPtr; if (rshiftDiff >= 0) { for (j = 0; j < height * nScaleFactor; j++) { @@ -122,8 +122,8 @@ void rpiFilter(u8* srcPtr, u32 srcPitch, u8* deltaPtr, u8* dstPtr, u32 dstPitch, *(pOCur++) = ((*pICur & 0xF800) << rshiftDiff) | ((*pICur & 0x07E0) << gshiftDiff) | ((*pICur & 0x001F) << bshiftDiff); *(pICur++); } - pI = pICur = (u16*)((char*)pI + dstPitch); - pO = pOCur = (u32*)((char*)pO + dstPitch); + pI = pICur = (uint16_t*)((char*)pI + dstPitch); + pO = pOCur = (uint32_t*)((char*)pO + dstPitch); } } else { // red shift is negative. That means we're most likely swapping RGB to BGR @@ -135,8 +135,8 @@ void rpiFilter(u8* srcPtr, u32 srcPitch, u8* deltaPtr, u8* dstPtr, u32 dstPitch, *(pOCur++) = ((*pICur & 0xF800) >> rshiftDiff) | ((*pICur & 0x07E0) << gshiftDiff) | ((*pICur & 0x001F) << bshiftDiff); *(pICur++); } - pI = pICur = (u16*)((char*)pI + dstPitch); - pO = pOCur = (u32*)((char*)pO + dstPitch); + pI = pICur = (uint16_t*)((char*)pI + dstPitch); + pO = pOCur = (uint32_t*)((char*)pO + dstPitch); } } } diff --git a/src/win32/rpi.h b/src/win32/rpi.h index 0809d429..558393cc 100644 --- a/src/win32/rpi.h +++ b/src/win32/rpi.h @@ -70,6 +70,6 @@ typedef RENDER_PLUGIN_INFO* (*RENDPLUG_GetInfo)(void); int rpiScaleFactor(); bool rpiInit(const char* sPluginName); -void rpiFilter(u8* srcPtr, u32 srcPitch, u8* deltaPtr, u8* dstPtr, u32 dstPitch, int width, +void rpiFilter(uint8_t* srcPtr, uint32_t srcPitch, uint8_t* deltaPtr, uint8_t* dstPtr, uint32_t dstPitch, int width, int height); void rpiCleanup(); diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index ff5ac9ff..663bc865 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -743,7 +743,7 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA) setblab("DestCode", gbRom[0x14a]); setblab("LicCode", gbRom[0x14b]); setblab("Version", gbRom[0x14c]); - u8 crc = 25; + uint8_t crc = 25; for (int i = 0x134; i < 0x14d; i++) crc += gbRom[i]; @@ -751,7 +751,7 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA) crc = 256 - crc; s.Printf(wxT("%02x (%02x)"), crc, gbRom[0x14d]); setlab("CRC"); - u16 crc16 = 0; + uint16_t crc16 = 0; for (int i = 0; i < gbRomSize; i++) crc16 += gbRom[i]; @@ -792,7 +792,7 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA) setlab("DeviceType"); setblab("Version", rom[0xbc]); - u8 crc = 0x19; + uint8_t crc = 0x19; for (int i = 0xa0; i < 0xbd; i++) crc += rom[i]; @@ -908,7 +908,7 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import GameShark code file...", CMDEN // FIXME: in my code, I assume file format is little-endian // however, in core code, it is assumed to be native-endian - u32 len; + uint32_t len; char buf[14]; if (f.Read(&len, sizeof(len)) != sizeof(len) || wxUINT32_SWAP_ON_BE(len) != 14 || f.Read(buf, 14) != 14 || memcmp(buf, "SharkPortCODES", 14)) { @@ -921,7 +921,7 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import GameShark code file...", CMDEN if (f.Read(&len, sizeof(len)) != sizeof(len)) len = 0; - u32 game = 0; + uint32_t game = 0; if (len > 1) { wxDialog* seldlg = GetXRCDialog("CodeSelect"); @@ -929,7 +929,7 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import GameShark code file...", CMDEN lst->Clear(); while (len-- > 0) { - u32 slen; + uint32_t slen; if (f.Read(&slen, sizeof(slen)) != sizeof(slen) || slen > 1024) // arbitrary upper bound break; @@ -940,7 +940,7 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import GameShark code file...", CMDEN break; lst->Append(wxString(buf, wxConvLibc, slen)); - u32 ncodes; + uint32_t ncodes; if (f.Read(&ncodes, sizeof(ncodes)) != sizeof(ncodes)) break; diff --git a/src/wx/drawing.h b/src/wx/drawing.h index cb3deb04..df17bfdc 100644 --- a/src/wx/drawing.h +++ b/src/wx/drawing.h @@ -1,6 +1,8 @@ #ifndef GAME_DRAWING_H #define GAME_DRAWING_H +#include "wxvbam.h" + class BasicDrawingPanel : public DrawingPanel, public wxPanel { public: BasicDrawingPanel(wxWindow* parent, int _width, int _height); diff --git a/src/wx/dsound.cpp b/src/wx/dsound.cpp index 38e5de7a..2ed26e26 100644 --- a/src/wx/dsound.cpp +++ b/src/wx/dsound.cpp @@ -35,7 +35,7 @@ public: void pause(); // pause the secondary sound buffer void reset(); // stop and reset the secondary sound buffer void resume(); // resume the secondary sound buffer - void write(u16* finalWave, int length); // write the emulated sound to the secondary sound buffer + void write(uint16_t* finalWave, int length); // write the emulated sound to the secondary sound buffer }; DirectSound::DirectSound() @@ -220,7 +220,7 @@ void DirectSound::resume() dsbSecondary->Play(0, 0, DSBPLAY_LOOPING); } -void DirectSound::write(u16* finalWave, int length) +void DirectSound::write(uint16_t* finalWave, int length) { if (!pDirectSound) return; diff --git a/src/wx/filters.h b/src/wx/filters.h index 69694adb..339412e7 100644 --- a/src/wx/filters.h +++ b/src/wx/filters.h @@ -3,81 +3,81 @@ // FIXME: these should be in a system header included by all users and all // files which define these functions -// most 16-bit filters require space in src rounded up to u32 -// those that take delta take 1 src line of pixels, rounded up to u32 size +// most 16-bit filters require space in src rounded up to uint32_t +// those that take delta take 1 src line of pixels, rounded up to uint32_t size // initial value appears to be all-0xff -void Pixelate32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Pixelate(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); +void Pixelate32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Pixelate(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); // next 3*2 use Init_2xSaI(555|565) and do not take into account -int Init_2xSaI(u32 BitFormat); +int Init_2xSaI(uint32_t BitFormat); // endianness or bit shift variables in init. // next 4*2 may be MMX-accelerated -void _2xSaI32(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); -void _2xSaI(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); -// void Scale_2xSaI(u8 *src, u32 spitch, u8 *, u8 *dst, u32 dstp, int w, int h); -void Super2xSaI32(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); -void Super2xSaI(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); -void SuperEagle32(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); -void SuperEagle(u8* src, u32 spitch, u8* delta, u8* dst, u32 dstp, int w, int h); -void AdMame2x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void AdMame2x(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void _2xSaI32(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); +void _2xSaI(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); +// void Scale_2xSaI(uint8_t *src, uint32_t spitch, uint8_t *, uint8_t *dst, uint32_t dstp, int w, int h); +void Super2xSaI32(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); +void Super2xSaI(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); +void SuperEagle32(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); +void SuperEagle(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h); +void AdMame2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void AdMame2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // next 4 convert to rgb24 in internal buffers first, and then back again -void Bilinear32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Bilinear(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void BilinearPlus32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void BilinearPlus(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Scanlines32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Scanlines(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void ScanlinesTV32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void Bilinear32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Bilinear(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void BilinearPlus32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void BilinearPlus(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Scanlines32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Scanlines(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void ScanlinesTV32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // "TV" here means each pixel is faded horizontally & vertically rather than // inserting black scanlines // this depends on RGB_LOW_BITS_MASK extern int RGB_LOW_BITS_MASK; -void ScanlinesTV(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void ScanlinesTV(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // next 2 require calling hq2x_init first and whenever bpp changes void hq2x_init(unsigned bpp); -void hq2x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void hq2x(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void lq2x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void lq2x(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void hq2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void hq2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void lq2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void lq2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // the simple ones could greatly benefit from correct usage of preprocessor.. // in any case, they are worthless, since all renderers do "simple" or // better by default -void Simple2x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Simple2x(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Simple3x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Simple3x(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Simple4x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void Simple4x(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void Simple2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Simple2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Simple3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Simple3x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Simple4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void Simple4x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // note: 16-bit input for asm version only! -void hq3x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void hq3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // this takes 32-bit input // (by converting to 16-bit first in asm version) -void hq3x32_32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void hq3x16(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void hq3x32_32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void hq3x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // note: 16-bit input for asm version only! -void hq4x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void hq4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // this takes 32-bit input // (by converting to 16-bit first in asm version) -void hq4x32_32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void hq4x16(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void hq4x32_32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void hq4x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); -void xbrz2x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void xbrz3x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void xbrz4x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void xbrz5x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); -void xbrz6x32(u8* src, u32 spitch, u8*, u8* dst, u32 dstp, int w, int h); +void xbrz2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void xbrz3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void xbrz4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void xbrz5x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); +void xbrz6x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); // call ifc to ignore previous frame / when starting new void InterframeCleanup(); // all 4 are MMX-accelerated if enabled -void SmartIB(u8* src, u32 spitch, int width, int height); -void SmartIB32(u8* src, u32 spitch, int width, int height); -void MotionBlurIB(u8* src, u32 spitch, int width, int height); -void MotionBlurIB32(u8* src, u32 spitch, int width, int height); -void SmartIB(u8* src, u32 spitch, int width, int starty, int height); -void SmartIB32(u8* src, u32 spitch, int width, int starty, int height); -void MotionBlurIB(u8* src, u32 spitch, int width, int starty, int height); -void MotionBlurIB32(u8* src, u32 spitch, int width, int starty, int height); +void SmartIB(uint8_t* src, uint32_t spitch, int width, int height); +void SmartIB32(uint8_t* src, uint32_t spitch, int width, int height); +void MotionBlurIB(uint8_t* src, uint32_t spitch, int width, int height); +void MotionBlurIB32(uint8_t* src, uint32_t spitch, int width, int height); +void SmartIB(uint8_t* src, uint32_t spitch, int width, int starty, int height); +void SmartIB32(uint8_t* src, uint32_t spitch, int width, int starty, int height); +void MotionBlurIB(uint8_t* src, uint32_t spitch, int width, int starty, int height); +void MotionBlurIB32(uint8_t* src, uint32_t spitch, int width, int starty, int height); #endif /* FILTERS_H */ diff --git a/src/wx/gfxviewers.cpp b/src/wx/gfxviewers.cpp index ffdf55d4..6ce509fc 100644 --- a/src/wx/gfxviewers.cpp +++ b/src/wx/gfxviewers.cpp @@ -22,7 +22,7 @@ } while (0) // FIXME: this should be in a header -extern u8 gbInvertTab[256]; +extern uint8_t gbInvertTab[256]; // avoid exporting classes namespace Viewers { @@ -179,9 +179,9 @@ public: // not paused since last refresh } - u32 AddressFromSel() + uint32_t AddressFromSel() { - u32 base = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; + uint32_t base = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; // all text bgs (16 bits) if (mode == 0 || (mode < 3 && bg < 2) || mode == 6 || mode == 7) { @@ -225,12 +225,12 @@ public: wxString s; s.Printf(wxT("(%d,%d)"), selx, sely); coords->SetLabel(s); - u32 address = AddressFromSel(); + uint32_t address = AddressFromSel(); s.Printf(wxT("0x%08X"), address); addr->SetLabel(s); if (!mode || (mode < 3 || mode > 5) && bg < 2) { - u16 value = *((u16*)&vram[address - 0x6000000]); + uint16_t value = *((uint16_t*)&vram[address - 0x6000000]); s.Printf(wxT("%d"), value & 1023); tile->SetLabel(s); s = value & 1024 ? wxT('H') : wxT('-'); @@ -252,7 +252,7 @@ public: } protected: - u16 control, mode; + uint16_t control, mode; int frame, bg; wxRadioButton *fr0, *fr1, *bg0, *bg1, *bg2, *bg3; wxControl *modelab, *mapbase, *charbase, *size, *colors, *prio, *mosaic, @@ -267,10 +267,10 @@ protected: void renderTextScreen() { - u16* palette = (u16*)paletteRAM; - u8* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; - u16* screenBase = (u16*)&vram[((control >> 8) & 0x1f) * 0x800]; - u8* bmp = image.GetData(); + uint16_t* palette = (uint16_t*)paletteRAM; + uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + uint16_t* screenBase = (uint16_t*)&vram[((control >> 8) & 0x1f) * 0x800]; + uint8_t* bmp = image.GetData(); int sizeX = 256; int sizeY = 256; @@ -305,10 +305,10 @@ protected: screenBase += 0x400; } - u16* screenSource = screenBase + ((yy >> 3) * 32); + uint16_t* screenSource = screenBase + ((yy >> 3) * 32); for (int x = 0; x < sizeX; x++) { - u16 data = *screenSource; + uint16_t data = *screenSource; int tile = data & 0x3FF; int tileX = (x & 7); int tileY = y & 7; @@ -319,8 +319,8 @@ protected: if (data & 0x0800) tileY = 7 - tileY; - u8 c = charBase[tile * 64 + tileY * 8 + tileX]; - u16 color = palette[c]; + uint8_t c = charBase[tile * 64 + tileY * 8 + tileX]; + uint16_t color = palette[c]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = ((color >> 10) & 0x1f) << 3; @@ -349,10 +349,10 @@ protected: screenBase += 0x400; } - u16* screenSource = screenBase + ((yy >> 3) * 32); + uint16_t* screenSource = screenBase + ((yy >> 3) * 32); for (int x = 0; x < sizeX; x++) { - u16 data = *screenSource; + uint16_t data = *screenSource; int tile = data & 0x3FF; int tileX = (x & 7); int tileY = y & 7; @@ -363,7 +363,7 @@ protected: if (data & 0x0800) tileY = 7 - tileY; - u8 color = charBase[tile * 32 + tileY * 4 + (tileX >> 1)]; + uint8_t color = charBase[tile * 32 + tileY * 4 + (tileX >> 1)]; if (tileX & 1) { color = (color >> 4); @@ -372,7 +372,7 @@ protected: } int pal = (*screenSource >> 8) & 0xF0; - u16 color2 = palette[pal + color]; + uint16_t color2 = palette[pal + color]; *bmp++ = (color2 & 0x1f) << 3; *bmp++ = ((color2 >> 5) & 0x1f) << 3; *bmp++ = ((color2 >> 10) & 0x1f) << 3; @@ -438,10 +438,10 @@ protected: void renderRotScreen() { - u16* palette = (u16*)paletteRAM; - u8* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; - u8* screenBase = (u8*)&vram[((control >> 8) & 0x1f) * 0x800]; - u8* bmp = image.GetData(); + uint16_t* palette = (uint16_t*)paletteRAM; + uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + uint8_t* screenBase = (uint8_t*)&vram[((control >> 8) & 0x1f) * 0x800]; + uint8_t* bmp = image.GetData(); int sizeX = 128; int sizeY = 128; @@ -470,8 +470,8 @@ protected: int tile = screenBase[(x >> 3) + (y >> 3) * (sizeX >> 3)]; int tileX = (x & 7); int tileY = y & 7; - u8 color = charBase[tile * 64 + tileY * 8 + tileX]; - u16 color2 = palette[color]; + uint8_t color = charBase[tile * 64 + tileY * 8 + tileX]; + uint16_t color2 = palette[color]; *bmp++ = (color2 & 0x1f) << 3; *bmp++ = ((color2 >> 5) & 0x1f) << 3; *bmp++ = ((color2 >> 10) & 0x1f) << 3; @@ -485,8 +485,8 @@ protected: int tile = screenBase[(x >> 3) + (y >> 3) * (sizeX >> 3)]; int tileX = (x & 7); int tileY = y & 7; - u8 color = charBase[tile * 64 + tileY * 8 + tileX]; - u16 color2 = palette[color]; + uint8_t color = charBase[tile * 64 + tileY * 8 + tileX]; + uint16_t color2 = palette[color]; *bmp++ = (color2 & 0x1f) << 3; *bmp++ = ((color2 >> 5) & 0x1f) << 3; *bmp++ = ((color2 >> 10) & 0x1f) << 3; @@ -496,8 +496,8 @@ protected: bmp += 3 * (1024 - sizeX); } - u32 xx; - u32 yy; + uint32_t xx; + uint32_t yy; switch (bg) { case 2: @@ -530,13 +530,13 @@ protected: void renderMode3() { - u8* bmp = image.GetData(); - u16* src = (u16*)&vram[0]; + uint8_t* bmp = image.GetData(); + uint16_t* src = (uint16_t*)&vram[0]; BMPSize(240, 160); for (int y = 0; y < 160; y++) { for (int x = 0; x < 240; x++) { - u16 data = *src++; + uint16_t data = *src++; *bmp++ = (data & 0x1f) << 3; *bmp++ = ((data >> 5) & 0x1f) << 3; *bmp++ = ((data >> 10) & 0x1f) << 3; @@ -548,15 +548,15 @@ protected: void renderMode4() { - u8* bmp = image.GetData(); - u8* src = frame ? &vram[0xa000] : &vram[0]; - u16* pal = (u16*)&paletteRAM[0]; + uint8_t* bmp = image.GetData(); + uint8_t* src = frame ? &vram[0xa000] : &vram[0]; + uint16_t* pal = (uint16_t*)&paletteRAM[0]; BMPSize(240, 160); for (int y = 0; y < 160; y++) { for (int x = 0; x < 240; x++) { - u8 c = *src++; - u16 data = pal[c]; + uint8_t c = *src++; + uint16_t data = pal[c]; *bmp++ = (data & 0x1f) << 3; *bmp++ = ((data >> 5) & 0x1f) << 3; *bmp++ = ((data >> 10) & 0x1f) << 3; @@ -568,13 +568,13 @@ protected: void renderMode5() { - u8* bmp = image.GetData(); - u16* src = (u16*)(frame ? &vram[0xa000] : &vram[0]); + uint8_t* bmp = image.GetData(); + uint16_t* src = (uint16_t*)(frame ? &vram[0xa000] : &vram[0]); BMPSize(160, 128); for (int y = 0; y < 128; y++) { for (int x = 0; x < 160; x++) { - u16 data = *src++; + uint16_t data = *src++; *bmp++ = (data & 0x1f) << 3; *bmp++ = ((data >> 5) & 0x1f) << 3; *bmp++ = ((data >> 10) & 0x1f) << 3; @@ -612,7 +612,7 @@ public: } void Update() { - u8 *bank0, *bank1; + uint8_t *bank0, *bank1; if (gbCgbMode) { bank0 = &gbVram[0x0000]; @@ -628,13 +628,13 @@ public: for (int y = 0; y < 32; y++) { for (int x = 0; x < 32; x++) { - u8* bmp = &image.GetData()[y * 8 * 32 * 24 + x * 24]; - u8 attrs = 0; + uint8_t* bmp = &image.GetData()[y * 8 * 32 * 24 + x * 24]; + uint8_t attrs = 0; if (bank1 != NULL) attrs = bank1[tile_map_address]; - u8 tile = bank0[tile_map_address]; + uint8_t tile = bank0[tile_map_address]; tile_map_address++; if (charbase) { @@ -646,8 +646,8 @@ public: for (int j = 0; j < 8; j++) { int charbase_address = attrs & 0x40 ? charbase + tile * 16 + (7 - j) * 2 : charbase + tile * 16 + j * 2; - u8 tile_a = 0; - u8 tile_b = 0; + uint8_t tile_a = 0; + uint8_t tile_b = 0; if (attrs & 0x08) { tile_a = bank1[charbase_address++]; @@ -662,16 +662,16 @@ public: tile_b = gbInvertTab[tile_b]; } - u8 mask = 0x80; + uint8_t mask = 0x80; while (mask > 0) { - u8 c = (tile_a & mask) ? 1 : 0; + uint8_t c = (tile_a & mask) ? 1 : 0; c += (tile_b & mask) ? 2 : 0; if (gbCgbMode) c = c + (attrs & 7) * 4; - u16 color = gbPalette[c]; + uint16_t color = gbPalette[c]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = ((color >> 10) & 0x1f) << 3; @@ -711,11 +711,11 @@ public: wxString s; s.Printf(wxT("(%d,%d)"), selx, sely); coords->SetLabel(s); - u16 address = mapbase + 0x8000 + (sely >> 3) * 32 + (selx >> 3); + uint16_t address = mapbase + 0x8000 + (sely >> 3) * 32 + (selx >> 3); s.Printf(wxT("0x%04X"), address); addr->SetLabel(s); - u8 attrs = 0; - u8 tilev = gbMemoryMap[9][address & 0xfff]; + uint8_t attrs = 0; + uint8_t tilev = gbMemoryMap[9][address & 0xfff]; if (gbCgbMode) { attrs = gbVram[0x2000 + address - 0x8000]; @@ -804,9 +804,9 @@ public: systemBlueShift = 19; for (int sprite_no = 0; sprite_no < 128; sprite_no++) { - u16* sparms = &((u16*)oam)[4 * sprite_no]; - u16 a0 = sparms[0], a1 = sparms[1], a2 = sparms[2]; - u16* pal = &((u16*)paletteRAM)[0x100]; + uint16_t* sparms = &((uint16_t*)oam)[4 * sprite_no]; + uint16_t a0 = sparms[0], a1 = sparms[1], a2 = sparms[2]; + uint16_t* pal = &((uint16_t*)paletteRAM)[0x100]; int sizeX = 8, sizeY = 8; // following is almost verbatim from OamView.cpp @@ -878,7 +878,7 @@ public: } wxImage spriteData(64, 64); - u8* bmp = spriteData.GetData(); + uint8_t* bmp = spriteData.GetData(); int sy = (a0 & 255); if (a0 & 0x2000) { @@ -894,7 +894,7 @@ public: for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 8 + (x >> 3) * 64 + (x & 7)) & 0x7FFF)]; + uint32_t color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 8 + (x >> 3) * 64 + (x & 7)) & 0x7FFF)]; color = pal[color]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; @@ -916,7 +916,7 @@ public: for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 4 + (x >> 3) * 32 + ((x & 7) >> 1)) & 0x7FFF)]; + uint32_t color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 4 + (x >> 3) * 32 + ((x & 7) >> 1)) & 0x7FFF)]; if (x & 1) color >>= 4; @@ -969,17 +969,17 @@ public: s.append(a0 & 4096 ? wxT('M') : wxT('-')); s.append(a0 & 1024 ? wxT('D') : wxT('-')); flg->SetLabel(s); - u8* box = spriteData.GetData(); + uint8_t* box = spriteData.GetData(); int sprite_posx = a1 & 511; int sprite_posy = a0 & 255; - u8* screen_box = screen.GetData(); + uint8_t* screen_box = screen.GetData(); if (sprite_posx >= 0 && sprite_posx <= (239 - sizeY) && sprite_posy >= 0 && sprite_posy <= (159 - sizeX)) screen_box += (sprite_posx * 3) + (sprite_posy * screen.GetWidth() * 3); for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { - u32 color = 0; + uint32_t color = 0; if (y == 0 || y == sizeY - 1 || x == 0 || x == sizeX - 1) { color = 255; @@ -1038,23 +1038,23 @@ public: } void Update() { - u8* bmp = image.GetData(); + uint8_t* bmp = image.GetData(); // following is almost verbatim from GBOamView.cpp - u16 addr = sprite * 4 + 0xfe00; + uint16_t addr = sprite * 4 + 0xfe00; int size = register_LCDC & 4; - u8 y = gbMemory[addr++]; - u8 x = gbMemory[addr++]; - u8 tile = gbMemory[addr++]; + uint8_t y = gbMemory[addr++]; + uint8_t x = gbMemory[addr++]; + uint8_t tile = gbMemory[addr++]; if (size) tile &= 254; - u8 flags = gbMemory[addr++]; + uint8_t flags = gbMemory[addr++]; int w = 8; int h = size ? 16 : 8; BMPSize(w, h); - u8* bank0; - u8* bank1; + uint8_t* bank0; + uint8_t* bank1; if (gbCgbMode) { if (register_VBK & 1) { @@ -1070,7 +1070,7 @@ public: } int init = 0x0000; - u8* pal = gbObp0; + uint8_t* pal = gbObp0; if ((flags & 0x10)) pal = gbObp1; @@ -1089,8 +1089,8 @@ public: } for (int xx = 0; xx < 8; xx++) { - u8 mask = 1 << (7 - xx); - u8 c = 0; + uint8_t mask = 1 << (7 - xx); + uint8_t c = 0; if ((a & mask)) c++; @@ -1105,7 +1105,7 @@ public: c = pal[c]; } - u16 color = gbPalette[c]; + uint16_t color = gbPalette[c]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = ((color >> 10) & 0x1f) << 3; @@ -1150,7 +1150,7 @@ void MainFrame::OAMViewer() namespace Viewers { static int ptype = 0; static wxString pdir; -void savepal(wxWindow* parent, const u8* data, int ncols, const wxChar* type) +void savepal(wxWindow* parent, const uint8_t* data, int ncols, const wxChar* type) { // no attempt is made here to translate the palette type name // it's just a suggested name, anyway @@ -1179,19 +1179,19 @@ void savepal(wxWindow* parent, const u8* data, int ncols, const wxChar* type) case 0: // Windows palette { f.Write("RIFF", 4); - u32 d = wxUINT32_SWAP_ON_BE(256 * 4 + 16); + uint32_t d = wxUINT32_SWAP_ON_BE(256 * 4 + 16); f.Write(&d, 4); f.Write("PAL data", 8); d = wxUINT32_SWAP_ON_BE(256 * 4 + 4); f.Write(&d, 4); - u16 w = wxUINT16_SWAP_ON_BE(0x0300); + uint16_t w = wxUINT16_SWAP_ON_BE(0x0300); f.Write(&w, 2); w = wxUINT16_SWAP_ON_BE(256); // cuases problems if not 16 or 256 f.Write(&w, 2); for (int i = 0; i < ncols; i++, data += 3) { f.Write(data, 3); - u8 z = 0; + uint8_t z = 0; f.Write(&z, 1); } @@ -1221,7 +1221,7 @@ void savepal(wxWindow* parent, const u8* data, int ncols, const wxChar* type) case 2: // Adobe color table { f.Write(data, ncols * 3); - u32 d = 0; + uint32_t d = 0; for (int i = ncols; i < 256; i++) f.Write(&d, 3); @@ -1247,8 +1247,8 @@ public: void Update() { if (paletteRAM) { - u16* pp = (u16*)paletteRAM; - u8* bmp = colbmp; + uint16_t* pp = (uint16_t*)paletteRAM; + uint8_t* bmp = colbmp; for (int i = 0; i < 512; i++, pp++) { *bmp++ = (*pp & 0x1f) << 3; @@ -1294,8 +1294,8 @@ public: if (!isbg) off += 16 * 16; - u8* pix = &colbmp[off * 3]; - u16 v = (pix[0] >> 3) + ((pix[1] >> 3) << 5) + ((pix[2] >> 3) << 10); + uint8_t* pix = &colbmp[off * 3]; + uint16_t v = (pix[0] >> 3) + ((pix[1] >> 3) << 5) + ((pix[2] >> 3) << 10); wxString s; s.Printf(wxT("0x%04X"), (int)v); val->SetLabel(s); @@ -1334,7 +1334,7 @@ public: protected: ColorView* cv; PixView *bpv, *spv; - u8 colbmp[16 * 16 * 3 * 2]; + uint8_t colbmp[16 * 16 * 3 * 2]; wxControl *addr, *val; DECLARE_EVENT_TABLE() @@ -1363,8 +1363,8 @@ public: } void Update() { - u16* pp = gbPalette; - u8* bmp = colbmp; + uint16_t* pp = gbPalette; + uint8_t* bmp = colbmp; for (int i = 0; i < 64; i++, pp++) { *bmp++ = (*pp & 0x1f) << 3; @@ -1403,12 +1403,12 @@ public: } } - u8* pix = &colbmp[(x + y * 4) * 3]; + uint8_t* pix = &colbmp[(x + y * 4) * 3]; if (isbg) pix += 4 * 8 * 3; - u16 v = (pix[0] >> 3) + ((pix[1] >> 3) << 5) + ((pix[2] >> 3) << 10); + uint16_t v = (pix[0] >> 3) + ((pix[1] >> 3) << 5) + ((pix[2] >> 3) << 10); wxString s; s.Printf(wxT("0x%04X"), (int)v); val->SetLabel(s); @@ -1427,7 +1427,7 @@ public: protected: ColorView* cv; PixView *bpv, *spv; - u8 colbmp[4 * 8 * 3 * 2]; + uint8_t colbmp[4 * 8 * 3 * 2]; wxControl *idx, *val; DECLARE_EVENT_TABLE() }; @@ -1477,8 +1477,8 @@ public: void Update() { // Following copied almost verbatim from TileView.cpp - u16* palette = (u16*)paletteRAM; - u8* charBase = &vram[charbase]; + uint16_t* palette = (uint16_t*)paletteRAM; + uint8_t* charBase = &vram[charbase]; int maxY; if (is256) { @@ -1548,14 +1548,14 @@ public: } } // following 2 functions copied almost verbatim from TileView.cpp - void render256(int tile, int x, int y, u8* charBase, u16* palette) + void render256(int tile, int x, int y, uint8_t* charBase, uint16_t* palette) { - u8* bmp = &image.GetData()[24 * x + 8 * 32 * 24 * y]; + uint8_t* bmp = &image.GetData()[24 * x + 8 * 32 * 24 * y]; for (int j = 0; j < 8; j++) { for (int i = 0; i < 8; i++) { - u8 c = charBase[tile * 64 + j * 8 + i]; - u16 color = palette[c]; + uint8_t c = charBase[tile * 64 + j * 8 + i]; + uint16_t color = palette[c]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = ((color >> 10) & 0x1f) << 3; @@ -1565,9 +1565,9 @@ public: } } - void render16(int tile, int x, int y, u8* charBase, u16* palette) + void render16(int tile, int x, int y, uint8_t* charBase, uint16_t* palette) { - u8* bmp = &image.GetData()[24 * x + 8 * 32 * 24 * y]; + uint8_t* bmp = &image.GetData()[24 * x + 8 * 32 * 24 * y]; int pal = this->palette; if (this->charbase == 4 * 0x4000) @@ -1575,14 +1575,14 @@ public: for (int j = 0; j < 8; j++) { for (int i = 0; i < 8; i++) { - u8 c = charBase[tile * 32 + j * 4 + (i >> 1)]; + uint8_t c = charBase[tile * 32 + j * 4 + (i >> 1)]; if (i & 1) c = c >> 4; else c = c & 15; - u16 color = palette[pal * 16 + c]; + uint16_t color = palette[pal * 16 + c]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = ((color >> 10) & 0x1f) << 3; @@ -1624,7 +1624,7 @@ public: void Update() { // following copied almost verbatim from GBTileView.cpp - u8* charBase = (gbVram != NULL) ? &gbVram[bank + charbase] : &gbMemory[0x8000 + charbase]; + uint8_t* charBase = (gbVram != NULL) ? &gbVram[bank + charbase] : &gbMemory[0x8000 + charbase]; int tile = 0; for (int y = 0; y < 16; y++) { @@ -1665,17 +1665,17 @@ public: } // following function copied almost verbatim from GBTileView.cpp - void render(int tile, int x, int y, u8* charBase) + void render(int tile, int x, int y, uint8_t* charBase) { - u8* bmp = &image.GetData()[24 * x + 8 * 16 * 24 * y]; + uint8_t* bmp = &image.GetData()[24 * x + 8 * 16 * 24 * y]; for (int j = 0; j < 8; j++) { - u8 mask = 0x80; - u8 tile_a = charBase[tile * 16 + j * 2]; - u8 tile_b = charBase[tile * 16 + j * 2 + 1]; + uint8_t mask = 0x80; + uint8_t tile_a = charBase[tile * 16 + j * 2]; + uint8_t tile_b = charBase[tile * 16 + j * 2 + 1]; for (int i = 0; i < 8; i++) { - u8 c = (tile_a & mask) ? 1 : 0; + uint8_t c = (tile_a & mask) ? 1 : 0; c += ((tile_b & mask) ? 2 : 0); if (gbCgbMode) { @@ -1684,7 +1684,7 @@ public: c = gbBgp[c]; } - u16 color = gbPalette[c]; + uint16_t color = gbPalette[c]; *bmp++ = (color & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; *bmp++ = ((color >> 10) & 0x1f) << 3; diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 7d451df1..59f4938e 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -671,8 +671,8 @@ void CheatList_t::ParseChtLine(wxString desc, wxString tok) wxString cheat_desc = desc + wxT(":") + cheat_opt; wxString cheat_line; wxString cheat_value; - u32 address = 0; - u32 value = 0; + uint32_t address = 0; + uint32_t value = 0; sscanf(cheat_addr.mb_str(), "%8x", &address); if (address < 0x40000) @@ -908,43 +908,43 @@ public: else block->data = &gbMemory[0xa000]; - block->saved = (u8*)malloc(gbRamSize); + block->saved = (uint8_t*)malloc(gbRamSize); block->size = gbRamSize; - block->bits = (u8*)malloc(gbRamSize >> 3); + block->bits = (uint8_t*)malloc(gbRamSize >> 3); if (gbCgbMode) { block++; block->offset = 0xc000; block->data = &gbMemory[0xc000]; - block->saved = (u8*)malloc(0x1000); + block->saved = (uint8_t*)malloc(0x1000); block->size = 0x1000; - block->bits = (u8*)malloc(0x1000 >> 3); + block->bits = (uint8_t*)malloc(0x1000 >> 3); block++; block->offset = 0xd000; block->data = gbWram; - block->saved = (u8*)malloc(0x8000); + block->saved = (uint8_t*)malloc(0x8000); block->size = 0x8000; - block->bits = (u8*)malloc(0x8000 >> 3); + block->bits = (uint8_t*)malloc(0x8000 >> 3); } else { block++; block->offset = 0xc000; block->data = &gbMemory[0xc000]; - block->saved = (u8*)malloc(0x2000); + block->saved = (uint8_t*)malloc(0x2000); block->size = 0x2000; - block->bits = (u8*)malloc(0x2000 >> 3); + block->bits = (uint8_t*)malloc(0x2000 >> 3); } } else { block->size = 0x40000; block->offset = 0x2000000; - block->bits = (u8*)malloc(0x40000 >> 3); + block->bits = (uint8_t*)malloc(0x40000 >> 3); block->data = workRAM; - block->saved = (u8*)malloc(0x40000); + block->saved = (uint8_t*)malloc(0x40000); block++; block->size = 0x8000; block->offset = 0x3000000; - block->bits = (u8*)malloc(0x8000 >> 3); + block->bits = (uint8_t*)malloc(0x8000 >> 3); block->data = internalRAM; - block->saved = (u8*)malloc(0x8000); + block->saved = (uint8_t*)malloc(0x8000); } cheatSearchData.count = (int)((block + 1) - cheatSearchData.blocks); @@ -1053,7 +1053,7 @@ public: return; } - u32 val = GetValue(ca_val, fmt); + uint32_t val = GetValue(ca_val, fmt); if (isgb) { long bank, addr; @@ -1114,7 +1114,7 @@ public: } } - u32 GetValue(wxString& s, int fmt) + uint32_t GetValue(wxString& s, int fmt) { long val; // FIXME: probably ought to throw an error if ToLong @@ -1127,41 +1127,41 @@ public: return val; } - u32 GetValue(int fmt) + uint32_t GetValue(int fmt) { return GetValue(val_s, fmt); } - u32 GetValue() + uint32_t GetValue() { return GetValue(fmt); } - s32 SignedValue(wxString& s, int fmt) + int32_t SignedValue(wxString& s, int fmt) { - s32 val = GetValue(s, fmt); + int32_t val = GetValue(s, fmt); if (fmt == CFVFMT_SD) { if (size == BITS_8) - val = (s32)(s8)val; + val = (int32_t)(int8_t)val; else if (size == BITS_16) - val = (s32)(s16)val; + val = (int32_t)(int16_t)val; } return val; } - s32 SignedValue(int fmt) + int32_t SignedValue(int fmt) { return SignedValue(val_s, fmt); } - s32 SignedValue() + int32_t SignedValue() { return SignedValue(fmt); } - void FormatValue(s32 val, wxString& s) + void FormatValue(int32_t val, wxString& s) { if (fmt != CFVFMT_SD && size != BITS_32) val &= size == BITS_8 ? 0xff : 0xffff; @@ -1197,17 +1197,17 @@ public: dlg->TransferDataFromWindow(); if (ofmt != fmt && !val_s.empty()) { - s32 val = GetValue(ofmt); + int32_t val = GetValue(ofmt); switch (fmt) { case CFVFMT_SD: switch (size) { case BITS_8: - val = (s32)(s8)val; + val = (int32_t)(int8_t)val; break; case BITS_16: - val = (s32)(s16)val; + val = (int32_t)(int16_t)val; } val_s.Printf(wxT("%d"), val); @@ -1359,7 +1359,7 @@ wxString CheatListCtrl::OnGetItemText(long item, long column) const // these are the choices for canned colors; their order must match the // names in the choice control -static const u16 defaultPalettes[][8] = { +static const uint16_t defaultPalettes[][8] = { { // Standard 0x7FFF, 0x56B5, 0x318C, 0x0000, 0x7FFF, 0x56B5, 0x318C, 0x0000, @@ -1408,7 +1408,7 @@ public: void ColorSel(wxCommandEvent& ev) { if (ev.GetSelection() > 0) { - const u16* color = defaultPalettes[ev.GetSelection() - 1]; + const uint16_t* color = defaultPalettes[ev.GetSelection() - 1]; for (int i = 0; i < 8; i++, color++) cp[i]->SetColour(wxColor(((*color << 3) & 0xf8), @@ -1418,7 +1418,7 @@ public: } void ColorReset(wxCommandEvent& ev) { - const u16* color = &systemGbPalette[pno * 8]; + const uint16_t* color = &systemGbPalette[pno * 8]; for (int i = 0; i < 8; i++, color++) cp[i]->SetColour(wxColor(((*color << 3) & 0xf8), @@ -1464,7 +1464,7 @@ public: } void Detect(wxCommandEvent& ev) { - u32 sz = wxGetApp().frame->GetPanel()->game_size(); + uint32_t sz = wxGetApp().frame->GetPanel()->game_size(); utilGBAFindSave(sz); type->SetSelection(saveType); diff --git a/src/wx/ioregs.h b/src/wx/ioregs.h index edf1533d..ad64c315 100644 --- a/src/wx/ioregs.h +++ b/src/wx/ioregs.h @@ -1,10 +1,10 @@ // this is essentially a copy of ../win32/IOViewRegisters.h using translatable // strings and more consts struct IOData { - u16* address; - u16 offset; + uint16_t* address; + uint16_t offset; const wxChar* name; - u16 write; + uint16_t write; const wxChar* bits[16]; }; diff --git a/src/wx/openal.cpp b/src/wx/openal.cpp index a581d017..35ecc72e 100644 --- a/src/wx/openal.cpp +++ b/src/wx/openal.cpp @@ -45,7 +45,7 @@ public: void pause(); // pause the secondary sound buffer void reset(); // stop and reset the secondary sound buffer void resume(); // play/resume the secondary sound buffer - void write(u16* finalWave, int length); // write the emulated sound to a sound buffer + void write(uint16_t* finalWave, int length); // write the emulated sound to a sound buffer private: static OPENALFNTABLE ALFunction; @@ -246,7 +246,7 @@ void OpenAL::reset() debugState(); } -void OpenAL::write(u16* finalWave, int length) +void OpenAL::write(uint16_t* finalWave, int length) { if (!initialized) return; diff --git a/src/wx/opts.h b/src/wx/opts.h index 1d9dc3b0..c00d05c8 100644 --- a/src/wx/opts.h +++ b/src/wx/opts.h @@ -25,7 +25,7 @@ extern struct opts_t { /// GB wxString gb_bios; wxString gbc_bios; - // u16 systemGbPalette[8*3]; + // uint16_t systemGbPalette[8*3]; bool print_auto_page, print_screen_cap; wxString gb_rom_dir; wxString gbc_rom_dir; diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index d36e4dfa..2aeae37a 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -1392,11 +1392,11 @@ public: int nthreads, threadno; int width, height, scale; const RENDER_PLUGIN_INFO* rpi; - u8 *dst, *delta; + uint8_t *dst, *delta; // set this param every round // if NULL, end thread - u8* src; + uint8_t* src; ExitCode Entry() { @@ -1583,7 +1583,7 @@ public: } }; -void DrawingPanel::DrawArea(u8** data) +void DrawingPanel::DrawArea(uint8_t** data) { // double-buffer buffer: // if filtering, this is filter output, retained for redraws @@ -1601,7 +1601,7 @@ void DrawingPanel::DrawArea(u8** data) alloch = GameArea::SGBHeight; } - pixbuf2 = (u8*)calloc(allocstride, (alloch + 2) * scale); + pixbuf2 = (uint8_t*)calloc(allocstride, (alloch + 2) * scale); } if (gopts.filter == FF_NONE) { @@ -1877,8 +1877,8 @@ void BasicDrawingPanel::DrawArea(wxWindowDC& dc) } else if (out_16) { // scaled by filters, top/right borders, transform to 24-bit wxImage im(width * scale, height * scale, false); - u16* src = (u16*)todraw + (width + 2) * scale; // skip top border - u8* dst = im.GetData(); + uint16_t* src = (uint16_t*)todraw + (width + 2) * scale; // skip top border + uint8_t* dst = im.GetData(); for (int y = 0; y < height * scale; y++) { for (int x = 0; x < width * scale; x++, src++) { @@ -1895,8 +1895,8 @@ void BasicDrawingPanel::DrawArea(wxWindowDC& dc) { // scaled by filters, top/right borders, transform to 24-bit wxImage im(width * scale, height * scale, false); - u32* src = (u32*)todraw + (width + 1) * scale; // skip top border - u8* dst = im.GetData(); + uint32_t* src = (uint32_t*)todraw + (width + 1) * scale; // skip top border + uint8_t* dst = im.GetData(); for (int y = 0; y < height * scale; y++) { for (int x = 0; x < width * scale; x++, src++) { @@ -2205,8 +2205,8 @@ void CairoDrawingPanel::DrawArea(wxWindowDC& dc) } surf = cairo_surface_reference(conv_surf); - u16* src = (u16*)todraw + (width + 2) * scale; // skip top border - u32* dst = (u32*)cairo_image_surface_get_data(surf); + uint16_t* src = (uint16_t*)todraw + (width + 2) * scale; // skip top border + uint32_t* dst = (uint32_t*)cairo_image_surface_get_data(surf); for (int y = 0; y < height * scale; y++) { for (int x = 0; x < width * scale; x++, src++) { @@ -2353,7 +2353,7 @@ void GameArea::StopSoundRecording() mf->enable_menus(); } -void GameArea::AddFrame(const u16* data, int length) +void GameArea::AddFrame(const uint16_t* data, int length) { MediaRet ret; @@ -2369,7 +2369,7 @@ void GameArea::AddFrame(const u16* data, int length) } } -void GameArea::AddFrame(const u8* data) +void GameArea::AddFrame(const uint8_t* data) { MediaRet ret; diff --git a/src/wx/sys.cpp b/src/wx/sys.cpp index a402700a..6a8bbd90 100644 --- a/src/wx/sys.cpp +++ b/src/wx/sys.cpp @@ -15,10 +15,10 @@ int systemRedShift; int systemGreenShift; int systemBlueShift; int systemColorDepth; -u16 systemColorMap16[0x10000]; -u32 systemColorMap32[0x10000]; +uint16_t systemColorMap16[0x10000]; +uint32_t systemColorMap32[0x10000]; #define gs555(x) (x | (x << 5) | (x << 10)) -u16 systemGbPalette[24] = { +uint16_t systemGbPalette[24] = { gs555(0x1f), gs555(0x15), gs555(0x0c), 0, gs555(0x1f), gs555(0x15), gs555(0x0c), 0, gs555(0x1f), gs555(0x15), gs555(0x0c), 0, @@ -108,8 +108,8 @@ void systemDrawScreen() wxFFile game_file; bool game_recording, game_playback; -u32 game_frame; -u32 game_joypad; +uint32_t game_frame; +uint32_t game_joypad; void systemStartGameRecording(const wxString& fname) { @@ -126,7 +126,7 @@ void systemStartGameRecording(const wxString& fname) if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false)) fn.append(wxT(".vmv")); - u32 version = 1; + uint32_t version = 1; if (!game_file.Open(fn.c_str(), wxT("wb")) || game_file.Write(&version, sizeof(version)) != sizeof(version)) { wxLogError(_("Cannot open output file %s"), fname.c_str()); @@ -165,7 +165,7 @@ void systemStopGameRecording() mf->enable_menus(); } -u32 game_next_frame, game_next_joypad; +uint32_t game_next_frame, game_next_joypad; void systemStartGamePlayback(const wxString& fname) { @@ -187,14 +187,14 @@ void systemStartGamePlayback(const wxString& fname) if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false)) fn.append(wxT(".vmv")); - u32 version; + uint32_t version; if (!game_file.Open(fn.c_str(), wxT("rb")) || game_file.Read(&version, sizeof(version)) != sizeof(version) || wxUINT32_SWAP_ON_BE(version) != 1) { wxLogError(_("Cannot open recording file %s"), fname.c_str()); return; } - u32 gf, jp; + uint32_t gf, jp; if (game_file.Read(&gf, sizeof(gf)) != sizeof(gf) || game_file.Read(&jp, sizeof(jp)) != sizeof(jp)) { wxLogError(_("Error reading game recording")); @@ -241,7 +241,7 @@ bool systemReadJoypads() } // return information about the given joystick, -1 for default joystick -u32 systemReadJoypad(int joy) +uint32_t systemReadJoypad(int joy) { if (joy < 0 || joy > 3) joy = gopts.default_stick - 1; @@ -251,7 +251,7 @@ u32 systemReadJoypad(int joy) if (turbo) ret |= KEYM_SPEED; - u32 af = autofire; + uint32_t af = autofire; if (ret & KEYM_AUTO_A) { ret |= KEYM_A; @@ -265,7 +265,7 @@ u32 systemReadJoypad(int joy) static int autofire_trigger = 1; static bool autofire_state = true; - u32 af_but = af & ret; + uint32_t af_but = af & ret; if (af_but) { if (!autofire_state) @@ -285,12 +285,12 @@ u32 systemReadJoypad(int joy) ret &= REALKEY_MASK; if (game_recording) { - u32 rret = ret & ~(KEYM_SPEED | KEYM_CAPTURE); + uint32_t rret = ret & ~(KEYM_SPEED | KEYM_CAPTURE); if (rret != game_joypad) { game_joypad = rret; - u32 gf = wxUINT32_SWAP_ON_BE(game_frame); - u32 jp = wxUINT32_SWAP_ON_BE(game_joypad); + uint32_t gf = wxUINT32_SWAP_ON_BE(game_frame); + uint32_t jp = wxUINT32_SWAP_ON_BE(game_joypad); if (game_file.Write(&gf, sizeof(gf)) != sizeof(gf) || game_file.Write(&jp, sizeof(jp)) != sizeof(jp)) { game_file.Close(); @@ -301,7 +301,7 @@ u32 systemReadJoypad(int joy) } else if (game_playback) { while (game_frame >= game_next_frame) { game_joypad = game_next_joypad; - u32 gf, jp; + uint32_t gf, jp; if (game_file.Read(&gf, sizeof(gf)) != sizeof(gf) || game_file.Read(&jp, sizeof(jp)) != sizeof(jp)) { game_file.Close(); @@ -355,9 +355,9 @@ void system10Frames(int rate) if (fs < 0) { // I don't know why this algorithm isn't in common somewhere // as is, I copied it from SDL - static u32 prevclock = 0; + static uint32_t prevclock = 0; static int speedadj = 0; - u32 t = systemGetClock(); + uint32_t t = systemGetClock(); if (!panel->was_paused && prevclock && (t - prevclock) != 10000 / rate) { int speed = t == prevclock ? 100 * 10000 / rate - (t - prevclock) : 100; @@ -448,23 +448,23 @@ void systemLoadRecent() // I need to be implemented } -u32 systemGetClock() +uint32_t systemGetClock() { return wxGetApp().timer.Time(); } void systemCartridgeRumble(bool) {} -static u8 sensorDarkness = 0xE8; // total darkness (including daylight on rainy days) +static uint8_t sensorDarkness = 0xE8; // total darkness (including daylight on rainy days) -u8 systemGetSensorDarkness() +uint8_t systemGetSensorDarkness() { return sensorDarkness; } void systemUpdateSolarSensor() { - u8 sun = 0x0; //sun = 0xE8 - 0xE8 (case 0 and default) + uint8_t sun = 0x0; //sun = 0xE8 - 0xE8 (case 0 and default) int level = sunBars / 10; switch (level) { @@ -644,7 +644,7 @@ int systemGetSensorZ() class PrintDialog : public wxEvtHandler, public wxPrintout { public: - PrintDialog(const u16* data, int lines, bool cont); + PrintDialog(const uint16_t* data, int lines, bool cont); ~PrintDialog(); int ShowModal() { @@ -691,7 +691,7 @@ private: IMPLEMENT_CLASS(PrintDialog, wxEvtHandler) -PrintDialog::PrintDialog(const u16* data, int lines, bool cont) +PrintDialog::PrintDialog(const uint16_t* data, int lines, bool cont) : img(160, lines) , npw(1) , nph(1) @@ -722,7 +722,7 @@ PrintDialog::PrintDialog(const u16* data, int lines, bool cont) for (int y = 0; y < lines; y++) { for (int x = 0; x < 160; x++) { - u16 d = *data++; + uint16_t d = *data++; img.SetRGB(x, y, ((d >> 10) & 0x1f) << 3, ((d >> 5) & 0x1f) << 3, (d & 0x1f) << 3); } @@ -889,16 +889,16 @@ void PrintDialog::DoPrint(wxCommandEvent&) } } -void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont) +void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int cont) { ModalPause mp; // this might take a while, so signal a pause GameArea* panel = wxGetApp().frame->GetPanel(); - static u16* accum_prdata; + static uint16_t* accum_prdata; static int accum_prdata_len = 0, accum_prdata_size = 0; - static u16 prdata[162 * 145] = { 0 }; + static uint16_t prdata[162 * 145] = { 0 }; static int picno = 0; int lines = len / 40; - u16* out = prdata + 162; // 1-pix top border + uint16_t* out = prdata + 162; // 1-pix top border for (int y = 0; y < lines / 8; y++) { for (int x = 0; x < 160 / 8; x++) { @@ -930,7 +930,7 @@ void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont) // assume no bottom margin means "more coming" // probably ought to make this time out somehow // or at the very least dump when the game state changes - u16* to_print = prdata; + uint16_t* to_print = prdata; if ((gopts.print_auto_page && !(feed & 15)) || accum_prdata_len) { if (!accum_prdata_len) @@ -940,9 +940,9 @@ void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont) if (accum_prdata_size < accum_prdata_len) { if (!accum_prdata_size) - accum_prdata = (u16*)calloc(accum_prdata_len, 2); + accum_prdata = (uint16_t*)calloc(accum_prdata_len, 2); else - accum_prdata = (u16*)realloc(accum_prdata, accum_prdata_len * 2); + accum_prdata = (uint16_t*)realloc(accum_prdata, accum_prdata_len * 2); accum_prdata_size = accum_prdata_len; } @@ -983,7 +983,7 @@ void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont) systemGreenShift = 5; systemBlueShift = 0; wxString of = fn.GetFullPath(); - bool ret = captureFormat == 0 ? utilWritePNGFile(of.mb_fn_str(), 160, lines, (u8*)to_print) : utilWriteBMPFile(of.mb_fn_str(), 160, lines, (u8*)to_print); + bool ret = captureFormat == 0 ? utilWritePNGFile(of.mb_fn_str(), 160, lines, (uint8_t*)to_print) : utilWriteBMPFile(of.mb_fn_str(), 160, lines, (uint8_t*)to_print); if (ret) { wxString msg; @@ -1007,9 +1007,9 @@ void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont) if (to_print != accum_prdata) { if (accum_prdata_size < accum_prdata_len) { if (!accum_prdata_size) - accum_prdata = (u16*)calloc(accum_prdata_len, 2); + accum_prdata = (uint16_t*)calloc(accum_prdata_len, 2); else - accum_prdata = (u16*)realloc(accum_prdata, accum_prdata_len * 2); + accum_prdata = (uint16_t*)realloc(accum_prdata, accum_prdata_len * 2); accum_prdata_size = accum_prdata_len; } @@ -1106,7 +1106,7 @@ SoundDriver* systemSoundInit() return 0; } -void systemOnWriteDataToSoundBuffer(const u16* finalWave, int length) +void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) { #ifndef NO_FFMPEG GameArea* panel = wxGetApp().frame->GetPanel(); diff --git a/src/wx/viewers.cpp b/src/wx/viewers.cpp index 66af25f2..b067e574 100644 --- a/src/wx/viewers.cpp +++ b/src/wx/viewers.cpp @@ -2,6 +2,8 @@ // these are all the viewer dialogs except for the ones with graphical areas // they can be instantiated multiple times +#include + #include "../gba/armdis.h" #include "viewsupt.h" #include "wxvbam.h" @@ -70,7 +72,7 @@ public: dis->Refit(70); Fit(); SetMinSize(GetSize()); - dis->maxaddr = (u32)~0; + dis->maxaddr = (uint32_t)~0; dismode = 0; GotoPC(); } @@ -147,7 +149,7 @@ public: char buf[80]; dis->strings.clear(); dis->addrs.clear(); - u32 addr = dis->topaddr; + uint32_t addr = dis->topaddr; bool arm = dismode == 1 || (armState && dismode != 2); dis->back_size = arm ? 4 : 2; @@ -210,7 +212,7 @@ public: dis->Refit(26); Fit(); SetMinSize(GetSize()); - dis->maxaddr = (u32)~0; + dis->maxaddr = (uint32_t)~0; GotoPC(); } void Update() @@ -280,7 +282,7 @@ public: // examination of gbDis shows that max len is 26 chars // (e.g. 0xe2) char buf[30]; - u16 addr = dis->topaddr; + uint16_t addr = dis->topaddr; dis->strings.clear(); dis->addrs.clear(); dis->back_size = 1; @@ -395,7 +397,7 @@ public: void Select(int sel) { int i; - u16 mask; + uint16_t mask; for (mask = 1, i = 0; mask; mask <<= 1, i++) { bit[i]->Enable(mask & ioregs[sel].write); @@ -412,8 +414,8 @@ public: void Update(int sel) { - u16* addr = ioregs[sel].address ? ioregs[sel].address : (u16*)&ioMem[ioregs[sel].offset]; - u16 mask, reg = *addr; + uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&ioMem[ioregs[sel].offset]; + uint16_t mask, reg = *addr; int i; for (mask = 1, i = 0; mask; mask <<= 1, i++) @@ -430,7 +432,7 @@ public: if (ev.GetEventObject() == bit[i]) { // it'd be faster to store the value and just flip // the bit, but it's easier this way - u16 mask, reg = 0; + uint16_t mask, reg = 0; int j; for (mask = 1, j = 0; mask; mask <<= 1, j++) @@ -454,8 +456,8 @@ public: void Apply(wxCommandEvent& ev) { int sel = addr->GetSelection(); - u16* addr = ioregs[sel].address ? ioregs[sel].address : (u16*)&ioMem[ioregs[sel].offset]; - u16 mask, reg = *addr; + uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&ioMem[ioregs[sel].offset]; + uint16_t mask, reg = *addr; reg &= ~ioregs[sel].write; int i; @@ -573,23 +575,23 @@ END_EVENT_TABLE() #define CPUWriteByteQuick(addr, b) \ ::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask] = (b) #define CPUWriteHalfWordQuick(addr, b) \ - WRITE16LE((u16*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask], b) + WRITE16LE((uint16_t*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask], b) #define CPUWriteMemoryQuick(addr, b) \ - WRITE32LE((u32*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask], b) + WRITE32LE((uint32_t*)&::map[(addr) >> 24].address[(addr) & ::map[(addr) >> 24].mask], b) #define GBWriteByteQuick(addr, b) \ - *((u8*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff]) = (b) + *((uint8_t*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff]) = (b) #define GBWriteHalfWordQuick(addr, b) \ - WRITE16LE((u16*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff], b) + WRITE16LE((uint16_t*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff], b) #define GBWriteMemoryQuick(addr, b) \ - WRITE32LE((u32*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff], b) + WRITE32LE((uint32_t*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff], b) #define GBReadMemoryQuick(addr) \ - READ32LE((u32*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff]) + READ32LE((uint32_t*)&gbMemoryMap[(addr) >> 12][(addr)&0xfff]) namespace Viewers { static wxString memsave_dir = wxEmptyString; class MemViewerBase : public Viewer { public: - MemViewerBase(u32 max) + MemViewerBase(uint32_t max) : Viewer(wxT("MemViewer")) { if (!(mv = XRCCTRL(*this, "MemView", MemView))) @@ -654,7 +656,7 @@ public: v.ToULong(&l, 16); Goto(l); } - void Goto(u32 addr) + void Goto(uint32_t addr) { mv->Show(addr, true); } @@ -714,7 +716,7 @@ public: MemLoad(memsave_fn, addr, len); } - virtual void MemLoad(wxString& name, u32 addr, u32 len) = 0; + virtual void MemLoad(wxString& name, uint32_t addr, uint32_t len) = 0; void Save(wxCommandEvent& ev) { @@ -755,7 +757,7 @@ public: MemSave(memsave_fn, addr, len); } - virtual void MemSave(wxString& name, u32 addr, u32 len) = 0; + virtual void MemSave(wxString& name, uint32_t addr, uint32_t len) = 0; protected: int addrlen; @@ -805,7 +807,7 @@ public: void Update() { - u32 addr = mv->topaddr; + uint32_t addr = mv->topaddr; mv->words.resize(mv->nlines * 4); for (int i = 0; i < mv->nlines; i++) { @@ -836,7 +838,7 @@ public: } } - void MemLoad(wxString& name, u32 addr, u32 len) + void MemLoad(wxString& name, uint32_t addr, uint32_t len) { wxFFile f(name, wxT("rb")); @@ -846,8 +848,8 @@ public: // this does the equivalent of the CPUWriteMemoryQuick() while (len > 0) { memoryMap m = map[addr >> 24]; - u32 off = addr & m.mask; - u32 wlen = (off + len) > m.mask ? m.mask + 1 - off : len; + uint32_t off = addr & m.mask; + uint32_t wlen = (off + len) > m.mask ? m.mask + 1 - off : len; wlen = f.Read(m.address + off, wlen); if (wlen < 0) @@ -858,7 +860,7 @@ public: } } - void MemSave(wxString& name, u32 addr, u32 len) + void MemSave(wxString& name, uint32_t addr, uint32_t len) { wxFFile f(name, wxT("wb")); @@ -868,8 +870,8 @@ public: // this does the equivalent of the CPUReadMemoryQuick() while (len > 0) { memoryMap m = map[addr >> 24]; - u32 off = addr & m.mask; - u32 wlen = (off + len) > m.mask ? m.mask + 1 - off : len; + uint32_t off = addr & m.mask; + uint32_t wlen = (off + len) > m.mask ? m.mask + 1 - off : len; wlen = f.Write(m.address + off, wlen); if (wlen < 0) @@ -891,7 +893,7 @@ END_EVENT_TABLE() class GBMemViewer : public MemViewerBase { public: GBMemViewer() - : MemViewerBase((u16)~0) + : MemViewerBase((uint16_t)~0) { bs->Append(_("0x0000 - ROM")); bs->Append(_("0x4000 - ROM")); @@ -913,11 +915,11 @@ public: void Update() { - u32 addr = mv->topaddr; + uint32_t addr = mv->topaddr; mv->words.resize(mv->nlines * 4); for (int i = 0; i < mv->nlines; i++) { - if (i && !(u16)addr) + if (i && !(uint16_t)addr) break; for (int j = 0; j < 4; j++, addr += 4) @@ -944,7 +946,7 @@ public: } } - void MemLoad(wxString& name, u32 addr, u32 len) + void MemLoad(wxString& name, uint32_t addr, uint32_t len) { wxFFile f(name, wxT("rb")); @@ -953,9 +955,9 @@ public: // this does the equivalent of the GBWriteMemoryQuick() while (len > 0) { - u8* maddr = gbMemoryMap[addr >> 12]; - u32 off = addr & 0xfff; - u32 wlen = (off + len) > 0xfff ? 0x1000 - off : len; + uint8_t* maddr = gbMemoryMap[addr >> 12]; + uint32_t off = addr & 0xfff; + uint32_t wlen = (off + len) > 0xfff ? 0x1000 - off : len; wlen = f.Read(maddr + off, wlen); if (wlen < 0) @@ -966,7 +968,7 @@ public: } } - void MemSave(wxString& name, u32 addr, u32 len) + void MemSave(wxString& name, uint32_t addr, uint32_t len) { wxFFile f(name, wxT("wb")); @@ -975,9 +977,9 @@ public: // this does the equivalent of the GBReadMemoryQuick() while (len > 0) { - u8* maddr = gbMemoryMap[addr >> 12]; - u32 off = addr & 0xfff; - u32 wlen = (off + len) > 0xfff ? 0x1000 - off : len; + uint8_t* maddr = gbMemoryMap[addr >> 12]; + uint32_t off = addr & 0xfff; + uint32_t wlen = (off + len) > 0xfff ? 0x1000 - off : len; wlen = f.Write(maddr + off, wlen); if (wlen < 0) diff --git a/src/wx/viewsupt.cpp b/src/wx/viewsupt.cpp index 76019617..ad6e1f39 100644 --- a/src/wx/viewsupt.cpp +++ b/src/wx/viewsupt.cpp @@ -237,11 +237,11 @@ void DisList::SetSel() if (!issel) return; - if (nlines > addrs.size() || (u32)addrs[0] > seladdr || (u32)addrs[nlines - 1] <= seladdr) + if (nlines > addrs.size() || (uint32_t)addrs[0] > seladdr || (uint32_t)addrs[nlines - 1] <= seladdr) return; for (int i = 0, start = 0; i < nlines; i++) { - if ((u32)addrs[i + 1] > seladdr) { + if ((uint32_t)addrs[i + 1] > seladdr) { int end = start + strings[i].size() + 1; // on win32, wx helpfully inserts a CR before every LF // it also doesn't highlight the whole line, but that's @@ -258,12 +258,12 @@ void DisList::SetSel() } } -void DisList::SetSel(u32 addr) +void DisList::SetSel(uint32_t addr) { seladdr = addr; issel = true; - if (addrs.size() < 4 || addrs.size() < nlines || topaddr > addr || (u32)addrs[addrs.size() - 4] < addr) { + if (addrs.size() < 4 || addrs.size() < nlines || topaddr > addr || (uint32_t)addrs[addrs.size() - 4] < addr) { topaddr = addr; strings.clear(); addrs.clear(); @@ -386,7 +386,7 @@ void MemView::ShowCaret() if (addrlab) { wxString lab; - u32 addr = seladdr + selnib / 2; + uint32_t addr = seladdr + selnib / 2; if (!isasc) addr &= ~((1 << fmt) - 1); @@ -414,7 +414,7 @@ void MemView::ShowCaret() void MemView::KeyEvent(wxKeyEvent& ev) { - u32 k = ev.GetKeyCode(); + uint32_t k = ev.GetKeyCode(); int nnib = 2 << fmt; switch (k) { @@ -502,7 +502,7 @@ void MemView::KeyEvent(wxKeyEvent& ev) } } - u32 mask, val; + uint32_t mask, val; if (isasc) { mask = 0xff << bno * 8; @@ -651,7 +651,7 @@ void MemView::Refill(wxDC& dc) line.Printf(maxaddr > 0xffff ? wxT("%08X ") : wxT("%04X "), topaddr + i * 16); for (int j = 0; j < 4; j++) { - u32 v = words[i * 4 + j]; + uint32_t v = words[i * 4 + j]; switch (fmt) { case 0: @@ -675,7 +675,7 @@ void MemView::Refill(wxDC& dc) line.append(wxT(" ")); for (int j = 0; j < 4; j++) { - u32 v = words[i * 4 + j]; + uint32_t v = words[i * 4 + j]; #define appendc(c) line.append(isascii((c)&0xff) && isprint((c)&0xff) ? (wxChar)((c)&0xff) : wxT('.')) appendc(v); appendc(v >> 8); @@ -716,12 +716,12 @@ void MemView::Resize(wxSizeEvent& ev) Refill(); } -void MemView::Show(u32 addr, bool force_update) +void MemView::Show(uint32_t addr, bool force_update) { if (addr < topaddr || addr >= topaddr + (nlines - 1) * 16) { // align to nearest 16-byte block // note that mfc interface only aligns to nearest (1< maxaddr) newtopaddr = maxaddr - nlines * 16 + 1; @@ -737,7 +737,7 @@ void MemView::Show(u32 addr, bool force_update) ShowCaret(); } -u32 MemView::GetAddr() +uint32_t MemView::GetAddr() { if (selnib < 0) return topaddr; diff --git a/src/wx/viewsupt.h b/src/wx/viewsupt.h index 7de1ac69..1e326a3c 100644 --- a/src/wx/viewsupt.h +++ b/src/wx/viewsupt.h @@ -1,8 +1,16 @@ #ifndef WX_VIEWSUPT_H #define WX_VIEWSUPT_H +#include #include #include +#include +#include +#include +#include +#include +#include +#include // avoid exporting too much stuff namespace Viewers { @@ -106,7 +114,7 @@ private: public: // make addr visible and then select it - void SetSel(u32 addr); + void SetSel(uint32_t addr); void UnSel() { issel = false; @@ -121,9 +129,9 @@ public: // how far back to scroll for single line int back_size; // address of top line - u32 topaddr; + uint32_t topaddr; // max address for scrollbar - u32 maxaddr; + uint32_t maxaddr; protected: // assigned to textctrl to avoid mouse input @@ -138,7 +146,7 @@ protected: // need to know if tc/sb have been Create()d yet bool didinit; // selection info - u32 seladdr; + uint32_t seladdr; bool issel; DECLARE_DYNAMIC_CLASS() // for xrc @@ -181,22 +189,22 @@ private: public: // make addr visible - void Show(u32 addr, bool force_update = false); + void Show(uint32_t addr, bool force_update = false); // current selection, or topaddr if none - u32 GetAddr(); + uint32_t GetAddr(); // currently visible lines int nlines; // at least nlines * 4 words to display wxArrayInt words; // address of top line - u32 topaddr; + uint32_t topaddr; // max address for scrollbar - u32 maxaddr; + uint32_t maxaddr; // bytes per word == (1 << fmt) int fmt; // after write, these contain write addr and val - u32 writeaddr, writeval; + uint32_t writeaddr, writeval; // when selection is made, this widget is updated w/ addr wxControl* addrlab; diff --git a/src/wx/widgets/wx/wxmisc.h b/src/wx/widgets/wx/wxmisc.h index 29b36f76..f35926bc 100644 --- a/src/wx/widgets/wx/wxmisc.h +++ b/src/wx/widgets/wx/wxmisc.h @@ -2,6 +2,8 @@ #define WX_MISC_H // utility widgets +#include + // simple radio button not under the same parent window // note that it must be checkbox, as wx radio buttons have rigid behavior class wxFarRadio : public wxCheckBox { diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 62a3c84e..520a85b9 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -435,7 +435,7 @@ public: { return loaded; } - u32 game_size() + uint32_t game_size() { return rom_size; } @@ -491,25 +491,25 @@ public: // osdtext is displayed for 3 seconds after osdtime, and then cleared wxString osdtext; - u32 osdtime; + uint32_t osdtime; // Rewind: count down to 0 and rewind - u32 rewind_time; + uint32_t rewind_time; // Rewind: flag to OnIdle to do a rewind bool do_rewind; // Rewind: rewind states - char* rewind_mem; // should be u8, really + char* rewind_mem; // should be uint8_t, really int num_rewind_states; int next_rewind_state; // Loaded rom information IMAGE_TYPE loaded; wxFileName loaded_game; - u32 rom_crc32; + uint32_t rom_crc32; wxString rom_name; wxString rom_scene_rls; wxString rom_scene_rls_name; - u32 rom_size; + uint32_t rom_size; // FIXME: size this properly #define NUM_REWINDS 8 @@ -528,8 +528,8 @@ public: void StopSoundRecording(); void StartVidRecording(const wxString& fname); void StopVidRecording(); - void AddFrame(const u8* data); // video - void AddFrame(const u16* data, int length); // audio + void AddFrame(const uint8_t* data); // video + void AddFrame(const uint16_t* data, int length); // audio bool IsRecording() { return snd_rec.IsRecording() || vid_rec.IsRecording(); @@ -571,7 +571,7 @@ protected: ShowPointer(); } bool pointer_blanked; - u32 mouse_active_time; + uint32_t mouse_active_time; DECLARE_DYNAMIC_CLASS() DECLARE_EVENT_TABLE() @@ -603,7 +603,7 @@ class DrawingPanel : public wxObject { public: DrawingPanel(int _width, int _height); ~DrawingPanel(); - void DrawArea(u8** pixels); + void DrawArea(uint8_t** pixels); // the following wouldn't be necessary with virtual inheritance virtual wxWindow* GetWindow() = 0; virtual void Delete() = 0; @@ -612,15 +612,15 @@ protected: virtual void DrawArea(wxWindowDC&) = 0; virtual void DrawOSD(wxWindowDC&); int width, height, scale; - u8* todraw; - u8 *pixbuf1, *pixbuf2; + uint8_t* todraw; + uint8_t *pixbuf1, *pixbuf2; FilterThread* threads; int nthreads; wxSemaphore filt_done; wxDynamicLibrary filt_plugin; const RENDER_PLUGIN_INFO* rpi; // also flag indicating plugin loaded // largest buffer required is 32-bit * (max width + 1) * (max height + 2) - u8 delta[257 * 4 * 226]; + uint8_t delta[257 * 4 * 226]; // following can't work in 2.8 as intended // inheriting from wxEvtHandler is required, but also breaks subclasses @@ -662,11 +662,11 @@ extern bool GetXA2Devices(wxArrayString& names, wxArrayString& ids); extern bool debugger; extern void (*dbgMain)(); extern void (*dbgSignal)(int, int); -extern void (*dbgOutput)(const char*, u32); +extern void (*dbgOutput)(const char*, uint32_t); extern void remoteStubMain(); extern void remoteCleanUp(); extern void remoteStubSignal(int, int); -extern void remoteOutput(const char*, u32); +extern void remoteOutput(const char*, uint32_t); extern bool debugOpenPty(); extern const wxString& debugGetSlavePty(); diff --git a/src/wx/xaudio2.cpp b/src/wx/xaudio2.cpp index f8c96c83..58176bf6 100644 --- a/src/wx/xaudio2.cpp +++ b/src/wx/xaudio2.cpp @@ -240,7 +240,7 @@ public: bool init(long sampleRate); // Sound Data Feed - void write(u16* finalWave, int length); + void write(uint16_t* finalWave, int length); // Play Control void pause(); @@ -509,7 +509,7 @@ bool XAudio2_Output::init(long sampleRate) return true; } -void XAudio2_Output::write(u16* finalWave, int length) +void XAudio2_Output::write(uint16_t* finalWave, int length) { if (!initialized || failed) return;