Fix various build warnings (#1242)
* Mass-rename some global variables with clangd * Fix various int conversion issues Bug: #1003
This commit is contained in:
parent
b45a4066b1
commit
18b97b4342
30
src/Util.cpp
30
src/Util.cpp
|
@ -178,7 +178,7 @@ void utilReadScreenPixels(uint8_t *dest, int w, int h)
|
|||
int sizeY = h;
|
||||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
uint16_t *p = (uint16_t *)(pix + (w + 2) * 2); // skip first black line
|
||||
uint16_t *p = (uint16_t *)(g_pix + (w + 2) * 2); // skip first black line
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint16_t v = *p++;
|
||||
|
@ -192,7 +192,7 @@ void utilReadScreenPixels(uint8_t *dest, int w, int h)
|
|||
}
|
||||
} break;
|
||||
case 24: {
|
||||
uint8_t *pixU8 = (uint8_t *)pix;
|
||||
uint8_t *pixU8 = (uint8_t *)g_pix;
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
if (systemRedShift < systemBlueShift) {
|
||||
|
@ -200,9 +200,9 @@ void utilReadScreenPixels(uint8_t *dest, int w, int h)
|
|||
*b++ = *pixU8++; // G
|
||||
*b++ = *pixU8++; // B
|
||||
} else {
|
||||
int blue = *pixU8++;
|
||||
int green = *pixU8++;
|
||||
int red = *pixU8++;
|
||||
uint8_t blue = *pixU8++;
|
||||
uint8_t green = *pixU8++;
|
||||
uint8_t red = *pixU8++;
|
||||
|
||||
*b++ = red;
|
||||
*b++ = green;
|
||||
|
@ -212,7 +212,7 @@ void utilReadScreenPixels(uint8_t *dest, int w, int h)
|
|||
}
|
||||
} break;
|
||||
case 32: {
|
||||
uint32_t *pixU32 = (uint32_t *)(pix + 4 * (w + 1));
|
||||
uint32_t *pixU32 = (uint32_t *)(g_pix + 4 * (w + 1));
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint32_t v = *pixU32++;
|
||||
|
@ -262,9 +262,9 @@ bool utilWritePNGFile(const char *fileName, int w, int h, uint8_t *pix)
|
|||
*b++ = *pixU8++; // G
|
||||
*b++ = *pixU8++; // B
|
||||
} else {
|
||||
int blue = *pixU8++;
|
||||
int green = *pixU8++;
|
||||
int red = *pixU8++;
|
||||
uint8_t blue = *pixU8++;
|
||||
uint8_t green = *pixU8++;
|
||||
uint8_t red = *pixU8++;
|
||||
|
||||
*b++ = red;
|
||||
*b++ = green;
|
||||
|
@ -387,9 +387,9 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
|
|||
*b++ = *pixU8++; // G
|
||||
*b++ = *pixU8++; // R
|
||||
} else {
|
||||
int red = *pixU8++;
|
||||
int green = *pixU8++;
|
||||
int blue = *pixU8++;
|
||||
uint8_t red = *pixU8++;
|
||||
uint8_t green = *pixU8++;
|
||||
uint8_t blue = *pixU8++;
|
||||
|
||||
*b++ = blue;
|
||||
*b++ = green;
|
||||
|
@ -518,7 +518,7 @@ static fex_t *scan_arc(const char *file, bool (*accept)(const char *), char (&bu
|
|||
break;
|
||||
}
|
||||
|
||||
fex_err_t err = fex_next(fe);
|
||||
err = fex_next(fe);
|
||||
if (err) {
|
||||
systemMessage(MSG_BAD_ZIP_FILE,
|
||||
N_("Cannot read archive %s: %s"),
|
||||
|
@ -816,8 +816,8 @@ long utilGzMemTell(gzFile file)
|
|||
|
||||
void utilGBAFindSave(const int size)
|
||||
{
|
||||
uint32_t *p = (uint32_t *)&rom[0];
|
||||
uint32_t *end = (uint32_t *)(&rom[0] + size);
|
||||
uint32_t *p = (uint32_t *)&g_rom[0];
|
||||
uint32_t *end = (uint32_t *)(&g_rom[0] + size);
|
||||
int detectedSaveType = 0;
|
||||
int flashSize = 0x10000;
|
||||
bool rtcFound = false;
|
||||
|
|
|
@ -510,18 +510,18 @@ inline void Blip_Synth<quality, range>::offset_resampled(blip_resampled_time_t t
|
|||
}
|
||||
|
||||
BLIP_FWD(0)
|
||||
if (quality > 8)
|
||||
if constexpr (quality > 8)
|
||||
BLIP_FWD(2)
|
||||
if (quality > 12)
|
||||
if constexpr (quality > 12)
|
||||
BLIP_FWD(4)
|
||||
{
|
||||
ADD_IMP(fwd + mid - 1, mid - 1);
|
||||
ADD_IMP(fwd + mid, mid);
|
||||
imp = impulses + phase;
|
||||
}
|
||||
if (quality > 12)
|
||||
if constexpr (quality > 12)
|
||||
BLIP_REV(6)
|
||||
if (quality > 8)
|
||||
if constexpr (quality > 8)
|
||||
BLIP_REV(4)
|
||||
BLIP_REV(2)
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ void Gb_Apu::reset( mode_t mode, bool agb_wave )
|
|||
{
|
||||
// Init both banks (does nothing if not in AGB mode)
|
||||
// TODO: verify that this works
|
||||
write_register( 0, 0xFF1A, b * 0x40 );
|
||||
write_register( 0, 0xFF1A, static_cast<uint8_t>(b) * 0x40 );
|
||||
for ( unsigned i = 0; i < sizeof initial_wave [0]; i++ )
|
||||
write_register( 0, i + wave_ram, initial_wave [(mode != mode_dmg)] [i] );
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void Gb_Apu::apply_stereo()
|
|||
}
|
||||
}
|
||||
|
||||
void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
||||
void Gb_Apu::write_register( blip_time_t time, unsigned addr, uint8_t data )
|
||||
{
|
||||
require( (unsigned) data < 0x100 );
|
||||
|
||||
|
@ -353,7 +353,7 @@ void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
|||
}
|
||||
}
|
||||
|
||||
int Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
||||
uint8_t Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
||||
{
|
||||
run_until( time );
|
||||
|
||||
|
@ -376,10 +376,10 @@ int Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
|||
0x00,0x00,0x70,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
|
||||
};
|
||||
int mask = masks [reg];
|
||||
uint8_t mask = masks [reg];
|
||||
if ( wave.agb_mask && (reg == 10 || reg == 12) )
|
||||
mask = 0x1F; // extra implemented bits in wave regs on AGB
|
||||
int data = regs [reg] | mask;
|
||||
uint8_t data = regs [reg] | mask;
|
||||
|
||||
// Status register
|
||||
if ( addr == status_reg )
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#ifndef GB_APU_H
|
||||
#define GB_APU_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "blargg_common.h"
|
||||
#include "Gb_Oscs.h"
|
||||
|
||||
struct gb_apu_state_t;
|
||||
|
@ -42,10 +45,10 @@ class Gb_Apu
|
|||
// current time frame.
|
||||
|
||||
// Emulates CPU write of data to addr at specified time.
|
||||
void write_register(blip_time_t time, unsigned addr, int data);
|
||||
void write_register(blip_time_t time, unsigned addr, uint8_t data);
|
||||
|
||||
// Emulates CPU read from addr at specified time.
|
||||
int read_register(blip_time_t time, unsigned addr);
|
||||
uint8_t read_register(blip_time_t time, unsigned addr);
|
||||
|
||||
// Emulates sound hardware up to specified time, ends current time frame, then
|
||||
// starts a new frame at time 0.
|
||||
|
@ -126,7 +129,7 @@ class Gb_Apu
|
|||
blip_time_t frame_time; // time of next frame sequencer action
|
||||
int frame_phase; // phase of next frame sequencer step
|
||||
enum { regs_size = register_count + 0x10 };
|
||||
BOOST::uint8_t regs[regs_size]; // last values written to registers
|
||||
uint8_t regs[regs_size]; // last values written to registers
|
||||
|
||||
// large objects after everything else
|
||||
Gb_Osc::Good_Synth good_synth;
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
#ifndef GB_OSCS_H
|
||||
#define GB_OSCS_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "Blip_Buffer.h"
|
||||
#include "blargg_common.h"
|
||||
|
||||
#ifndef GB_APU_OVERCLOCK
|
||||
#define GB_APU_OVERCLOCK 1
|
||||
|
@ -33,7 +34,7 @@ class Gb_Osc
|
|||
|
||||
Blip_Buffer *outputs[4]; // NULL, right, left, center
|
||||
Blip_Buffer *output; // where to output sound
|
||||
BOOST::uint8_t *regs; // osc's 5 registers
|
||||
uint8_t *regs; // osc's 5 registers
|
||||
int mode; // mode_dmg, mode_cgb, mode_agb
|
||||
int dac_off_amp; // amplitude when DAC is off
|
||||
int last_amp; // current amplitude in Blip_Buffer
|
||||
|
@ -173,8 +174,8 @@ class Gb_Wave : public Gb_Osc
|
|||
void run(blip_time_t, blip_time_t);
|
||||
|
||||
// Reads/writes wave RAM
|
||||
int read(unsigned addr) const;
|
||||
void write(unsigned addr, int data);
|
||||
uint8_t read(unsigned addr) const;
|
||||
void write(unsigned addr, uint8_t data);
|
||||
|
||||
void reset()
|
||||
{
|
||||
|
@ -187,7 +188,7 @@ class Gb_Wave : public Gb_Osc
|
|||
enum { bank_size = 32 };
|
||||
|
||||
int agb_mask; // 0xFF if AGB features enabled, 0 otherwise
|
||||
BOOST::uint8_t *wave_ram; // 32 bytes (64 nybbles), stored in APU
|
||||
uint8_t *wave_ram; // 32 bytes (64 nybbles), stored in APU
|
||||
|
||||
friend class Gb_Apu;
|
||||
|
||||
|
@ -205,7 +206,7 @@ class Gb_Wave : public Gb_Osc
|
|||
|
||||
void corrupt_wave();
|
||||
|
||||
BOOST::uint8_t *wave_bank() const
|
||||
uint8_t *wave_bank() const
|
||||
{
|
||||
return &wave_ram[(~regs[0] & bank40_mask) >> 2 & agb_mask];
|
||||
}
|
||||
|
@ -214,13 +215,13 @@ class Gb_Wave : public Gb_Osc
|
|||
int access(unsigned addr) const;
|
||||
};
|
||||
|
||||
inline int Gb_Wave::read(unsigned addr) const
|
||||
inline uint8_t Gb_Wave::read(unsigned addr) const
|
||||
{
|
||||
int index = access(addr);
|
||||
return (index < 0 ? 0xFF : wave_bank()[index]);
|
||||
}
|
||||
|
||||
inline void Gb_Wave::write(unsigned addr, int data)
|
||||
inline void Gb_Wave::write(unsigned addr, uint8_t data)
|
||||
{
|
||||
int index = access(addr);
|
||||
if (index >= 0)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define _stricmp strcasecmp
|
||||
#endif
|
||||
|
||||
extern uint8_t* pix;
|
||||
extern uint8_t* g_pix;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -2559,7 +2559,7 @@ void gbCPUInit(const char* biosFileName, bool useBiosFile)
|
|||
int size = expectedSize;
|
||||
if (utilLoad(biosFileName,
|
||||
CPUIsGBBios,
|
||||
bios,
|
||||
g_bios,
|
||||
size)) {
|
||||
if (size == expectedSize)
|
||||
coreOptions.useBios = true;
|
||||
|
@ -2762,8 +2762,8 @@ void gbReset()
|
|||
memset(gbLineBuffer, 0, kGBLineBufferSize);
|
||||
}
|
||||
// clean Pix
|
||||
if (pix != nullptr) {
|
||||
memset(pix, 0, kGBPixSize);
|
||||
if (g_pix != nullptr) {
|
||||
memset(g_pix, 0, kGBPixSize);
|
||||
}
|
||||
// clean Vram
|
||||
if (gbVram != nullptr) {
|
||||
|
@ -2938,12 +2938,12 @@ void gbReset()
|
|||
}
|
||||
|
||||
// used for the handling of the gb Boot Rom
|
||||
if ((gbHardware & 7) && (bios != NULL) && coreOptions.useBios && !coreOptions.skipBios) {
|
||||
if ((gbHardware & 7) && (g_bios != NULL) && coreOptions.useBios && !coreOptions.skipBios) {
|
||||
if (gbHardware & 5) {
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(gbRom), 0x1000);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), kGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(g_bios), kGBBiosSize);
|
||||
} else {
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), kCGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(g_bios), kCGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory + 0x100), (uint8_t*)(gbRom + 0x100), 0x100);
|
||||
}
|
||||
gbWhiteScreen = 0;
|
||||
|
@ -3466,9 +3466,9 @@ static bool gbReadSaveState(gzFile gzFile)
|
|||
}
|
||||
|
||||
if (version < GBSAVE_GAME_VERSION_5) {
|
||||
utilGzRead(gzFile, pix, 256 * 224 * sizeof(uint16_t));
|
||||
utilGzRead(gzFile, g_pix, 256 * 224 * sizeof(uint16_t));
|
||||
}
|
||||
memset(pix, 0, kGBPixSize);
|
||||
memset(g_pix, 0, kGBPixSize);
|
||||
|
||||
if (version < GBSAVE_GAME_VERSION_6) {
|
||||
utilGzRead(gzFile, gbPalette, 64 * sizeof(uint16_t));
|
||||
|
@ -3518,9 +3518,9 @@ static bool gbReadSaveState(gzFile gzFile)
|
|||
gbMemoryMap[0x00] = &gbMemory[0x0000];
|
||||
if (gbHardware & 5) {
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(gbRom), 0x1000);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), kGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(g_bios), kGBBiosSize);
|
||||
} else if (gbHardware & 2) {
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), kCGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(g_bios), kCGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory + 0x100), (uint8_t*)(gbRom + 0x100), 0x100);
|
||||
}
|
||||
|
||||
|
@ -3729,15 +3729,15 @@ bool gbReadSaveState(const char* name)
|
|||
bool gbWritePNGFile(const char* fileName)
|
||||
{
|
||||
if (gbBorderOn)
|
||||
return utilWritePNGFile(fileName, kSGBWidth, kSGBHeight, pix);
|
||||
return utilWritePNGFile(fileName, kGBWidth, kGBHeight, pix);
|
||||
return utilWritePNGFile(fileName, kSGBWidth, kSGBHeight, g_pix);
|
||||
return utilWritePNGFile(fileName, kGBWidth, kGBHeight, g_pix);
|
||||
}
|
||||
|
||||
bool gbWriteBMPFile(const char* fileName)
|
||||
{
|
||||
if (gbBorderOn)
|
||||
return utilWriteBMPFile(fileName, kSGBWidth, kSGBHeight, pix);
|
||||
return utilWriteBMPFile(fileName, kGBWidth, kGBHeight, pix);
|
||||
return utilWriteBMPFile(fileName, kSGBWidth, kSGBHeight, g_pix);
|
||||
return utilWriteBMPFile(fileName, kGBWidth, kGBHeight, g_pix);
|
||||
}
|
||||
#endif // !__LIBRETRO__
|
||||
|
||||
|
@ -3753,9 +3753,9 @@ void gbCleanUp()
|
|||
gbRom = nullptr;
|
||||
}
|
||||
|
||||
if (bios != nullptr) {
|
||||
free(bios);
|
||||
bios = nullptr;
|
||||
if (g_bios != nullptr) {
|
||||
free(g_bios);
|
||||
g_bios = nullptr;
|
||||
}
|
||||
|
||||
if (gbMemory != nullptr) {
|
||||
|
@ -3768,9 +3768,9 @@ void gbCleanUp()
|
|||
gbLineBuffer = nullptr;
|
||||
}
|
||||
|
||||
if (pix != nullptr) {
|
||||
free(pix);
|
||||
pix = nullptr;
|
||||
if (g_pix != nullptr) {
|
||||
free(g_pix);
|
||||
g_pix = nullptr;
|
||||
}
|
||||
|
||||
gbSgbShutdown();
|
||||
|
@ -3817,12 +3817,12 @@ bool gbLoadRom(const char* filename) {
|
|||
|
||||
g_gbBatteryError = false;
|
||||
|
||||
if (bios != nullptr) {
|
||||
free(bios);
|
||||
bios = nullptr;
|
||||
if (g_bios != nullptr) {
|
||||
free(g_bios);
|
||||
g_bios = nullptr;
|
||||
}
|
||||
bios = (uint8_t*)calloc(1, kGBBiosBufferSize);
|
||||
if (bios == nullptr) {
|
||||
g_bios = (uint8_t*)calloc(1, kGBBiosBufferSize);
|
||||
if (g_bios == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3831,8 +3831,8 @@ bool gbLoadRom(const char* filename) {
|
|||
return false;
|
||||
}
|
||||
|
||||
pix = (uint8_t*)calloc(1, kGBPixSize);
|
||||
if (pix == nullptr) {
|
||||
g_pix = (uint8_t*)calloc(1, kGBPixSize);
|
||||
if (g_pix == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3880,10 +3880,10 @@ void gbDrawLine()
|
|||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
#ifdef __LIBRETRO__
|
||||
uint16_t* dest = (uint16_t*)pix + gbBorderLineSkip * (register_LY + gbBorderRowSkip)
|
||||
uint16_t* dest = (uint16_t*)g_pix + gbBorderLineSkip * (register_LY + gbBorderRowSkip)
|
||||
+ gbBorderColumnSkip;
|
||||
#else
|
||||
uint16_t* dest = (uint16_t*)pix + (gbBorderLineSkip + 2) * (register_LY + gbBorderRowSkip + 1)
|
||||
uint16_t* dest = (uint16_t*)g_pix + (gbBorderLineSkip + 2) * (register_LY + gbBorderRowSkip + 1)
|
||||
+ gbBorderColumnSkip;
|
||||
#endif
|
||||
for (size_t x = 0; x < kGBWidth;) {
|
||||
|
@ -3915,7 +3915,7 @@ void gbDrawLine()
|
|||
} break;
|
||||
|
||||
case 24: {
|
||||
uint8_t* dest = (uint8_t*)pix + 3 * (gbBorderLineSkip * (register_LY + gbBorderRowSkip) + gbBorderColumnSkip);
|
||||
uint8_t* dest = (uint8_t*)g_pix + 3 * (gbBorderLineSkip * (register_LY + gbBorderRowSkip) + gbBorderColumnSkip);
|
||||
for (size_t x = 0; x < kGBWidth;) {
|
||||
*((uint32_t*)dest) = systemColorMap32[gbLineMix[x++]];
|
||||
dest += 3;
|
||||
|
@ -3957,10 +3957,10 @@ void gbDrawLine()
|
|||
|
||||
case 32: {
|
||||
#ifdef __LIBRETRO__
|
||||
uint32_t* dest = (uint32_t*)pix + gbBorderLineSkip * (register_LY + gbBorderRowSkip)
|
||||
uint32_t* dest = (uint32_t*)g_pix + gbBorderLineSkip * (register_LY + gbBorderRowSkip)
|
||||
+ gbBorderColumnSkip;
|
||||
#else
|
||||
uint32_t* dest = (uint32_t*)pix + (gbBorderLineSkip + 1) * (register_LY + gbBorderRowSkip + 1)
|
||||
uint32_t* dest = (uint32_t*)g_pix + (gbBorderLineSkip + 1) * (register_LY + gbBorderRowSkip + 1)
|
||||
+ gbBorderColumnSkip;
|
||||
#endif
|
||||
for (size_t x = 0; x < kGBWidth;) {
|
||||
|
@ -4904,13 +4904,13 @@ bool gbLoadRomData(const char* data, size_t size) {
|
|||
|
||||
g_gbBatteryError = false;
|
||||
|
||||
if (bios != nullptr) {
|
||||
free(bios);
|
||||
bios = nullptr;
|
||||
if (g_bios != nullptr) {
|
||||
free(g_bios);
|
||||
g_bios = nullptr;
|
||||
}
|
||||
|
||||
bios = (uint8_t*)calloc(1, kGBBiosBufferSize);
|
||||
if (bios == nullptr) {
|
||||
g_bios = (uint8_t*)calloc(1, kGBBiosBufferSize);
|
||||
if (g_bios == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4919,8 +4919,8 @@ bool gbLoadRomData(const char* data, size_t size) {
|
|||
return false;
|
||||
}
|
||||
|
||||
pix = (uint8_t*)calloc(1, kGBPixSize);
|
||||
if (pix == nullptr) {
|
||||
g_pix = (uint8_t*)calloc(1, kGBPixSize);
|
||||
if (g_pix == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5130,9 +5130,9 @@ bool gbReadSaveState(const uint8_t* data)
|
|||
gbMemoryMap[0x00] = &gbMemory[0x0000];
|
||||
if (gbHardware & 5) {
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(gbRom), 0x1000);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), kGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(g_bios), kGBBiosSize);
|
||||
} else if (gbHardware & 2) {
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), kCGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(g_bios), kCGBBiosSize);
|
||||
memcpy((uint8_t*)(gbMemory + 0x100), (uint8_t*)(gbRom + 0x100), 0x100);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ static char* addStr(char* p, const char* s)
|
|||
int gbDis(char* buffer, uint16_t address)
|
||||
{
|
||||
char* p = buffer;
|
||||
int instr = 1;
|
||||
uint16_t instr = 1;
|
||||
uint16_t addr = address;
|
||||
sprintf(p, "%04x ", address);
|
||||
p += 12;
|
||||
|
@ -220,7 +220,7 @@ int gbDis(char* buffer, uint16_t address)
|
|||
} else
|
||||
*p++ = *mnen++;
|
||||
}
|
||||
for (int i = 0; i < instr; i++) {
|
||||
for (uint16_t i = 0; i < instr; i++) {
|
||||
uint16_t a = addr + i;
|
||||
addHex(buffer + 5 + i * 2, GB_READ(a));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../common/Types.h"
|
||||
|
||||
extern uint8_t* bios;
|
||||
extern uint8_t* g_bios;
|
||||
|
||||
extern uint8_t* gbRom;
|
||||
extern uint8_t* gbRam;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include "gbMemory.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "../System.h"
|
||||
#include "../common/Port.h"
|
||||
#include "../common/sizes.h"
|
||||
|
@ -446,19 +449,19 @@ uint8_t mapperMBC3ReadRAM(uint16_t address)
|
|||
} else if (g_gbCartData.has_rtc()) {
|
||||
switch (gbDataMBC3.mapperClockRegister) {
|
||||
case 0x08:
|
||||
return gbDataMBC3.mapperLSeconds;
|
||||
return (uint8_t)(gbDataMBC3.mapperLSeconds);
|
||||
break;
|
||||
case 0x09:
|
||||
return gbDataMBC3.mapperLMinutes;
|
||||
return (uint8_t)(gbDataMBC3.mapperLMinutes);
|
||||
break;
|
||||
case 0x0a:
|
||||
return gbDataMBC3.mapperLHours;
|
||||
return (uint8_t)(gbDataMBC3.mapperLHours);
|
||||
break;
|
||||
case 0x0b:
|
||||
return gbDataMBC3.mapperLDays;
|
||||
return (uint8_t)(gbDataMBC3.mapperLDays);
|
||||
break;
|
||||
case 0x0c:
|
||||
return gbDataMBC3.mapperLControl;
|
||||
return (uint8_t)(gbDataMBC3.mapperLControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1024,7 +1027,7 @@ uint8_t mapperHuC3ReadRAM(uint16_t address)
|
|||
if (gbDataHuC3.mapperRAMFlag > 0x0b && gbDataHuC3.mapperRAMFlag < 0x0e) {
|
||||
if (gbDataHuC3.mapperRAMFlag != 0x0c)
|
||||
return 1;
|
||||
return gbDataHuC3.mapperRAMValue;
|
||||
return (uint8_t)(gbDataHuC3.mapperRAMValue);
|
||||
} else
|
||||
return gbMemoryMap[address >> 12][address & 0x0fff];
|
||||
}
|
||||
|
@ -1327,17 +1330,17 @@ void mapperTAMA5RAM(uint16_t address, uint8_t value)
|
|||
gbDataTAMA5.mapperLYears = gbDataTAMA5.mapperYears;
|
||||
gbDataTAMA5.mapperLControl = gbDataTAMA5.mapperControl;
|
||||
|
||||
int seconds = (gbDataTAMA5.mapperLSeconds / 10) * 16 + gbDataTAMA5.mapperLSeconds % 10;
|
||||
int secondsL = (gbDataTAMA5.mapperLSeconds % 10);
|
||||
int secondsH = (gbDataTAMA5.mapperLSeconds / 10);
|
||||
int minutes = (gbDataTAMA5.mapperLMinutes / 10) * 16 + gbDataTAMA5.mapperLMinutes % 10;
|
||||
int hours = (gbDataTAMA5.mapperLHours / 10) * 16 + gbDataTAMA5.mapperLHours % 10;
|
||||
int DaysL = gbDataTAMA5.mapperLDays % 10;
|
||||
int DaysH = gbDataTAMA5.mapperLDays / 10;
|
||||
int MonthsL = gbDataTAMA5.mapperLMonths % 10;
|
||||
int MonthsH = gbDataTAMA5.mapperLMonths / 10;
|
||||
int Years3 = (gbDataTAMA5.mapperLYears / 100) % 10;
|
||||
int Years4 = (gbDataTAMA5.mapperLYears / 1000);
|
||||
uint8_t seconds = (gbDataTAMA5.mapperLSeconds / 10) * 16 + gbDataTAMA5.mapperLSeconds % 10;
|
||||
uint8_t secondsL = (gbDataTAMA5.mapperLSeconds % 10);
|
||||
uint8_t secondsH = (gbDataTAMA5.mapperLSeconds / 10);
|
||||
uint8_t minutes = (gbDataTAMA5.mapperLMinutes / 10) * 16 + gbDataTAMA5.mapperLMinutes % 10;
|
||||
uint8_t hours = (gbDataTAMA5.mapperLHours / 10) * 16 + gbDataTAMA5.mapperLHours % 10;
|
||||
uint8_t DaysL = gbDataTAMA5.mapperLDays % 10;
|
||||
uint8_t DaysH = gbDataTAMA5.mapperLDays / 10;
|
||||
uint8_t MonthsL = gbDataTAMA5.mapperLMonths % 10;
|
||||
uint8_t MonthsH = gbDataTAMA5.mapperLMonths / 10;
|
||||
uint8_t Years3 = (gbDataTAMA5.mapperLYears / 100) % 10;
|
||||
uint8_t Years4 = (gbDataTAMA5.mapperLYears / 1000);
|
||||
|
||||
switch (data & 0x0f) {
|
||||
// I guess cases 0 and 1 are used for secondsL and secondsH
|
||||
|
|
|
@ -9,7 +9,7 @@ uint8_t gbPrinterPacket[0x400];
|
|||
int gbPrinterCount = 0;
|
||||
int gbPrinterDataCount = 0;
|
||||
int gbPrinterDataSize = 0;
|
||||
int gbPrinterResult = 0;
|
||||
uint8_t gbPrinterResult = 0;
|
||||
|
||||
bool gbPrinterCheckCRC()
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "gb.h"
|
||||
#include "gbGlobals.h"
|
||||
|
||||
extern uint8_t* pix;
|
||||
extern uint8_t* g_pix;
|
||||
extern bool speedup;
|
||||
extern bool gbSgbResetFlag;
|
||||
|
||||
|
@ -117,7 +117,7 @@ void gbSgbFillScreen(uint16_t color)
|
|||
#else
|
||||
int yLine = (y + gbBorderRowSkip + 1) * (gbBorderLineSkip + 2) + gbBorderColumnSkip;
|
||||
#endif
|
||||
uint16_t* dest = (uint16_t*)pix + yLine;
|
||||
uint16_t* dest = (uint16_t*)g_pix + yLine;
|
||||
for (int x = 0; x < 160; x++)
|
||||
gbSgbDraw16Bit(dest++, color);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void gbSgbFillScreen(uint16_t color)
|
|||
case 24: {
|
||||
for (int y = 0; y < 144; y++) {
|
||||
int yLine = (y + gbBorderRowSkip) * gbBorderLineSkip + gbBorderColumnSkip;
|
||||
uint8_t* dest = (uint8_t*)pix + yLine * 3;
|
||||
uint8_t* dest = (uint8_t*)g_pix + yLine * 3;
|
||||
for (int x = 0; x < 160; x++) {
|
||||
gbSgbDraw24Bit(dest, color);
|
||||
dest += 3;
|
||||
|
@ -139,7 +139,7 @@ void gbSgbFillScreen(uint16_t color)
|
|||
#else
|
||||
int yLine = (y + gbBorderRowSkip + 1) * (gbBorderLineSkip + 1) + gbBorderColumnSkip;
|
||||
#endif
|
||||
uint32_t* dest = (uint32_t*)pix + yLine;
|
||||
uint32_t* dest = (uint32_t*)g_pix + yLine;
|
||||
for (int x = 0; x < 160; x++) {
|
||||
gbSgbDraw32Bit(dest++, color);
|
||||
}
|
||||
|
@ -189,13 +189,13 @@ void gbSgbRenderScreenToBuffer()
|
|||
void gbSgbDrawBorderTile(int x, int y, int tile, int attr)
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
uint16_t* dest = (uint16_t*)pix + (y * 256) + x;
|
||||
uint32_t* dest32 = (uint32_t*)pix + (y * 256) + x;
|
||||
uint16_t* dest = (uint16_t*)g_pix + (y * 256) + x;
|
||||
uint32_t* dest32 = (uint32_t*)g_pix + (y * 256) + x;
|
||||
#else
|
||||
uint16_t* dest = (uint16_t*)pix + ((y + 1) * (256 + 2)) + x;
|
||||
uint32_t* dest32 = (uint32_t*)pix + ((y + 1) * (256 + 1)) + x;
|
||||
uint16_t* dest = (uint16_t*)g_pix + ((y + 1) * (256 + 2)) + x;
|
||||
uint32_t* dest32 = (uint32_t*)g_pix + ((y + 1) * (256 + 1)) + x;
|
||||
#endif
|
||||
uint8_t* dest8 = (uint8_t*)pix + ((y * 256) + x) * 3;
|
||||
uint8_t* dest8 = (uint8_t*)g_pix + ((y * 256) + x) * 3;
|
||||
|
||||
uint8_t* tileAddress = &gbSgbBorderChar[tile * 32];
|
||||
uint8_t* tileAddress2 = &gbSgbBorderChar[tile * 32 + 16];
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include <string.h>
|
||||
#include "gbSound.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "../Util.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "gb.h"
|
||||
#include "gbGlobals.h"
|
||||
#include "gbSound.h"
|
||||
|
||||
#include "../apu/Effects_Buffer.h"
|
||||
#include "../apu/Gb_Apu.h"
|
||||
|
@ -32,7 +33,7 @@ uint8_t gbSoundRead(int st, uint16_t address)
|
|||
return gbMemory[address];
|
||||
}
|
||||
|
||||
void gbSoundEvent(int st, uint16_t address, int data)
|
||||
void gbSoundEvent(int st, uint16_t address, uint8_t data)
|
||||
{
|
||||
gbMemory[address] = data;
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#ifndef GBSOUND_H
|
||||
#define GBSOUND_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#if !defined(__LIBRETRO__)
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
// GB sound emulation
|
||||
|
||||
// See Sound.h for sound setup/options
|
||||
|
@ -56,7 +62,7 @@ extern gb_effects_config_t gb_effects_config; // current configuration
|
|||
void gbSoundReset();
|
||||
|
||||
// Emulates write to sound hardware
|
||||
void gbSoundEvent(int st, uint16_t address, int data);
|
||||
void gbSoundEvent(int st, uint16_t address, uint8_t data);
|
||||
#define SOUND_EVENT gbSoundEvent
|
||||
|
||||
// Emulates read from sound hardware
|
||||
|
|
|
@ -688,7 +688,7 @@ uint8_t parseExpressionType(char* given_type)
|
|||
//for such a small string, pays off to convert first
|
||||
char* type = strdup(given_type);
|
||||
for (int i = 0; type[i] != '\0'; i++) {
|
||||
type[i] = toupper(type[i]);
|
||||
type[i] = static_cast<uint8_t>(toupper(type[i]));
|
||||
}
|
||||
if ((type[0] == 'S') || type[0] == 'U') {
|
||||
flags |= (4 - ((type[0] - 'S') << 1));
|
||||
|
|
|
@ -300,10 +300,10 @@ uint8_t v3_deadtable2[256] = {
|
|||
#define CHEAT_IS_HEX(a) (((a) >= 'A' && (a) <= 'F') || ((a) >= '0' && (a) <= '9'))
|
||||
|
||||
#define CHEAT_PATCH_ROM_16BIT(a, v) \
|
||||
WRITE16LE(((uint16_t*)&rom[(a)&0x1ffffff]), v);
|
||||
WRITE16LE(((uint16_t*)&g_rom[(a)&0x1ffffff]), v);
|
||||
|
||||
#define CHEAT_PATCH_ROM_32BIT(a, v) \
|
||||
WRITE32LE(((uint32_t*)&rom[(a)&0x1ffffff]), v);
|
||||
WRITE32LE(((uint32_t*)&g_rom[(a)&0x1ffffff]), v);
|
||||
|
||||
static bool isMultilineWithData(int i)
|
||||
{
|
||||
|
@ -602,10 +602,10 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
uint32_t addr = cheatsList[i - 1].value;
|
||||
uint8_t value = cheatsList[i].rawaddress;
|
||||
int vinc = (cheatsList[i].value >> 24) & 255;
|
||||
int count = (cheatsList[i].value >> 16) & 255;
|
||||
int ainc = (cheatsList[i].value & 0xffff);
|
||||
uint8_t value = DowncastU8(cheatsList[i].rawaddress);
|
||||
const uint8_t vinc = DowncastU8(cheatsList[i].value >> 24);
|
||||
uint8_t count = DowncastU8(cheatsList[i].value >> 16);
|
||||
const uint16_t ainc = DowncastU16(cheatsList[i].value);
|
||||
while (count > 0) {
|
||||
CPUWriteByte(addr, value);
|
||||
value += vinc;
|
||||
|
@ -618,10 +618,10 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
uint32_t addr = cheatsList[i - 1].value;
|
||||
uint16_t value = cheatsList[i].rawaddress;
|
||||
int vinc = (cheatsList[i].value >> 24) & 255;
|
||||
int count = (cheatsList[i].value >> 16) & 255;
|
||||
int ainc = (cheatsList[i].value & 0xffff) * 2;
|
||||
uint16_t value = DowncastU16(cheatsList[i].rawaddress);
|
||||
const uint16_t vinc = DowncastU16(cheatsList[i].value >> 24);
|
||||
uint8_t count = DowncastU8(cheatsList[i].value >> 16);
|
||||
const uint16_t ainc = DowncastU16(cheatsList[i].value & 0xffff) * 2;
|
||||
while (count > 0) {
|
||||
CPUWriteHalfWord(addr, value);
|
||||
value += vinc;
|
||||
|
@ -1082,15 +1082,15 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
break;
|
||||
case GSA_16_BIT_WRITE_IOREGS:
|
||||
if ((cheatsList[i].address <= 0x3FF) && (cheatsList[i].address != 0x6) && (cheatsList[i].address != 0x130))
|
||||
ioMem[cheatsList[i].address & 0x3FE] = cheatsList[i].value & 0xFFFF;
|
||||
g_ioMem[cheatsList[i].address & 0x3FE] = cheatsList[i].value & 0xFFFF;
|
||||
break;
|
||||
case GSA_32_BIT_WRITE_IOREGS:
|
||||
if (cheatsList[i].address <= 0x3FF) {
|
||||
uint32_t cheat_addr = cheatsList[i].address & 0x3FC;
|
||||
if ((cheat_addr != 6) && (cheat_addr != 0x130))
|
||||
ioMem[cheat_addr] = (cheatsList[i].value & 0xFFFF);
|
||||
g_ioMem[cheat_addr] = (cheatsList[i].value & 0xFFFF);
|
||||
if (((cheat_addr + 2) != 0x6) && (cheat_addr + 2) != 0x130)
|
||||
ioMem[cheat_addr + 2] = ((cheatsList[i].value >> 16) & 0xFFFF);
|
||||
g_ioMem[cheat_addr + 2] = ((cheatsList[i].value >> 16) & 0xFFFF);
|
||||
}
|
||||
break;
|
||||
case GSA_8_BIT_IF_TRUE3:
|
||||
|
@ -1583,16 +1583,16 @@ void cheatsAddGSACode(const char* code, const char* desc, bool v3)
|
|||
cheatsDecryptGSACode(address, value, v3);
|
||||
|
||||
if (value == 0x1DC0DE) {
|
||||
uint32_t gamecode = READ32LE(((uint32_t*)&rom[0xac]));
|
||||
uint32_t gamecode = READ32LE(((uint32_t*)&g_rom[0xac]));
|
||||
if (gamecode != address) {
|
||||
char buffer[5];
|
||||
*((uint32_t*)buffer) = address;
|
||||
buffer[4] = 0;
|
||||
char buffer2[5];
|
||||
*((uint32_t*)buffer2) = READ32LE(((uint32_t*)&rom[0xac]));
|
||||
buffer2[4] = 0;
|
||||
char buf[5];
|
||||
*((uint32_t*)buf) = address;
|
||||
buf[4] = 0;
|
||||
char buf2[5];
|
||||
*((uint32_t*)buf2) = READ32LE(((uint32_t*)&g_rom[0xac]));
|
||||
buf2[4] = 0;
|
||||
systemMessage(MSG_GBA_CODE_WARNING, N_("Warning: cheats are for game %s. Current game is %s.\nCodes may not work correctly."),
|
||||
buffer, buffer2);
|
||||
buf, buf2);
|
||||
}
|
||||
cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value, v3 ? 257 : 256,
|
||||
UNKNOWN_CODE);
|
||||
|
@ -2258,12 +2258,12 @@ uint32_t cheatsCBACalcIndex(uint32_t x, uint32_t y)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void cheatsCBAUpdateSeedBuffer(uint32_t a, uint8_t* buffer, int count)
|
||||
void cheatsCBAUpdateSeedBuffer(uint32_t address, uint8_t* buffer, int count)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
buffer[i] = i;
|
||||
for (i = 0; (uint32_t)i < a; i++) {
|
||||
for (i = 0; (uint32_t)i < address; i++) {
|
||||
uint32_t a = cheatsCBACalcIndex(cheatsCBAEncWorker(), count);
|
||||
uint32_t b = cheatsCBACalcIndex(cheatsCBAEncWorker(), count);
|
||||
uint32_t t = buffer[a];
|
||||
|
@ -2501,7 +2501,7 @@ void cheatsAddCBACode(const char* code, const char* desc)
|
|||
case 0x00: {
|
||||
if (!cheatsCBATableGenerated)
|
||||
cheatsCBAGenTable();
|
||||
uint32_t crc = cheatsCBACalcCRC(rom, 0x10000);
|
||||
uint32_t crc = cheatsCBACalcCRC(g_rom, 0x10000);
|
||||
if (crc != address) {
|
||||
systemMessage(MSG_CBA_CODE_WARNING,
|
||||
N_("Warning: Codes seem to be for a different game.\nCodes may not work correctly."));
|
||||
|
|
|
@ -22,7 +22,7 @@ uint8_t flashSaveMemory[SIZE_FLASH1M];
|
|||
|
||||
int flashState = FLASH_READ_ARRAY;
|
||||
int flashReadState = FLASH_READ_ARRAY;
|
||||
int flashSize = SIZE_FLASH512;
|
||||
int g_flashSize = SIZE_FLASH512;
|
||||
int flashDeviceID = 0x1b;
|
||||
int flashManufacturerID = 0x32;
|
||||
int flashBank = 0;
|
||||
|
@ -51,9 +51,9 @@ void flashSetSize(int size)
|
|||
}
|
||||
// Added to make 64k saves compatible with 128k ones
|
||||
// (allow wrongfuly set 64k saves to work for Pokemon games)
|
||||
if ((size == SIZE_FLASH1M) && (flashSize == SIZE_FLASH512))
|
||||
if ((size == SIZE_FLASH1M) && (g_flashSize == SIZE_FLASH512))
|
||||
memcpy((uint8_t*)(flashSaveMemory + SIZE_FLASH512), (uint8_t*)(flashSaveMemory), SIZE_FLASH512);
|
||||
flashSize = size;
|
||||
g_flashSize = size;
|
||||
}
|
||||
|
||||
uint8_t flashRead(uint32_t address)
|
||||
|
@ -144,7 +144,7 @@ void flashWrite(uint32_t address, uint8_t byte)
|
|||
flashReadState = FLASH_READ_ARRAY;
|
||||
} else if (byte == 0xA0) {
|
||||
flashState = FLASH_PROGRAM;
|
||||
} else if (byte == 0xB0 && flashSize == SIZE_FLASH1M) {
|
||||
} else if (byte == 0xB0 && g_flashSize == SIZE_FLASH1M) {
|
||||
flashState = FLASH_SETBANK;
|
||||
} else {
|
||||
flashState = FLASH_READ_ARRAY;
|
||||
|
@ -181,7 +181,7 @@ void flashWrite(uint32_t address, uint8_t byte)
|
|||
flashReadState = FLASH_ERASE_COMPLETE;
|
||||
} else if (byte == 0x10) {
|
||||
// CHIP ERASE
|
||||
memset(flashSaveMemory, 0xff, flashSize);
|
||||
memset(flashSaveMemory, 0xff, g_flashSize);
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
|
||||
flashReadState = FLASH_ERASE_COMPLETE;
|
||||
} else {
|
||||
|
@ -219,7 +219,7 @@ void flashWrite(uint32_t address, uint8_t byte)
|
|||
static variable_desc flashSaveData3[] = {
|
||||
{ &flashState, sizeof(int) },
|
||||
{ &flashReadState, sizeof(int) },
|
||||
{ &flashSize, sizeof(int) },
|
||||
{ &g_flashSize, sizeof(int) },
|
||||
{ &flashBank, sizeof(int) },
|
||||
{ &flashSaveMemory[0], SIZE_FLASH1M },
|
||||
{ NULL, 0 }
|
||||
|
@ -247,7 +247,7 @@ static variable_desc flashSaveData[] = {
|
|||
static variable_desc flashSaveData2[] = {
|
||||
{ &flashState, sizeof(int) },
|
||||
{ &flashReadState, sizeof(int) },
|
||||
{ &flashSize, sizeof(int) },
|
||||
{ &g_flashSize, sizeof(int) },
|
||||
{ &flashSaveMemory[0], SIZE_FLASH1M },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
@ -264,7 +264,7 @@ void flashReadGame(gzFile gzFile, int version)
|
|||
else if (version < SAVE_GAME_VERSION_7) {
|
||||
utilReadData(gzFile, flashSaveData2);
|
||||
flashBank = 0;
|
||||
flashSetSize(flashSize);
|
||||
flashSetSize(g_flashSize);
|
||||
} else {
|
||||
utilReadData(gzFile, flashSaveData3);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ extern void flashReset();
|
|||
extern void flashSetSize(int size);
|
||||
extern void flashInit();
|
||||
|
||||
extern int flashSize;
|
||||
extern int g_flashSize;
|
||||
|
||||
#endif // FLASH_H
|
||||
|
|
492
src/gba/GBA.cpp
492
src/gba/GBA.cpp
File diff suppressed because it is too large
Load Diff
|
@ -2,18 +2,18 @@
|
|||
#include "GBAGfx.h"
|
||||
#include "../System.h"
|
||||
|
||||
int coeff[32] = {
|
||||
int g_coeff[32] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
|
||||
};
|
||||
|
||||
uint32_t line0[240];
|
||||
uint32_t line1[240];
|
||||
uint32_t line2[240];
|
||||
uint32_t line3[240];
|
||||
uint32_t lineOBJ[240];
|
||||
uint32_t lineOBJWin[240];
|
||||
uint32_t lineMix[240];
|
||||
uint32_t g_line0[240];
|
||||
uint32_t g_line1[240];
|
||||
uint32_t g_line2[240];
|
||||
uint32_t g_line3[240];
|
||||
uint32_t g_lineOBJ[240];
|
||||
uint32_t g_lineOBJWin[240];
|
||||
uint32_t g_lineMix[240];
|
||||
bool gfxInWin0[240];
|
||||
bool gfxInWin1[240];
|
||||
int lineOBJpixleft[128];
|
||||
|
@ -177,9 +177,9 @@ template <TileReader readTile>
|
|||
static void gfxDrawTextScreen(uint16_t control, uint16_t hofs, uint16_t vofs,
|
||||
uint32_t* line)
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint16_t* screenBase = (uint16_t*)&vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* charBase = &g_vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint16_t* screenBase = (uint16_t*)&g_vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint32_t prio = ((control & 3) << 25) + 0x1000000;
|
||||
int sizeX = 256;
|
||||
int sizeY = 256;
|
||||
|
|
|
@ -49,14 +49,14 @@ void mode5RenderLine();
|
|||
void mode5RenderLineNoWindow();
|
||||
void mode5RenderLineAll();
|
||||
|
||||
extern int coeff[32];
|
||||
extern uint32_t line0[240];
|
||||
extern uint32_t line1[240];
|
||||
extern uint32_t line2[240];
|
||||
extern uint32_t line3[240];
|
||||
extern uint32_t lineOBJ[240];
|
||||
extern uint32_t lineOBJWin[240];
|
||||
extern uint32_t lineMix[240];
|
||||
extern int g_coeff[32];
|
||||
extern uint32_t g_line0[240];
|
||||
extern uint32_t g_line1[240];
|
||||
extern uint32_t g_line2[240];
|
||||
extern uint32_t g_line3[240];
|
||||
extern uint32_t g_lineOBJ[240];
|
||||
extern uint32_t g_lineOBJWin[240];
|
||||
extern uint32_t g_lineMix[240];
|
||||
extern bool gfxInWin0[240];
|
||||
extern bool gfxInWin1[240];
|
||||
extern int lineOBJpixleft[128];
|
||||
|
@ -80,9 +80,9 @@ static inline void gfxClearArray(uint32_t* array)
|
|||
#ifndef TILED_RENDERING
|
||||
static inline void gfxDrawTextScreen(uint16_t control, uint16_t hofs, uint16_t vofs, uint32_t* line)
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
const size_t charBankBaseOffset = ((control >> 2) & 0x03) * 0x4000;
|
||||
uint16_t* screenBase = (uint16_t*)&vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint16_t* screenBase = (uint16_t*)&g_vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint32_t prio = ((control & 3) << 25) + 0x1000000;
|
||||
int sizeX = 256;
|
||||
int sizeY = 256;
|
||||
|
@ -153,7 +153,7 @@ static inline void gfxDrawTextScreen(uint16_t control, uint16_t hofs, uint16_t v
|
|||
// use 0 here.
|
||||
color = 0;
|
||||
} else {
|
||||
color = vram[charBankTotalOffset];
|
||||
color = g_vram[charBankTotalOffset];
|
||||
}
|
||||
|
||||
line[x] = color ? (READ16LE(&palette[color]) | prio) : 0x80000000;
|
||||
|
@ -198,7 +198,7 @@ static inline void gfxDrawTextScreen(uint16_t control, uint16_t hofs, uint16_t v
|
|||
// use 0 here.
|
||||
color = 0;
|
||||
} else {
|
||||
color = vram[charBankTotalOffset];
|
||||
color = g_vram[charBankTotalOffset];
|
||||
if (tileX & 1) {
|
||||
color = (color >> 4);
|
||||
} else {
|
||||
|
@ -243,9 +243,9 @@ static inline void gfxDrawRotScreen(uint16_t control, uint16_t x_l, uint16_t x_h
|
|||
uint16_t pc, uint16_t pd, int& currentX, int& currentY, int changed,
|
||||
uint32_t* line)
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint8_t* screenBase = (uint8_t*)&vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* charBase = &g_vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint8_t* screenBase = (uint8_t*)&g_vram[((control >> 8) & 0x1f) * 0x800];
|
||||
int prio = ((control & 3) << 25) + 0x1000000;
|
||||
|
||||
int sizeX = 128;
|
||||
|
@ -370,7 +370,7 @@ static inline void gfxDrawRotScreen16Bit(uint16_t control, uint16_t x_l, uint16_
|
|||
uint16_t pb, uint16_t pc, uint16_t pd, int& currentX, int& currentY,
|
||||
int changed, uint32_t* line)
|
||||
{
|
||||
uint16_t* screenBase = (uint16_t*)&vram[0];
|
||||
uint16_t* screenBase = (uint16_t*)&g_vram[0];
|
||||
int prio = ((control & 3) << 25) + 0x1000000;
|
||||
int sizeX = 240;
|
||||
int sizeY = 160;
|
||||
|
@ -459,8 +459,8 @@ static inline void gfxDrawRotScreen256(uint16_t control, uint16_t x_l, uint16_t
|
|||
uint16_t pb, uint16_t pc, uint16_t pd, int& currentX, int& currentY,
|
||||
int changed, uint32_t* line)
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint8_t* screenBase = (DISPCNT & 0x0010) ? &vram[0xA000] : &vram[0x0000];
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* screenBase = (DISPCNT & 0x0010) ? &g_vram[0xA000] : &g_vram[0x0000];
|
||||
int prio = ((control & 3) << 25) + 0x1000000;
|
||||
int sizeX = 240;
|
||||
int sizeY = 160;
|
||||
|
@ -552,7 +552,7 @@ static inline void gfxDrawRotScreen16Bit160(uint16_t control, uint16_t x_l, uint
|
|||
uint16_t pb, uint16_t pc, uint16_t pd, int& currentX, int& currentY,
|
||||
int changed, uint32_t* line)
|
||||
{
|
||||
uint16_t* screenBase = (DISPCNT & 0x0010) ? (uint16_t*)&vram[0xa000] : (uint16_t*)&vram[0];
|
||||
uint16_t* screenBase = (DISPCNT & 0x0010) ? (uint16_t*)&g_vram[0xa000] : (uint16_t*)&g_vram[0];
|
||||
int prio = ((control & 3) << 25) + 0x1000000;
|
||||
int sizeX = 160;
|
||||
int sizeY = 128;
|
||||
|
@ -647,8 +647,8 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
int m = 0;
|
||||
gfxClearArray(lineOBJ);
|
||||
if (coreOptions.layerEnable & 0x1000) {
|
||||
uint16_t* sprites = (uint16_t*)oam;
|
||||
uint16_t* spritePalette = &((uint16_t*)paletteRAM)[256];
|
||||
uint16_t* sprites = (uint16_t*)g_oam;
|
||||
uint16_t* spritePalette = &((uint16_t*)g_paletteRAM)[256];
|
||||
int mosaicY = ((MOSAIC & 0xF000) >> 12) + 1;
|
||||
int mosaicX = ((MOSAIC & 0xF00) >> 8) + 1;
|
||||
for (int x = 0; x < 128; x++) {
|
||||
|
@ -744,7 +744,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
lineOBJpix -= 8;
|
||||
// int t2 = t - (fieldY >> 1);
|
||||
int rot = (a1 >> 9) & 0x1F;
|
||||
uint16_t* OAM = (uint16_t*)oam;
|
||||
uint16_t* OAM = (uint16_t*)g_oam;
|
||||
int dx = READ16LE(&OAM[3 + (rot << 4)]);
|
||||
if (dx & 0x8000)
|
||||
dx |= 0xFFFF8000;
|
||||
|
@ -776,8 +776,8 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
inc = sizeX >> 2;
|
||||
else
|
||||
c &= 0x3FE;
|
||||
for (int x = 0; x < fieldX; x++) {
|
||||
if (x >= startpix)
|
||||
for (int y = 0; y < fieldX; y++) {
|
||||
if (y >= startpix)
|
||||
lineOBJpix -= 2;
|
||||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
|
@ -787,7 +787,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
if (xxx < 0 || xxx >= sizeX || yyy < 0 || yyy >= sizeY || sx >= 240)
|
||||
;
|
||||
else {
|
||||
uint32_t color = vram
|
||||
uint32_t color = g_vram
|
||||
[0x10000 + ((((c + (yyy >> 3) * inc)
|
||||
<< 5)
|
||||
+ ((yyy & 7)
|
||||
|
@ -845,8 +845,8 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
if (DISPCNT & 0x40)
|
||||
inc = sizeX >> 3;
|
||||
int palette = (a2 >> 8) & 0xF0;
|
||||
for (int x = 0; x < fieldX; x++) {
|
||||
if (x >= startpix)
|
||||
for (int y = 0; y < fieldX; y++) {
|
||||
if (y >= startpix)
|
||||
lineOBJpix -= 2;
|
||||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
|
@ -855,7 +855,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
if (xxx < 0 || xxx >= sizeX || yyy < 0 || yyy >= sizeY || sx >= 240)
|
||||
;
|
||||
else {
|
||||
uint32_t color = vram
|
||||
uint32_t color = g_vram
|
||||
[0x10000 + ((((c + (yyy >> 3) * inc)
|
||||
<< 5)
|
||||
+ ((yyy & 7)
|
||||
|
@ -956,7 +956,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
if (sx < 240) {
|
||||
uint8_t color = vram[address];
|
||||
uint8_t color = g_vram[address];
|
||||
if ((color == 0) && (((prio >> 25) & 3) < ((lineOBJ[sx] >> 25) & 3))) {
|
||||
lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio;
|
||||
if ((a0 & 0x1000) && m)
|
||||
|
@ -1040,7 +1040,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
if (sx < 240) {
|
||||
uint8_t color = vram[address];
|
||||
uint8_t color = g_vram[address];
|
||||
if (xx & 1) {
|
||||
color = (color >> 4);
|
||||
} else
|
||||
|
@ -1099,7 +1099,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
|||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
if (sx < 240) {
|
||||
uint8_t color = vram[address];
|
||||
uint8_t color = g_vram[address];
|
||||
if (xx & 1) {
|
||||
color = (color >> 4);
|
||||
} else
|
||||
|
@ -1164,8 +1164,8 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
{
|
||||
gfxClearArray(lineOBJWin);
|
||||
if ((coreOptions.layerEnable & 0x9000) == 0x9000) {
|
||||
uint16_t* sprites = (uint16_t*)oam;
|
||||
// uint16_t *spritePalette = &((uint16_t *)paletteRAM)[256];
|
||||
uint16_t* sprites = (uint16_t*)g_oam;
|
||||
// uint16_t *spritePalette = &((uint16_t *)g_paletteRAM)[256];
|
||||
for (int x = 0; x < 128; x++) {
|
||||
int lineOBJpix = lineOBJpixleft[x];
|
||||
uint16_t a0 = READ16LE(sprites++);
|
||||
|
@ -1225,7 +1225,7 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
lineOBJpix -= 8;
|
||||
// int t2 = t - (fieldY >> 1);
|
||||
int rot = (a1 >> 9) & 0x1F;
|
||||
uint16_t* OAM = (uint16_t*)oam;
|
||||
uint16_t* OAM = (uint16_t*)g_oam;
|
||||
int dx = READ16LE(&OAM[3 + (rot << 4)]);
|
||||
if (dx & 0x8000)
|
||||
dx |= 0xFFFF8000;
|
||||
|
@ -1254,8 +1254,8 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
inc = sizeX >> 2;
|
||||
else
|
||||
c &= 0x3FE;
|
||||
for (int x = 0; x < fieldX; x++) {
|
||||
if (x >= startpix)
|
||||
for (int y = 0; y < fieldX; y++) {
|
||||
if (y >= startpix)
|
||||
lineOBJpix -= 2;
|
||||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
|
@ -1264,7 +1264,7 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
|
||||
if (xxx < 0 || xxx >= sizeX || yyy < 0 || yyy >= sizeY || sx >= 240) {
|
||||
} else {
|
||||
uint32_t color = vram
|
||||
uint32_t color = g_vram
|
||||
[0x10000 + ((((c + (yyy >> 3) * inc)
|
||||
<< 5)
|
||||
+ ((yyy & 7) << 3) + ((xxx >> 3) << 6) + (xxx & 7))
|
||||
|
@ -1286,8 +1286,8 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
if (DISPCNT & 0x40)
|
||||
inc = sizeX >> 3;
|
||||
// int palette = (a2 >> 8) & 0xF0;
|
||||
for (int x = 0; x < fieldX; x++) {
|
||||
if (x >= startpix)
|
||||
for (int y = 0; y < fieldX; y++) {
|
||||
if (y >= startpix)
|
||||
lineOBJpix -= 2;
|
||||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
|
@ -1298,12 +1298,12 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
// (sizeX-1) ||
|
||||
// t == 0 || t ==
|
||||
// (sizeY-1)) {
|
||||
// lineOBJ[sx] =
|
||||
// g_lineOBJ[sx] =
|
||||
// 0x001F | prio;
|
||||
// } else {
|
||||
if (xxx < 0 || xxx >= sizeX || yyy < 0 || yyy >= sizeY || sx >= 240) {
|
||||
} else {
|
||||
uint32_t color = vram
|
||||
uint32_t color = g_vram
|
||||
[0x10000 + ((((c + (yyy >> 3) * inc)
|
||||
<< 5)
|
||||
+ ((yyy & 7) << 2) + ((xxx >> 3) << 5) + ((xxx & 7) >> 1))
|
||||
|
@ -1364,7 +1364,7 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
if (sx < 240) {
|
||||
uint8_t color = vram[address];
|
||||
uint8_t color = g_vram[address];
|
||||
if (color) {
|
||||
lineOBJWin[sx] = 1;
|
||||
}
|
||||
|
@ -1418,7 +1418,7 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
if (sx < 240) {
|
||||
uint8_t color = vram[address];
|
||||
uint8_t color = g_vram[address];
|
||||
if (xx & 1) {
|
||||
color = (color >> 4);
|
||||
} else
|
||||
|
@ -1448,7 +1448,7 @@ static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
|||
if (lineOBJpix < 0)
|
||||
continue;
|
||||
if (sx < 240) {
|
||||
uint8_t color = vram[address];
|
||||
uint8_t color = g_vram[address];
|
||||
if (xx & 1) {
|
||||
color = (color >> 4);
|
||||
} else
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define UPDATE_REG(address, value) WRITE16LE(((uint16_t*)&ioMem[address]), value)
|
||||
#define UPDATE_REG(address, value) WRITE16LE(((uint16_t*)&g_ioMem[address]), value)
|
||||
|
||||
static int vbaid = 0;
|
||||
const char* MakeInstanceFilename(const char* Input)
|
||||
|
@ -63,7 +63,7 @@ bool speedhack = true;
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t IP_LINK_PORT = 5738;
|
||||
uint16_t IP_LINK_PORT = 5738;
|
||||
|
||||
std::string IP_LINK_BIND_ADDRESS = "*";
|
||||
|
||||
|
@ -400,7 +400,6 @@ typedef struct {
|
|||
} LANLINKDATA;
|
||||
|
||||
class CableServer {
|
||||
int numbytes;
|
||||
sf::SocketSelector fdset;
|
||||
//timeval udptimeout;
|
||||
char inbuffer[256], outbuffer[256];
|
||||
|
@ -442,7 +441,6 @@ public:
|
|||
void CheckConn(void);
|
||||
};
|
||||
|
||||
static int i, j;
|
||||
static int linktimeout = 1;
|
||||
static LANLINKDATA lanlink;
|
||||
static uint16_t cable_data[4];
|
||||
|
@ -475,7 +473,7 @@ static const int trtimeend[3][4] = {
|
|||
// Hodgepodge
|
||||
static uint8_t tspeed = 3;
|
||||
static bool transfer_direction = false;
|
||||
static int linkid = 0;
|
||||
static uint16_t linkid = 0;
|
||||
#if (defined __WIN32__ || defined _WIN32)
|
||||
static HANDLE linksync[4];
|
||||
#else
|
||||
|
@ -712,13 +710,13 @@ void StartGPLink(uint16_t value)
|
|||
if (!value)
|
||||
return;
|
||||
|
||||
switch (GetSIOMode(READ16LE(&ioMem[COMM_SIOCNT]), value)) {
|
||||
switch (GetSIOMode(READ16LE(&g_ioMem[COMM_SIOCNT]), value)) {
|
||||
case MULTIPLAYER:
|
||||
value &= 0xc0f0;
|
||||
value |= 3;
|
||||
if (linkid)
|
||||
value |= 4;
|
||||
UPDATE_REG(COMM_SIOCNT, ((READ16LE(&ioMem[COMM_SIOCNT]) & 0xff8b) | (linkid ? 0xc : 8) | (linkid << 4)));
|
||||
UPDATE_REG(COMM_SIOCNT, ((READ16LE(&g_ioMem[COMM_SIOCNT]) & 0xff8b) | (linkid ? 0xcu : 8u) | (linkid << 4u)));
|
||||
break;
|
||||
|
||||
case GP:
|
||||
|
@ -817,14 +815,14 @@ void CableServer::Recv(void)
|
|||
if (lanlink.type == 0) { // TCP
|
||||
fdset.clear();
|
||||
|
||||
for (i = 0; i < lanlink.numslaves; i++)
|
||||
for (int i = 0; i < lanlink.numslaves; i++)
|
||||
fdset.add(tcpsocket[i + 1]);
|
||||
|
||||
if (fdset.wait(sf::milliseconds(50)) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < lanlink.numslaves; i++) {
|
||||
for (int i = 0; i < lanlink.numslaves; i++) {
|
||||
numbytes = 0;
|
||||
inbuffer[0] = 1;
|
||||
while (numbytes < inbuffer[0]) {
|
||||
|
@ -878,14 +876,14 @@ bool CableServer::RecvGB(void)
|
|||
if (lanlink.type == 0) { // TCP
|
||||
fdset.clear();
|
||||
|
||||
for (i = 0; i < lanlink.numslaves; i++)
|
||||
for (int i = 0; i < lanlink.numslaves; i++)
|
||||
fdset.add(tcpsocket[i + 1]);
|
||||
|
||||
if (fdset.wait(sf::milliseconds(1)) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < lanlink.numslaves; i++) {
|
||||
for (int i = 0; i < lanlink.numslaves; i++) {
|
||||
numbytes = 0;
|
||||
uint8_t recv_byte = 0;
|
||||
|
||||
|
@ -946,10 +944,10 @@ void CableClient::CheckConn(void)
|
|||
transfer_start_time_from_master = 0;
|
||||
cable_data[0] = READ16LE(&uint16_tinbuffer[1]);
|
||||
tspeed = inbuffer[1] & 3;
|
||||
for (i = 1, numbytes = 4; i <= lanlink.numslaves; i++)
|
||||
for (int i = 1, bytes = 4; i <= lanlink.numslaves; i++)
|
||||
if (i != linkid) {
|
||||
cable_data[i] = READ16LE(&uint16_tinbuffer[numbytes]);
|
||||
numbytes++;
|
||||
cable_data[i] = READ16LE(&uint16_tinbuffer[bytes]);
|
||||
bytes++;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -1025,10 +1023,10 @@ void CableClient::Recv(void)
|
|||
tspeed = inbuffer[1] & 3;
|
||||
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++) {
|
||||
for (int i = 1, bytes = 4; i < lanlink.numslaves + 1; i++) {
|
||||
if (i != linkid) {
|
||||
cable_data[i] = READ16LE(&uint16_tinbuffer[numbytes]);
|
||||
numbytes++;
|
||||
cable_data[i] = READ16LE(&uint16_tinbuffer[bytes]);
|
||||
bytes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1168,7 +1166,7 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||
|
||||
void StartCableSocket(uint16_t value)
|
||||
{
|
||||
switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) {
|
||||
switch (GetSIOMode(value, READ16LE(&g_ioMem[COMM_RCNT]))) {
|
||||
case MULTIPLAYER: {
|
||||
bool start = (value & 0x80) && !linkid && !transfer_direction;
|
||||
// clear start, seqno, si (RO on slave, start = pulse on master)
|
||||
|
@ -1178,10 +1176,10 @@ void StartCableSocket(uint16_t value)
|
|||
if (!transfer_direction)
|
||||
value |= 4;
|
||||
else
|
||||
value |= READ16LE(&ioMem[COMM_SIOCNT]) & 4;
|
||||
value |= READ16LE(&g_ioMem[COMM_SIOCNT]) & 4;
|
||||
}
|
||||
if (start) {
|
||||
cable_data[0] = READ16LE(&ioMem[COMM_SIODATA8]);
|
||||
cable_data[0] = READ16LE(&g_ioMem[COMM_SIODATA8]);
|
||||
transfer_start_time_from_master = linktime;
|
||||
tspeed = value & 3;
|
||||
ls.Send();
|
||||
|
@ -1189,7 +1187,7 @@ void StartCableSocket(uint16_t value)
|
|||
linktime = 0;
|
||||
UPDATE_REG(COMM_SIOMULTI0, cable_data[0]);
|
||||
UPDATE_REG(COMM_SIOMULTI1, 0xffff);
|
||||
WRITE32LE(&ioMem[COMM_SIOMULTI2], 0xffffffff);
|
||||
WRITE32LE(&g_ioMem[COMM_SIOMULTI2], 0xffffffff);
|
||||
value &= ~0x40;
|
||||
}
|
||||
value |= (transfer_direction ? 1 : 0) << 7;
|
||||
|
@ -1220,22 +1218,22 @@ static void UpdateCableSocket(int ticks)
|
|||
{
|
||||
(void)ticks; // unused param
|
||||
if (linkid && transfer_direction == SENDING && lc.transferring && linktime >= transfer_start_time_from_master) {
|
||||
cable_data[linkid] = READ16LE(&ioMem[COMM_SIODATA8]);
|
||||
cable_data[linkid] = READ16LE(&g_ioMem[COMM_SIODATA8]);
|
||||
|
||||
lc.Send();
|
||||
UPDATE_REG(COMM_SIODATA32_L, cable_data[0]);
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&ioMem[COMM_SIOCNT]) | 0x80);
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&g_ioMem[COMM_SIOCNT]) | 0x80);
|
||||
transfer_direction = RECEIVING;
|
||||
linktime = 0;
|
||||
}
|
||||
|
||||
if (transfer_direction == RECEIVING && linktime >= trtimeend[lanlink.numslaves - 1][tspeed]) {
|
||||
if (READ16LE(&ioMem[COMM_SIOCNT]) & 0x4000) {
|
||||
if (READ16LE(&g_ioMem[COMM_SIOCNT]) & 0x4000) {
|
||||
IF |= 0x80;
|
||||
UPDATE_REG(0x202, IF);
|
||||
}
|
||||
|
||||
UPDATE_REG(COMM_SIOCNT, (READ16LE(&ioMem[COMM_SIOCNT]) & 0xff0f) | (linkid << 4));
|
||||
UPDATE_REG(COMM_SIOCNT, (READ16LE(&g_ioMem[COMM_SIOCNT]) & 0xff0f) | (linkid << 4));
|
||||
transfer_direction = SENDING;
|
||||
linktime -= trtimeend[lanlink.numslaves - 1][tspeed];
|
||||
|
||||
|
@ -1306,7 +1304,7 @@ static void JoyBusUpdate(int ticks)
|
|||
lastjoybusupdate += ticks;
|
||||
lastcommand += ticks;
|
||||
|
||||
bool joybus_activated = ((READ16LE(&ioMem[COMM_RCNT])) >> 14) == 3;
|
||||
bool joybus_activated = ((READ16LE(&g_ioMem[COMM_RCNT])) >> 14) == 3;
|
||||
gba_joybus_active = dol && gba_joybus_enabled && joybus_activated;
|
||||
|
||||
if ((lastjoybusupdate > nextjoybusupdate)) {
|
||||
|
@ -1350,7 +1348,7 @@ static void JoyBusUpdate(int ticks)
|
|||
|
||||
switch (cmd) {
|
||||
case JOY_CMD_RESET:
|
||||
UPDATE_REG(COMM_JOYCNT, READ16LE(&ioMem[COMM_JOYCNT]) | JOYCNT_RESET);
|
||||
UPDATE_REG(COMM_JOYCNT, READ16LE(&g_ioMem[COMM_JOYCNT]) | JOYCNT_RESET);
|
||||
resp.push_back(0x00); // GBA device ID
|
||||
resp.push_back(0x04);
|
||||
nextjoybusupdate = TICKS_PER_SECOND / BYTES_PER_SECOND;
|
||||
|
@ -1364,12 +1362,12 @@ static void JoyBusUpdate(int ticks)
|
|||
break;
|
||||
|
||||
case JOY_CMD_READ:
|
||||
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));
|
||||
resp.push_back((uint8_t)(READ16LE(&g_ioMem[COMM_JOY_TRANS_L]) & 0xff));
|
||||
resp.push_back((uint8_t)(READ16LE(&g_ioMem[COMM_JOY_TRANS_L]) >> 8));
|
||||
resp.push_back((uint8_t)(READ16LE(&g_ioMem[COMM_JOY_TRANS_H]) & 0xff));
|
||||
resp.push_back((uint8_t)(READ16LE(&g_ioMem[COMM_JOY_TRANS_H]) >> 8));
|
||||
|
||||
UPDATE_REG(COMM_JOYCNT, READ16LE(&ioMem[COMM_JOYCNT]) | JOYCNT_SEND_COMPLETE);
|
||||
UPDATE_REG(COMM_JOYCNT, READ16LE(&g_ioMem[COMM_JOYCNT]) | JOYCNT_SEND_COMPLETE);
|
||||
nextjoybusupdate = TICKS_PER_SECOND / BYTES_PER_SECOND;
|
||||
booted = true;
|
||||
break;
|
||||
|
@ -1377,8 +1375,8 @@ static void JoyBusUpdate(int ticks)
|
|||
case JOY_CMD_WRITE:
|
||||
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);
|
||||
UPDATE_REG(COMM_JOYSTAT, READ16LE(&g_ioMem[COMM_JOYSTAT]) | JOYSTAT_RECV);
|
||||
UPDATE_REG(COMM_JOYCNT, READ16LE(&g_ioMem[COMM_JOYCNT]) | JOYCNT_RECV_COMPLETE);
|
||||
nextjoybusupdate = TICKS_PER_SECOND / BYTES_PER_SECOND;
|
||||
booted = true;
|
||||
break;
|
||||
|
@ -1390,17 +1388,17 @@ static void JoyBusUpdate(int ticks)
|
|||
}
|
||||
|
||||
lastjoybusupdate = 0;
|
||||
resp.push_back((uint8_t)READ16LE(&ioMem[COMM_JOYSTAT]));
|
||||
resp.push_back((uint8_t)READ16LE(&g_ioMem[COMM_JOYSTAT]));
|
||||
|
||||
if (cmd == JOY_CMD_READ) {
|
||||
UPDATE_REG(COMM_JOYSTAT, READ16LE(&ioMem[COMM_JOYSTAT]) & ~JOYSTAT_SEND);
|
||||
UPDATE_REG(COMM_JOYSTAT, READ16LE(&g_ioMem[COMM_JOYSTAT]) & ~JOYSTAT_SEND);
|
||||
}
|
||||
|
||||
dol->Send(resp);
|
||||
|
||||
// Generate SIO interrupt if we can
|
||||
if (((cmd == JOY_CMD_RESET) || (cmd == JOY_CMD_READ) || (cmd == JOY_CMD_WRITE))
|
||||
&& (READ16LE(&ioMem[COMM_JOYCNT]) & JOYCNT_INT_ENABLE)) {
|
||||
&& (READ16LE(&g_ioMem[COMM_JOYCNT]) & JOYCNT_INT_ENABLE)) {
|
||||
IF |= 0x80;
|
||||
UPDATE_REG(0x202, IF);
|
||||
}
|
||||
|
@ -1521,7 +1519,7 @@ void RFUServer::Recv(void)
|
|||
if (lanlink.type == 0) { // TCP
|
||||
fdset.clear();
|
||||
|
||||
for (i = 0; i < lanlink.numslaves; i++)
|
||||
for (int i = 0; i < lanlink.numslaves; i++)
|
||||
fdset.add(tcpsocket[i + 1]);
|
||||
|
||||
//bool all_ready = false;
|
||||
|
@ -1538,7 +1536,7 @@ void RFUServer::Recv(void)
|
|||
// all_ready = true;
|
||||
//}
|
||||
|
||||
for (i = 0; i < lanlink.numslaves; i++) {
|
||||
for (int i = 0; i < lanlink.numslaves; i++) {
|
||||
sf::Packet packet;
|
||||
tcpsocket[i + 1].setBlocking(false);
|
||||
sf::Socket::Status status = tcpsocket[i + 1].receive(packet);
|
||||
|
@ -1750,19 +1748,19 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||
// The GBA wireless RFU (see adapter3.txt)
|
||||
static void StartRFUSocket(uint16_t value)
|
||||
{
|
||||
int siomode = GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]));
|
||||
int siomode = GetSIOMode(value, READ16LE(&g_ioMem[COMM_RCNT]));
|
||||
|
||||
if (value)
|
||||
rfu_enabled = (siomode == NORMAL32);
|
||||
|
||||
if (((READ16LE(&ioMem[COMM_SIOCNT]) & 0x5080) == SIO_TRANS_32BIT) && ((value & 0x5080) == (SIO_TRANS_32BIT | SIO_IRQ_ENABLE | SIO_TRANS_START))) { //RFU Reset, may also occur before cable link started
|
||||
if (((READ16LE(&g_ioMem[COMM_SIOCNT]) & 0x5080) == SIO_TRANS_32BIT) && ((value & 0x5080) == (SIO_TRANS_32BIT | SIO_IRQ_ENABLE | SIO_TRANS_START))) { //RFU Reset, may also occur before cable link started
|
||||
rfu_data.rfu_listfront[linkid] = 0;
|
||||
rfu_data.rfu_listback[linkid] = 0;
|
||||
}
|
||||
|
||||
if (!rfu_enabled) {
|
||||
if ((value & 0x5080) == (SIO_TRANS_32BIT | SIO_IRQ_ENABLE | SIO_TRANS_START)) { //0x5083 //game tried to send wireless command but w/o the adapter
|
||||
if (READ16LE(&ioMem[COMM_SIOCNT]) & SIO_IRQ_ENABLE) //IRQ Enable
|
||||
if (READ16LE(&g_ioMem[COMM_SIOCNT]) & SIO_IRQ_ENABLE) //IRQ Enable
|
||||
{
|
||||
IF |= 0x80; //Serial Communication
|
||||
UPDATE_REG(0x202, IF); //Interrupt Request Flags / IRQ Acknowledge
|
||||
|
@ -1776,7 +1774,7 @@ static void StartRFUSocket(uint16_t value)
|
|||
|
||||
uint32_t CurCOM = 0, CurDAT = 0;
|
||||
|
||||
switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) {
|
||||
switch (GetSIOMode(value, READ16LE(&g_ioMem[COMM_RCNT]))) {
|
||||
case NORMAL8:
|
||||
rfu_polarity = 0;
|
||||
UPDATE_REG(COMM_SIOCNT, value);
|
||||
|
@ -1806,34 +1804,34 @@ static void StartRFUSocket(uint16_t value)
|
|||
else
|
||||
rfu_transfer_end = 256;
|
||||
|
||||
uint16_t siodata_h = READ16LE(&ioMem[COMM_SIODATA32_H]);
|
||||
uint16_t siodata_h = READ16LE(&g_ioMem[COMM_SIODATA32_H]);
|
||||
switch (rfu_state) {
|
||||
case RFU_INIT:
|
||||
if (READ32LE(&ioMem[COMM_SIODATA32_L]) == 0xb0bb8001) {
|
||||
if (READ32LE(&g_ioMem[COMM_SIODATA32_L]) == 0xb0bb8001) {
|
||||
rfu_state = RFU_COMM; // end of startup
|
||||
rfu_initialized = true;
|
||||
value &= ~SIO_TRANS_FLAG_RECV_ENABLE; //0xff7b; //Bit.2 need to be 0 to indicate a finished initialization to fix MarioGolfAdv from occasionally Not Detecting wireless adapter (prevent it from sending 0x7FFE8001 comm)?
|
||||
rfu_polarity = 0; //not needed?
|
||||
}
|
||||
rfu_buf = (READ16LE(&ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
rfu_buf = (READ16LE(&g_ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
break;
|
||||
case RFU_COMM:
|
||||
CurCOM = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
CurCOM = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
if (siodata_h == 0x9966) //initialize cmd
|
||||
{
|
||||
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;
|
||||
if ((rfu_qsend2 = rfu_qsend = ioMem[0x121]) != 0) { //COMM_SIODATA32_L+1, following data [to send]
|
||||
if ((rfu_qsend2 = rfu_qsend = g_ioMem[0x121]) != 0) { //COMM_SIODATA32_L+1, following data [to send]
|
||||
rfu_state = RFU_SEND;
|
||||
}
|
||||
if (ioMem[COMM_SIODATA32_L] == 0xee) { //0xee cmd shouldn't override previous cmd
|
||||
if (g_ioMem[COMM_SIODATA32_L] == 0xee) { //0xee cmd shouldn't override previous cmd
|
||||
rfu_lastcmd = rfu_cmd2;
|
||||
rfu_cmd2 = ioMem[COMM_SIODATA32_L];
|
||||
rfu_cmd2 = g_ioMem[COMM_SIODATA32_L];
|
||||
} else {
|
||||
rfu_lastcmd = rfu_cmd;
|
||||
rfu_cmd = ioMem[COMM_SIODATA32_L];
|
||||
rfu_cmd = g_ioMem[COMM_SIODATA32_L];
|
||||
rfu_cmd2 = 0;
|
||||
if (rfu_cmd == 0x27 || rfu_cmd == 0x37) {
|
||||
rfu_lastcmd2 = rfu_cmd;
|
||||
|
@ -1868,7 +1866,7 @@ static void StartRFUSocket(uint16_t value)
|
|||
}
|
||||
}
|
||||
if (rfu_waiting)
|
||||
rfu_buf = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_buf = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
else
|
||||
rfu_buf = 0x80000000;
|
||||
} else if (siodata_h == 0x8000) //finalize cmd, the game will send this when polarity reversed (expecting something)
|
||||
|
@ -2295,44 +2293,44 @@ static void StartRFUSocket(uint16_t value)
|
|||
if (!rfu_waiting)
|
||||
rfu_buf = 0x99660000 | (rfu_qrecv_broadcast_data_len << 8) | rfu_cmd;
|
||||
else
|
||||
rfu_buf = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_buf = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
}
|
||||
} else { //unknown COMM word //in MarioGolfAdv (when a player/client exiting lobby), There is a possibility COMM = 0x7FFE8001, PrevVAL = 0x5087, PrevCOM = 0, is this part of initialization?
|
||||
log("%09d: UnkCOM %08X %04X %08X %08X\n", linktime, READ32LE(&ioMem[COMM_SIODATA32_L]), PrevVAL, PrevCOM, PrevDAT);
|
||||
if ((READ32LE(&ioMem[COMM_SIODATA32_L]) >> 24) != 0x7ff)
|
||||
log("%09d: UnkCOM %08X %04X %08X %08X\n", linktime, READ32LE(&g_ioMem[COMM_SIODATA32_L]), PrevVAL, PrevCOM, PrevDAT);
|
||||
if ((READ32LE(&g_ioMem[COMM_SIODATA32_L]) >> 24) != 0x7ff)
|
||||
rfu_state = RFU_INIT; //to prevent the next reinit words from getting in finalization processing (here), may cause MarioGolfAdv to show Linking error when this occurs instead of continuing with COMM cmd
|
||||
rfu_buf = (READ16LE(&ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
rfu_buf = (READ16LE(&g_ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
}
|
||||
break;
|
||||
|
||||
case RFU_SEND: //data following after initialize cmd
|
||||
CurDAT = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
CurDAT = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
if (--rfu_qsend == 0) {
|
||||
rfu_state = RFU_COMM;
|
||||
}
|
||||
|
||||
switch (rfu_cmd) {
|
||||
case 0x16:
|
||||
rfu_data.rfu_broadcastdata[linkid][1 + rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_data.rfu_broadcastdata[linkid][1 + rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
case 0x17:
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
case 0x1f:
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
case 0x24:
|
||||
//if(rfu_data.rfu_proto[linkid]) break; //important data from 0x25 shouldn't be overwritten by 0x24
|
||||
case 0x25:
|
||||
case 0x35:
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
default:
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
}
|
||||
rfu_buf = 0x80000000;
|
||||
|
@ -2401,7 +2399,6 @@ static void StartRFUSocket(uint16_t value)
|
|||
UPDATE_REG(COMM_SIOCNT, value);
|
||||
return;
|
||||
}
|
||||
UPDATE_REG(COMM_SIOCNT, value);
|
||||
}
|
||||
|
||||
bool LinkRFUUpdateSocket()
|
||||
|
@ -2425,7 +2422,7 @@ bool LinkRFUUpdateSocket()
|
|||
else if (rfu_cmd == 0xb5 || rfu_cmd == 0xb7)
|
||||
rfu_cmd = 0x36;
|
||||
|
||||
if (READ32LE(&ioMem[COMM_SIODATA32_L]) == 0x80000000)
|
||||
if (READ32LE(&g_ioMem[COMM_SIODATA32_L]) == 0x80000000)
|
||||
rfu_buf = 0x99660000 | (rfu_qrecv_broadcast_data_len << 8) | rfu_cmd;
|
||||
else
|
||||
rfu_buf = 0x80000000;
|
||||
|
@ -2471,7 +2468,7 @@ static void UpdateRFUSocket(int ticks)
|
|||
if (LinkRFUUpdateSocket()) {
|
||||
if (transfer_direction == RECEIVING && rfu_transfer_end <= 0) {
|
||||
transfer_direction = SENDING;
|
||||
uint16_t value = READ16LE(&ioMem[COMM_SIOCNT]);
|
||||
uint16_t value = READ16LE(&g_ioMem[COMM_SIOCNT]);
|
||||
if (value & SIO_IRQ_ENABLE) {
|
||||
IF |= 0x80;
|
||||
UPDATE_REG(0x202, IF);
|
||||
|
@ -2636,7 +2633,7 @@ static ConnectionState InitIPC()
|
|||
linkmem->linkflags = 1;
|
||||
linkmem->numgbas = 1;
|
||||
linkmem->numtransfers = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
linkmem->linkdata[i] = 0xffff;
|
||||
} else {
|
||||
// FIXME: this should be done while linkmem is locked
|
||||
|
@ -2667,14 +2664,14 @@ static ConnectionState InitIPC()
|
|||
}
|
||||
linkid = vbaid;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
linkevent[sizeof(linkevent) - 2] = (char)i + '1';
|
||||
#if (defined __WIN32__ || defined _WIN32)
|
||||
linksync[i] = firstone ? CreateSemaphore(NULL, 0, 4, linkevent) : OpenSemaphore(SEMAPHORE_ALL_ACCESS, false, linkevent);
|
||||
if (linksync[i] == NULL) {
|
||||
UnmapViewOfFile(linkmem);
|
||||
CloseHandle(mmf);
|
||||
for (j = 0; j < i; j++) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
CloseHandle(linksync[j]);
|
||||
}
|
||||
systemMessage(0, N_("Error opening event"));
|
||||
|
@ -2707,7 +2704,7 @@ static ConnectionState InitIPC()
|
|||
|
||||
static void StartCableIPC(uint16_t value)
|
||||
{
|
||||
switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) {
|
||||
switch (GetSIOMode(value, READ16LE(&g_ioMem[COMM_RCNT]))) {
|
||||
case MULTIPLAYER: {
|
||||
bool start = (value & 0x80) && !linkid && !transfer_direction;
|
||||
// clear start, seqno, si (RO on slave, start = pulse on master)
|
||||
|
@ -2717,7 +2714,7 @@ static void StartCableIPC(uint16_t value)
|
|||
if (!transfer_direction)
|
||||
value |= 4;
|
||||
else
|
||||
value |= READ16LE(&ioMem[COMM_SIOCNT]) & 4;
|
||||
value |= READ16LE(&g_ioMem[COMM_SIOCNT]) & 4;
|
||||
}
|
||||
if (start) {
|
||||
if (linkmem->numgbas > 1) {
|
||||
|
@ -2743,7 +2740,7 @@ static void StartCableIPC(uint16_t value)
|
|||
|
||||
// transmit first value
|
||||
linkmem->linkcmd[0] = ('M' << 8) + (value & 3);
|
||||
linkmem->linkdata[0] = READ16LE(&ioMem[COMM_SIODATA8]);
|
||||
linkmem->linkdata[0] = READ16LE(&g_ioMem[COMM_SIODATA8]);
|
||||
|
||||
// start up slaves & sync clocks
|
||||
numtransfers = linkmem->numtransfers;
|
||||
|
@ -2760,8 +2757,8 @@ static void StartCableIPC(uint16_t value)
|
|||
transfer_direction = 1;
|
||||
linktime = 0;
|
||||
tspeed = value & 3;
|
||||
WRITE32LE(&ioMem[COMM_SIOMULTI0], 0xffffffff);
|
||||
WRITE32LE(&ioMem[COMM_SIOMULTI2], 0xffffffff);
|
||||
WRITE32LE(&g_ioMem[COMM_SIOMULTI0], 0xffffffff);
|
||||
WRITE32LE(&g_ioMem[COMM_SIOMULTI2], 0xffffffff);
|
||||
value &= ~0x40;
|
||||
} else {
|
||||
value |= 0x40; // comm error
|
||||
|
@ -2806,9 +2803,9 @@ static void ReconnectCableIPC()
|
|||
systemScreenMessage(_("Lost link; reconnected"));
|
||||
}
|
||||
|
||||
static void UpdateCableIPC(int ticks)
|
||||
static void UpdateCableIPC(int)
|
||||
{
|
||||
if (((READ16LE(&ioMem[COMM_RCNT])) >> 14) == 3)
|
||||
if (((READ16LE(&g_ioMem[COMM_RCNT])) >> 14) == 3)
|
||||
return;
|
||||
|
||||
// slave startup depends on detecting change in numtransfers
|
||||
|
@ -2852,9 +2849,9 @@ static void UpdateCableIPC(int ticks)
|
|||
#endif
|
||||
tspeed = linkmem->linkcmd[0] & 3;
|
||||
transfer_direction = 1;
|
||||
WRITE32LE(&ioMem[COMM_SIOMULTI0], 0xffffffff);
|
||||
WRITE32LE(&ioMem[COMM_SIOMULTI2], 0xffffffff);
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&ioMem[COMM_SIOCNT]) & ~0x40 | 0x80);
|
||||
WRITE32LE(&g_ioMem[COMM_SIOMULTI0], 0xffffffff);
|
||||
WRITE32LE(&g_ioMem[COMM_SIOMULTI2], 0xffffffff);
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&g_ioMem[COMM_SIOCNT]) & ~0x40 | 0x80);
|
||||
#if 0
|
||||
break;
|
||||
}
|
||||
|
@ -2900,9 +2897,9 @@ static void UpdateCableIPC(int ticks)
|
|||
return;
|
||||
}
|
||||
// SI becomes low
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&ioMem[COMM_SIOCNT]) & ~4);
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&g_ioMem[COMM_SIOCNT]) & ~4);
|
||||
UPDATE_REG(COMM_RCNT, 10);
|
||||
linkmem->linkdata[linkid] = READ16LE(&ioMem[COMM_SIODATA8]);
|
||||
linkmem->linkdata[linkid] = READ16LE(&g_ioMem[COMM_SIODATA8]);
|
||||
ReleaseSemaphore(linksync[linkid], linkmem->numgbas - 1, NULL);
|
||||
}
|
||||
if (linkid == transfer_direction - 1) {
|
||||
|
@ -2933,7 +2930,7 @@ static void UpdateCableIPC(int ticks)
|
|||
ReleaseSemaphore(linksync[0], 1, NULL);
|
||||
linktime -= trtimeend[transfer_direction - 3][tspeed];
|
||||
transfer_direction = 0;
|
||||
uint16_t value = READ16LE(&ioMem[COMM_SIOCNT]);
|
||||
uint16_t value = READ16LE(&g_ioMem[COMM_SIOCNT]);
|
||||
if (!linkid)
|
||||
value |= 4; // SI becomes high on slaves after xfer
|
||||
UPDATE_REG(COMM_SIOCNT, (value & 0xff0f) | (linkid << 4));
|
||||
|
@ -2949,13 +2946,13 @@ static void UpdateCableIPC(int ticks)
|
|||
// The GBA wireless RFU (see adapter3.txt)
|
||||
static void StartRFU(uint16_t value)
|
||||
{
|
||||
int siomode = GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]));
|
||||
int siomode = GetSIOMode(value, READ16LE(&g_ioMem[COMM_RCNT]));
|
||||
|
||||
if (value)
|
||||
rfu_enabled = (siomode == NORMAL32);
|
||||
|
||||
if (((READ16LE(&ioMem[COMM_SIOCNT]) & 0x5080) == 0x1000) && ((value & 0x5080) == 0x5080)) { //RFU Reset, may also occur before cable link started
|
||||
log("RFU Reset2 : %04X %04X %d\n", READ16LE(&ioMem[COMM_RCNT]), READ16LE(&ioMem[COMM_SIOCNT]), GetTickCount());
|
||||
if (((READ16LE(&g_ioMem[COMM_SIOCNT]) & 0x5080) == 0x1000) && ((value & 0x5080) == 0x5080)) { //RFU Reset, may also occur before cable link started
|
||||
log("RFU Reset2 : %04X %04X %d\n", READ16LE(&g_ioMem[COMM_RCNT]), READ16LE(&g_ioMem[COMM_SIOCNT]), GetTickCount());
|
||||
linkmem->rfu_listfront[vbaid] = 0;
|
||||
linkmem->rfu_listback[vbaid] = 0;
|
||||
}
|
||||
|
@ -2966,7 +2963,7 @@ static void StartRFU(uint16_t value)
|
|||
value &= 0xfffb; //Transfer enable flag receive (0=Enable Transfer/Ready, bit.2=bit.3 of otherside) // A kind of acknowledge procedure
|
||||
else //(Bit.3, 0=Enable Transfer/Ready)
|
||||
value |= 4; //bit.2=1 (otherside is Not Ready)*/
|
||||
if (READ16LE(&ioMem[COMM_SIOCNT]) & 0x4000) //IRQ Enable
|
||||
if (READ16LE(&g_ioMem[COMM_SIOCNT]) & 0x4000) //IRQ Enable
|
||||
{
|
||||
IF |= 0x80; //Serial Communication
|
||||
UPDATE_REG(0x202, IF); //Interrupt Request Flags / IRQ Acknowledge
|
||||
|
@ -2981,9 +2978,9 @@ static void StartRFU(uint16_t value)
|
|||
linktimeout = 1;
|
||||
|
||||
uint32_t CurCOM = 0, CurDAT = 0;
|
||||
bool rfulogd = (READ16LE(&ioMem[COMM_SIOCNT]) != value);
|
||||
// bool rfulogd = (READ16LE(&g_ioMem[COMM_SIOCNT]) != value);
|
||||
|
||||
switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) {
|
||||
switch (GetSIOMode(value, READ16LE(&g_ioMem[COMM_RCNT]))) {
|
||||
case NORMAL8:
|
||||
rfu_polarity = 0;
|
||||
UPDATE_REG(COMM_SIOCNT, value);
|
||||
|
@ -3011,19 +3008,19 @@ static void StartRFU(uint16_t value)
|
|||
rfu_transfer_end = 2048;
|
||||
else
|
||||
rfu_transfer_end = 256;
|
||||
uint16_t siodata_h = READ16LE(&ioMem[COMM_SIODATA32_H]);
|
||||
uint16_t siodata_h = READ16LE(&g_ioMem[COMM_SIODATA32_H]);
|
||||
switch (rfu_state) {
|
||||
case RFU_INIT:
|
||||
if (READ32LE(&ioMem[COMM_SIODATA32_L]) == 0xb0bb8001) {
|
||||
if (READ32LE(&g_ioMem[COMM_SIODATA32_L]) == 0xb0bb8001) {
|
||||
rfu_state = RFU_COMM; // end of startup
|
||||
rfu_initialized = true;
|
||||
value &= 0xfffb; //0xff7b; //Bit.2 need to be 0 to indicate a finished initialization to fix MarioGolfAdv from occasionally Not Detecting wireless adapter (prevent it from sending 0x7FFE8001 comm)?
|
||||
rfu_polarity = 0; //not needed?
|
||||
}
|
||||
rfu_buf = (READ16LE(&ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
rfu_buf = (READ16LE(&g_ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
break;
|
||||
case RFU_COMM:
|
||||
CurCOM = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
CurCOM = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
if (siodata_h == 0x9966) //initialize cmd
|
||||
{
|
||||
uint8_t tmpcmd = CurCOM;
|
||||
|
@ -3031,16 +3028,16 @@ static void StartRFU(uint16_t value)
|
|||
log("%08X : UnkCMD %08X %04X %08X %08X\n", GetTickCount(), CurCOM, PrevVAL, PrevCOM, PrevDAT);
|
||||
}
|
||||
rfu_counter = 0;
|
||||
if ((rfu_qsend2 = rfu_qsend = ioMem[0x121]) != 0) { //COMM_SIODATA32_L+1, following data [to send]
|
||||
if ((rfu_qsend2 = rfu_qsend = g_ioMem[0x121]) != 0) { //COMM_SIODATA32_L+1, following data [to send]
|
||||
rfu_state = RFU_SEND;
|
||||
}
|
||||
if (ioMem[COMM_SIODATA32_L] == 0xee) { //0xee cmd shouldn't override previous cmd
|
||||
if (g_ioMem[COMM_SIODATA32_L] == 0xee) { //0xee cmd shouldn't override previous cmd
|
||||
rfu_lastcmd = rfu_cmd2;
|
||||
rfu_cmd2 = ioMem[COMM_SIODATA32_L];
|
||||
rfu_cmd2 = g_ioMem[COMM_SIODATA32_L];
|
||||
//rfu_polarity = 0; //when polarity back to normal the game can initiate a new cmd even when 0xee hasn't been finalized, but it looks improper isn't?
|
||||
} else {
|
||||
rfu_lastcmd = rfu_cmd;
|
||||
rfu_cmd = ioMem[COMM_SIODATA32_L];
|
||||
rfu_cmd = g_ioMem[COMM_SIODATA32_L];
|
||||
rfu_cmd2 = 0;
|
||||
if (rfu_cmd == 0x27 || rfu_cmd == 0x37) {
|
||||
rfu_lastcmd2 = rfu_cmd;
|
||||
|
@ -3129,14 +3126,14 @@ static void StartRFU(uint16_t value)
|
|||
rfu_waiting = true;
|
||||
} else if (rfu_cmd == 0xa8 || rfu_cmd == 0xb6) {
|
||||
//wait for [important] data when previously sent is important data, might only need to wait for the 1st 0x25 cmd
|
||||
bool ok = false;
|
||||
// bool ok = false;
|
||||
} else if (rfu_cmd == 0x11 || rfu_cmd == 0x1a || rfu_cmd == 0x26) {
|
||||
if (rfu_lastcmd2 == 0x24)
|
||||
rfu_waiting = true;
|
||||
}
|
||||
}
|
||||
if (rfu_waiting)
|
||||
rfu_buf = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_buf = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
else
|
||||
rfu_buf = 0x80000000;
|
||||
} else if (siodata_h == 0x8000) //finalize cmd, the game will send this when polarity reversed (expecting something)
|
||||
|
@ -3766,39 +3763,39 @@ static void StartRFU(uint16_t value)
|
|||
if (!rfu_waiting)
|
||||
rfu_buf = 0x99660000 | (rfu_qrecv_broadcast_data_len << 8) | rfu_cmd;
|
||||
else
|
||||
rfu_buf = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_buf = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
}
|
||||
} else { //unknown COMM word //in MarioGolfAdv (when a player/client exiting lobby), There is a possibility COMM = 0x7FFE8001, PrevVAL = 0x5087, PrevCOM = 0, is this part of initialization?
|
||||
log("%08X : UnkCOM %08X %04X %08X %08X\n", GetTickCount(), READ32LE(&ioMem[COMM_SIODATA32_L]), PrevVAL, PrevCOM, PrevDAT);
|
||||
log("%08X : UnkCOM %08X %04X %08X %08X\n", GetTickCount(), READ32LE(&g_ioMem[COMM_SIODATA32_L]), PrevVAL, PrevCOM, PrevDAT);
|
||||
/*rfu_cmd ^= 0x80;
|
||||
UPDATE_REG(COMM_SIODATA32_L, 0);
|
||||
UPDATE_REG(COMM_SIODATA32_H, 0x8000);*/
|
||||
rfu_state = RFU_INIT; //to prevent the next reinit words from getting in finalization processing (here), may cause MarioGolfAdv to show Linking error when this occurs instead of continuing with COMM cmd
|
||||
//UPDATE_REG(COMM_SIODATA32_H, READ16LE(&ioMem[COMM_SIODATA32_L])); //replying with reversed words may cause MarioGolfAdv to reinit RFU when COMM = 0x7FFE8001
|
||||
//UPDATE_REG(COMM_SIODATA32_H, READ16LE(&g_ioMem[COMM_SIODATA32_L])); //replying with reversed words may cause MarioGolfAdv to reinit RFU when COMM = 0x7FFE8001
|
||||
//UPDATE_REG(COMM_SIODATA32_L, a);
|
||||
rfu_buf = (READ16LE(&ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
rfu_buf = (READ16LE(&g_ioMem[COMM_SIODATA32_L]) << 16) | siodata_h;
|
||||
}
|
||||
break;
|
||||
|
||||
case RFU_SEND: //data following after initialize cmd
|
||||
//if(rfu_qsend==0) {rfu_state = RFU_COMM; break;}
|
||||
CurDAT = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
CurDAT = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
if (--rfu_qsend == 0) {
|
||||
rfu_state = RFU_COMM;
|
||||
}
|
||||
|
||||
switch (rfu_cmd) {
|
||||
case 0x16:
|
||||
linkmem->rfu_broadcastdata[vbaid][1 + rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
linkmem->rfu_broadcastdata[vbaid][1 + rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
case 0x17:
|
||||
//linkid = 1;
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
case 0x1f:
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
case 0x24:
|
||||
|
@ -3806,12 +3803,12 @@ static void StartRFU(uint16_t value)
|
|||
case 0x25:
|
||||
case 0x35:
|
||||
//if(rfu_cansend)
|
||||
//linkmem->rfu_data[vbaid][rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
//linkmem->rfu_data[vbaid][rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
|
||||
default:
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&ioMem[COMM_SIODATA32_L]);
|
||||
rfu_masterdata[rfu_counter++] = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
break;
|
||||
}
|
||||
rfu_buf = 0x80000000;
|
||||
|
@ -3900,7 +3897,6 @@ static void StartRFU(uint16_t value)
|
|||
UPDATE_REG(COMM_SIOCNT, value);
|
||||
return;
|
||||
}
|
||||
UPDATE_REG(COMM_SIOCNT, value);
|
||||
}
|
||||
|
||||
bool LinkRFUUpdate()
|
||||
|
@ -3911,10 +3907,8 @@ bool LinkRFUUpdate()
|
|||
if (transfer_direction && rfu_transfer_end <= 0) {
|
||||
if (rfu_waiting) {
|
||||
bool ok = false;
|
||||
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;
|
||||
// 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) {
|
||||
//c_s.Lock();
|
||||
|
@ -3957,7 +3951,7 @@ bool LinkRFUUpdate()
|
|||
else if (rfu_cmd == 0xb5 || rfu_cmd == 0xb7)
|
||||
rfu_cmd = 0x36;
|
||||
|
||||
if (READ32LE(&ioMem[COMM_SIODATA32_L]) == 0x80000000)
|
||||
if (READ32LE(&g_ioMem[COMM_SIODATA32_L]) == 0x80000000)
|
||||
rfu_buf = 0x99660000 | (rfu_qrecv_broadcast_data_len << 8) | rfu_cmd;
|
||||
else
|
||||
rfu_buf = 0x80000000;
|
||||
|
@ -3980,7 +3974,7 @@ static void UpdateRFUIPC(int ticks)
|
|||
if (LinkRFUUpdate()) {
|
||||
if (transfer_direction && rfu_transfer_end <= 0) {
|
||||
transfer_direction = 0;
|
||||
uint16_t value = READ16LE(&ioMem[COMM_SIOCNT]);
|
||||
uint16_t value = READ16LE(&g_ioMem[COMM_SIOCNT]);
|
||||
if (value & 0x4000) {
|
||||
IF |= 0x80;
|
||||
UPDATE_REG(0x202, IF);
|
||||
|
@ -3990,9 +3984,9 @@ static void UpdateRFUIPC(int ticks)
|
|||
value &= 0xfffb;
|
||||
value |= (value & 1) << 2; //this will automatically set the correct polarity, even w/o rfu_polarity since the game will be the one who change the polarity instead of the adapter
|
||||
|
||||
//UPDATE_REG(COMM_SIOCNT, READ16LE(&ioMem[COMM_SIOCNT]) & 0xff7f);
|
||||
//UPDATE_REG(COMM_SIOCNT, READ16LE(&g_ioMem[COMM_SIOCNT]) & 0xff7f);
|
||||
UPDATE_REG(COMM_SIOCNT, (value & 0xff7f) | 0x0008); //Start bit.7 reset, SO bit.3 set automatically upon transfer completion?
|
||||
//log("SIOn32 : %04X %04X %08X (VCOUNT = %d) %d %d\n", READ16LE(&ioMem[COMM_RCNT]), READ16LE(&ioMem[COMM_SIOCNT]), READ32LE(&ioMem[COMM_SIODATA32_L]), VCOUNT);
|
||||
//log("SIOn32 : %04X %04X %08X (VCOUNT = %d) %d %d\n", READ16LE(&g_ioMem[COMM_RCNT]), READ16LE(&g_ioMem[COMM_SIOCNT]), READ32LE(&g_ioMem[COMM_SIODATA32_L]), VCOUNT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -4011,7 +4005,6 @@ uint8_t gbStartLinkIPC(uint8_t b) //used on internal clock
|
|||
{
|
||||
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?
|
||||
gba_link_enabled = true; //(gbMemory[0xff02]!=0); //not needed?
|
||||
rfu_enabled = false;
|
||||
|
@ -4055,7 +4048,6 @@ uint16_t gbLinkUpdateIPC(uint8_t b, int gbSerialOn) //used on external clock
|
|||
{
|
||||
uint8_t dat = b; //0xff; //slave (w/ external clocks) won't be getting 0xff if master turned off
|
||||
BOOL recvd = false;
|
||||
int idx = 0;
|
||||
|
||||
gba_link_enabled = true; //(gbMemory[0xff02]!=0);
|
||||
rfu_enabled = false;
|
||||
|
@ -4113,7 +4105,7 @@ static void CloseIPC()
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (linksync[i] != NULL) {
|
||||
#if (defined __WIN32__ || defined _WIN32)
|
||||
ReleaseSemaphore(linksync[i], 1, NULL);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#ifndef GBA_GBALINK_H
|
||||
#define GBA_GBALINK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
extern uint32_t IP_LINK_PORT;
|
||||
extern uint16_t IP_LINK_PORT;
|
||||
|
||||
extern std::string IP_LINK_BIND_ADDRESS;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ extern int thumbExecute();
|
|||
|
||||
#define UPDATE_REG(address, value) \
|
||||
{ \
|
||||
WRITE16LE(((uint16_t*)&ioMem[address]), value); \
|
||||
WRITE16LE(((uint16_t*)&g_ioMem[address]), value); \
|
||||
}
|
||||
|
||||
#define ARM_PREFETCH \
|
||||
|
|
|
@ -100,29 +100,29 @@ static inline uint32_t CPUReadMemory(uint32_t address)
|
|||
} else
|
||||
goto unreadable;
|
||||
} else
|
||||
value = READ32LE(((uint32_t*)&bios[address & 0x3FFC]));
|
||||
value = READ32LE(((uint32_t*)&g_bios[address & 0x3FFC]));
|
||||
break;
|
||||
case 2:
|
||||
value = READ32LE(((uint32_t*)&workRAM[address & 0x3FFFC]));
|
||||
value = READ32LE(((uint32_t*)&g_workRAM[address & 0x3FFFC]));
|
||||
break;
|
||||
case 3:
|
||||
value = READ32LE(((uint32_t*)&internalRAM[address & 0x7ffC]));
|
||||
value = READ32LE(((uint32_t*)&g_internalRAM[address & 0x7ffC]));
|
||||
break;
|
||||
case 4:
|
||||
if ((address < 0x4000400) && ioReadable[address & 0x3fc]) {
|
||||
if (ioReadable[(address & 0x3fc) + 2]) {
|
||||
value = READ32LE(((uint32_t*)&ioMem[address & 0x3fC]));
|
||||
value = READ32LE(((uint32_t*)&g_ioMem[address & 0x3fC]));
|
||||
if ((address & 0x3fc) == COMM_JOY_RECV_L)
|
||||
UPDATE_REG(COMM_JOYSTAT,
|
||||
READ16LE(&ioMem[COMM_JOYSTAT]) & ~JOYSTAT_RECV);
|
||||
READ16LE(&g_ioMem[COMM_JOYSTAT]) & ~JOYSTAT_RECV);
|
||||
} else {
|
||||
value = READ16LE(((uint16_t*)&ioMem[address & 0x3fc]));
|
||||
value = READ16LE(((uint16_t*)&g_ioMem[address & 0x3fc]));
|
||||
}
|
||||
} else
|
||||
goto unreadable;
|
||||
break;
|
||||
case 5:
|
||||
value = READ32LE(((uint32_t*)&paletteRAM[address & 0x3fC]));
|
||||
value = READ32LE(((uint32_t*)&g_paletteRAM[address & 0x3fC]));
|
||||
break;
|
||||
case 6: {
|
||||
unsigned addr = (address & 0x1fffc);
|
||||
|
@ -132,18 +132,18 @@ static inline uint32_t CPUReadMemory(uint32_t address)
|
|||
}
|
||||
if ((addr & 0x18000) == 0x18000)
|
||||
addr &= 0x17fff;
|
||||
value = READ32LE(((uint32_t*)&vram[addr]));
|
||||
value = READ32LE(((uint32_t*)&g_vram[addr]));
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
value = READ32LE(((uint32_t*)&oam[address & 0x3FC]));
|
||||
value = READ32LE(((uint32_t*)&g_oam[address & 0x3FC]));
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
value = READ32LE(((uint32_t*)&rom[address & 0x1FFFFFC]));
|
||||
value = READ32LE(((uint32_t*)&g_rom[address & 0x1FFFFFC]));
|
||||
break;
|
||||
case 13:
|
||||
if (cpuEEPROMEnabled)
|
||||
|
@ -166,7 +166,7 @@ static inline uint32_t CPUReadMemory(uint32_t address)
|
|||
armMode ? armNextPC - 4 : armNextPC - 2);
|
||||
}
|
||||
#endif
|
||||
if (cpuDmaRunning || ((reg[15].I - cpuDmaPC) == (armState ? 4 : 2))) {
|
||||
if (cpuDmaRunning || ((reg[15].I - cpuDmaPC) == (armState ? 4u : 2u))) {
|
||||
value = cpuDmaLast;
|
||||
} else {
|
||||
if (armState) {
|
||||
|
@ -241,17 +241,17 @@ static inline uint32_t CPUReadHalfWord(uint32_t address)
|
|||
} else
|
||||
goto unreadable;
|
||||
} else
|
||||
value = READ16LE(((uint16_t*)&bios[address & 0x3FFE]));
|
||||
value = READ16LE(((uint16_t*)&g_bios[address & 0x3FFE]));
|
||||
break;
|
||||
case 2:
|
||||
value = READ16LE(((uint16_t*)&workRAM[address & 0x3FFFE]));
|
||||
value = READ16LE(((uint16_t*)&g_workRAM[address & 0x3FFFE]));
|
||||
break;
|
||||
case 3:
|
||||
value = READ16LE(((uint16_t*)&internalRAM[address & 0x7ffe]));
|
||||
value = READ16LE(((uint16_t*)&g_internalRAM[address & 0x7ffe]));
|
||||
break;
|
||||
case 4:
|
||||
if ((address < 0x4000400) && ioReadable[address & 0x3fe]) {
|
||||
value = READ16LE(((uint16_t*)&ioMem[address & 0x3fe]));
|
||||
value = READ16LE(((uint16_t*)&g_ioMem[address & 0x3fe]));
|
||||
if (((address & 0x3fe) > 0xFF) && ((address & 0x3fe) < 0x10E)) {
|
||||
if (((address & 0x3fe) == 0x100) && timer0On)
|
||||
value = 0xFFFF - ((timer0Ticks - cpuTotalTicks) >> timer0ClockReload);
|
||||
|
@ -268,7 +268,7 @@ static inline uint32_t CPUReadHalfWord(uint32_t address)
|
|||
goto unreadable;
|
||||
break;
|
||||
case 5:
|
||||
value = READ16LE(((uint16_t*)&paletteRAM[address & 0x3fe]));
|
||||
value = READ16LE(((uint16_t*)&g_paletteRAM[address & 0x3fe]));
|
||||
break;
|
||||
case 6: {
|
||||
unsigned addr = (address & 0x1fffe);
|
||||
|
@ -278,11 +278,11 @@ static inline uint32_t CPUReadHalfWord(uint32_t address)
|
|||
}
|
||||
if ((addr & 0x18000) == 0x18000)
|
||||
addr &= 0x17fff;
|
||||
value = READ16LE(((uint16_t*)&vram[addr]));
|
||||
value = READ16LE(((uint16_t*)&g_vram[addr]));
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
value = READ16LE(((uint16_t*)&oam[address & 0x3fe]));
|
||||
value = READ16LE(((uint16_t*)&g_oam[address & 0x3fe]));
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
|
@ -292,7 +292,7 @@ static inline uint32_t CPUReadHalfWord(uint32_t address)
|
|||
if (address == 0x80000c4 || address == 0x80000c6 || address == 0x80000c8)
|
||||
value = rtcRead(address);
|
||||
else
|
||||
value = READ16LE(((uint16_t*)&rom[address & 0x1FFFFFE]));
|
||||
value = READ16LE(((uint16_t*)&g_rom[address & 0x1FFFFFE]));
|
||||
break;
|
||||
case 13:
|
||||
if (cpuEEPROMEnabled)
|
||||
|
@ -309,7 +309,7 @@ static inline uint32_t CPUReadHalfWord(uint32_t address)
|
|||
/* fallthrough */
|
||||
default:
|
||||
unreadable:
|
||||
if (cpuDmaRunning|| ((reg[15].I - cpuDmaPC) == (armState ? 4 : 2))) {
|
||||
if (cpuDmaRunning|| ((reg[15].I - cpuDmaPC) == (armState ? 4u : 2u))) {
|
||||
value = cpuDmaLast & 0xFFFF;
|
||||
} else {
|
||||
int param = reg[15].I;
|
||||
|
@ -386,33 +386,33 @@ static inline uint8_t CPUReadByte(uint32_t address)
|
|||
} else
|
||||
goto unreadable;
|
||||
}
|
||||
return bios[address & 0x3FFF];
|
||||
return g_bios[address & 0x3FFF];
|
||||
case 2:
|
||||
return workRAM[address & 0x3FFFF];
|
||||
return g_workRAM[address & 0x3FFFF];
|
||||
case 3:
|
||||
return internalRAM[address & 0x7fff];
|
||||
return g_internalRAM[address & 0x7fff];
|
||||
case 4:
|
||||
if ((address < 0x4000400) && ioReadable[address & 0x3ff])
|
||||
return ioMem[address & 0x3ff];
|
||||
return g_ioMem[address & 0x3ff];
|
||||
else
|
||||
goto unreadable;
|
||||
case 5:
|
||||
return paletteRAM[address & 0x3ff];
|
||||
return g_paletteRAM[address & 0x3ff];
|
||||
case 6:
|
||||
address = (address & 0x1ffff);
|
||||
if (((DISPCNT & 7) > 2) && ((address & 0x1C000) == 0x18000))
|
||||
return 0;
|
||||
if ((address & 0x18000) == 0x18000)
|
||||
address &= 0x17fff;
|
||||
return vram[address];
|
||||
return g_vram[address];
|
||||
case 7:
|
||||
return oam[address & 0x3ff];
|
||||
return g_oam[address & 0x3ff];
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
return rom[address & 0x1FFFFFF];
|
||||
return g_rom[address & 0x1FFFFFF];
|
||||
case 13:
|
||||
if (cpuEEPROMEnabled)
|
||||
return DowncastU8(eepromRead(address));
|
||||
|
@ -442,7 +442,7 @@ static inline uint8_t CPUReadByte(uint32_t address)
|
|||
armMode ? armNextPC - 4 : armNextPC - 2);
|
||||
}
|
||||
#endif
|
||||
if (cpuDmaRunning || ((reg[15].I - cpuDmaPC) == (armState ? 4 : 2))) {
|
||||
if (cpuDmaRunning || ((reg[15].I - cpuDmaPC) == (armState ? 4u : 2u))) {
|
||||
return cpuDmaLast & 0xFF;
|
||||
} else {
|
||||
if (armState) {
|
||||
|
@ -483,7 +483,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
|
|||
cheatsWriteMemory(address & 0x203FFFC, value);
|
||||
else
|
||||
#endif
|
||||
WRITE32LE(((uint32_t*)&workRAM[address & 0x3FFFC]), value);
|
||||
WRITE32LE(((uint32_t*)&g_workRAM[address & 0x3FFFC]), value);
|
||||
break;
|
||||
case 0x03:
|
||||
#ifdef BKPT_SUPPORT
|
||||
|
@ -491,7 +491,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
|
|||
cheatsWriteMemory(address & 0x3007FFC, value);
|
||||
else
|
||||
#endif
|
||||
WRITE32LE(((uint32_t*)&internalRAM[address & 0x7ffC]), value);
|
||||
WRITE32LE(((uint32_t*)&g_internalRAM[address & 0x7ffC]), value);
|
||||
break;
|
||||
case 0x04:
|
||||
if (address < 0x4000400) {
|
||||
|
@ -506,7 +506,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
|
|||
cheatsWriteMemory(address & 0x70003FC, value);
|
||||
else
|
||||
#endif
|
||||
WRITE32LE(((uint32_t*)&paletteRAM[address & 0x3FC]), value);
|
||||
WRITE32LE(((uint32_t*)&g_paletteRAM[address & 0x3FC]), value);
|
||||
break;
|
||||
case 0x06:
|
||||
address = (address & 0x1fffc);
|
||||
|
@ -521,7 +521,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
|
|||
else
|
||||
#endif
|
||||
|
||||
WRITE32LE(((uint32_t*)&vram[address]), value);
|
||||
WRITE32LE(((uint32_t*)&g_vram[address]), value);
|
||||
break;
|
||||
case 0x07:
|
||||
#ifdef BKPT_SUPPORT
|
||||
|
@ -529,7 +529,7 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
|
|||
cheatsWriteMemory(address & 0x70003FC, value);
|
||||
else
|
||||
#endif
|
||||
WRITE32LE(((uint32_t*)&oam[address & 0x3fc]), value);
|
||||
WRITE32LE(((uint32_t*)&g_oam[address & 0x3fc]), value);
|
||||
break;
|
||||
case 0x0D:
|
||||
if (cpuEEPROMEnabled) {
|
||||
|
@ -587,7 +587,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
|
|||
cheatsWriteHalfWord(address & 0x203FFFE, value);
|
||||
else
|
||||
#endif
|
||||
WRITE16LE(((uint16_t*)&workRAM[address & 0x3FFFE]), value);
|
||||
WRITE16LE(((uint16_t*)&g_workRAM[address & 0x3FFFE]), value);
|
||||
break;
|
||||
case 3:
|
||||
#ifdef BKPT_SUPPORT
|
||||
|
@ -595,7 +595,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
|
|||
cheatsWriteHalfWord(address & 0x3007ffe, value);
|
||||
else
|
||||
#endif
|
||||
WRITE16LE(((uint16_t*)&internalRAM[address & 0x7ffe]), value);
|
||||
WRITE16LE(((uint16_t*)&g_internalRAM[address & 0x7ffe]), value);
|
||||
break;
|
||||
case 4:
|
||||
if (address < 0x4000400)
|
||||
|
@ -609,7 +609,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
|
|||
cheatsWriteHalfWord(address & 0x70003fe, value);
|
||||
else
|
||||
#endif
|
||||
WRITE16LE(((uint16_t*)&paletteRAM[address & 0x3fe]), value);
|
||||
WRITE16LE(((uint16_t*)&g_paletteRAM[address & 0x3fe]), value);
|
||||
break;
|
||||
case 6:
|
||||
address = (address & 0x1fffe);
|
||||
|
@ -622,7 +622,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
|
|||
cheatsWriteHalfWord(address + 0x06000000, value);
|
||||
else
|
||||
#endif
|
||||
WRITE16LE(((uint16_t*)&vram[address]), value);
|
||||
WRITE16LE(((uint16_t*)&g_vram[address]), value);
|
||||
break;
|
||||
case 7:
|
||||
#ifdef BKPT_SUPPORT
|
||||
|
@ -630,7 +630,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
|
|||
cheatsWriteHalfWord(address & 0x70003fe, value);
|
||||
else
|
||||
#endif
|
||||
WRITE16LE(((uint16_t*)&oam[address & 0x3fe]), value);
|
||||
WRITE16LE(((uint16_t*)&g_oam[address & 0x3fe]), value);
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
|
@ -685,7 +685,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
|||
cheatsWriteByte(address & 0x203FFFF, b);
|
||||
else
|
||||
#endif
|
||||
workRAM[address & 0x3FFFF] = b;
|
||||
g_workRAM[address & 0x3FFFF] = b;
|
||||
break;
|
||||
case 3:
|
||||
#ifdef BKPT_SUPPORT
|
||||
|
@ -693,7 +693,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
|||
cheatsWriteByte(address & 0x3007fff, b);
|
||||
else
|
||||
#endif
|
||||
internalRAM[address & 0x7fff] = b;
|
||||
g_internalRAM[address & 0x7fff] = b;
|
||||
break;
|
||||
case 4:
|
||||
if (address < 0x4000400) {
|
||||
|
@ -751,10 +751,10 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
|||
uint32_t lowerBits = address & 0x3fe;
|
||||
if (address & 1) {
|
||||
CPUUpdateRegister(lowerBits,
|
||||
(READ16LE(&ioMem[lowerBits]) & 0x00FF) | (b << 8));
|
||||
(READ16LE(&g_ioMem[lowerBits]) & 0x00FF) | (b << 8));
|
||||
} else {
|
||||
CPUUpdateRegister(lowerBits,
|
||||
(READ16LE(&ioMem[lowerBits]) & 0xFF00) | b);
|
||||
(READ16LE(&g_ioMem[lowerBits]) & 0xFF00) | b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -763,7 +763,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
|||
break;
|
||||
case 5:
|
||||
// no need to switch
|
||||
*((uint16_t*)&paletteRAM[address & 0x3FE]) = (b << 8) | b;
|
||||
*((uint16_t*)&g_paletteRAM[address & 0x3FE]) = (b << 8) | b;
|
||||
break;
|
||||
case 6:
|
||||
address = (address & 0x1fffe);
|
||||
|
@ -780,13 +780,13 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
|||
cheatsWriteByte(address + 0x06000000, b);
|
||||
else
|
||||
#endif
|
||||
*((uint16_t*)&vram[address]) = (b << 8) | b;
|
||||
*((uint16_t*)&g_vram[address]) = (b << 8) | b;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
// no need to switch
|
||||
// byte writes to OAM are ignored
|
||||
// *((uint16_t *)&oam[address & 0x3FE]) = (b << 8) | b;
|
||||
// *((uint16_t *)&g_oam[address & 0x3FE]) = (b << 8) | b;
|
||||
break;
|
||||
case 13:
|
||||
if (cpuEEPROMEnabled) {
|
||||
|
|
|
@ -23,15 +23,15 @@ uint32_t stop = 0x08000568;
|
|||
// 0x0000 to 0x7FFF: set custom 15 bit color
|
||||
int customBackdropColor = -1;
|
||||
|
||||
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;
|
||||
uint8_t* g_bios = 0;
|
||||
uint8_t* g_rom = 0;
|
||||
uint8_t* g_internalRAM = 0;
|
||||
uint8_t* g_workRAM = 0;
|
||||
uint8_t* g_paletteRAM = 0;
|
||||
uint8_t* g_vram = 0;
|
||||
uint8_t* g_pix = 0;
|
||||
uint8_t* g_oam = 0;
|
||||
uint8_t* g_ioMem = 0;
|
||||
|
||||
uint16_t DISPCNT = 0x0080;
|
||||
uint16_t DISPSTAT = 0x0000;
|
||||
|
|
|
@ -30,15 +30,15 @@ extern bool gba_joybus_enabled;
|
|||
extern bool gba_joybus_active;
|
||||
extern int customBackdropColor;
|
||||
|
||||
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 uint8_t* g_bios;
|
||||
extern uint8_t* g_rom;
|
||||
extern uint8_t* g_internalRAM;
|
||||
extern uint8_t* g_workRAM;
|
||||
extern uint8_t* g_paletteRAM;
|
||||
extern uint8_t* g_vram;
|
||||
extern uint8_t* g_pix;
|
||||
extern uint8_t* g_oam;
|
||||
extern uint8_t* g_ioMem;
|
||||
|
||||
extern uint16_t DISPCNT;
|
||||
extern uint16_t DISPSTAT;
|
||||
|
|
|
@ -4,32 +4,32 @@
|
|||
|
||||
void mode0RenderLine()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0100) {
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, g_line0);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0200) {
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, g_line1);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, g_line2);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0800) {
|
||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, g_line3);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -42,28 +42,28 @@ void mode0RenderLine()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line0[x] < color) {
|
||||
color = line0[x];
|
||||
if (g_line0[x] < color) {
|
||||
color = g_line0[x];
|
||||
top = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line1[x];
|
||||
top = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line3[x];
|
||||
top = 0x08;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -72,76 +72,76 @@ void mode0RenderLine()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line0[x];
|
||||
if ((uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void mode0RenderLineNoWindow()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0100) {
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, g_line0);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0200) {
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, g_line1);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, g_line2);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0800) {
|
||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, g_line3);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -156,28 +156,28 @@ void mode0RenderLineNoWindow()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line0[x] < color) {
|
||||
color = line0[x];
|
||||
if (g_line0[x] < color) {
|
||||
color = g_line0[x];
|
||||
top = 0x01;
|
||||
}
|
||||
|
||||
if (line1[x] < (color & 0xFF000000)) {
|
||||
color = line1[x];
|
||||
if (g_line1[x] < (color & 0xFF000000)) {
|
||||
color = g_line1[x];
|
||||
top = 0x02;
|
||||
}
|
||||
|
||||
if (line2[x] < (color & 0xFF000000)) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < (color & 0xFF000000)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if (line3[x] < (color & 0xFF000000)) {
|
||||
color = line3[x];
|
||||
if (g_line3[x] < (color & 0xFF000000)) {
|
||||
color = g_line3[x];
|
||||
top = 0x08;
|
||||
}
|
||||
|
||||
if (lineOBJ[x] < (color & 0xFF000000)) {
|
||||
color = lineOBJ[x];
|
||||
if (g_lineOBJ[x] < (color & 0xFF000000)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -189,54 +189,54 @@ void mode0RenderLineNoWindow()
|
|||
if (top & BLDMOD) {
|
||||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
if (line0[x] < back) {
|
||||
if (g_line0[x] < back) {
|
||||
if (top != 0x01) {
|
||||
back = line0[x];
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
if (line1[x] < (back & 0xFF000000)) {
|
||||
if (g_line1[x] < (back & 0xFF000000)) {
|
||||
if (top != 0x02) {
|
||||
back = line1[x];
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
if (line2[x] < (back & 0xFF000000)) {
|
||||
if (g_line2[x] < (back & 0xFF000000)) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if (line3[x] < (back & 0xFF000000)) {
|
||||
if (g_line3[x] < (back & 0xFF000000)) {
|
||||
if (top != 0x08) {
|
||||
back = line3[x];
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineOBJ[x] < (back & 0xFF000000)) {
|
||||
if (g_lineOBJ[x] < (back & 0xFF000000)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -244,55 +244,55 @@ void mode0RenderLineNoWindow()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line0[x] < back) {
|
||||
back = line0[x];
|
||||
if (g_line0[x] < back) {
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
|
||||
if (line1[x] < (back & 0xFF000000)) {
|
||||
back = line1[x];
|
||||
if (g_line1[x] < (back & 0xFF000000)) {
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
|
||||
if (line2[x] < (back & 0xFF000000)) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < (back & 0xFF000000)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (line3[x] < (back & 0xFF000000)) {
|
||||
back = line3[x];
|
||||
if (g_line3[x] < (back & 0xFF000000)) {
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void mode0RenderLineAll()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -320,23 +320,23 @@ void mode0RenderLineAll()
|
|||
}
|
||||
|
||||
if ((coreOptions.layerEnable & 0x0100)) {
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, g_line0);
|
||||
}
|
||||
|
||||
if ((coreOptions.layerEnable & 0x0200)) {
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, g_line1);
|
||||
}
|
||||
|
||||
if ((coreOptions.layerEnable & 0x0400)) {
|
||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, g_line2);
|
||||
}
|
||||
|
||||
if ((coreOptions.layerEnable & 0x0800)) {
|
||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, g_line3);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawOBJWin(lineOBJWin);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
gfxDrawOBJWin(g_lineOBJWin);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -354,7 +354,7 @@ void mode0RenderLineAll()
|
|||
uint8_t top = 0x20;
|
||||
uint8_t mask = outMask;
|
||||
|
||||
if (!(lineOBJWin[x] & 0x80000000)) {
|
||||
if (!(g_lineOBJWin[x] & 0x80000000)) {
|
||||
mask = WINOUT >> 8;
|
||||
}
|
||||
|
||||
|
@ -369,28 +369,28 @@ void mode0RenderLineAll()
|
|||
}
|
||||
}
|
||||
|
||||
if ((mask & 1) && (line0[x] < color)) {
|
||||
color = line0[x];
|
||||
if ((mask & 1) && (g_line0[x] < color)) {
|
||||
color = g_line0[x];
|
||||
top = 0x01;
|
||||
}
|
||||
|
||||
if ((mask & 2) && ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = line1[x];
|
||||
if ((mask & 2) && ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_line1[x];
|
||||
top = 0x02;
|
||||
}
|
||||
|
||||
if ((mask & 4) && ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = line2[x];
|
||||
if ((mask & 4) && ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((mask & 8) && ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = line3[x];
|
||||
if ((mask & 8) && ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_line3[x];
|
||||
top = 0x08;
|
||||
}
|
||||
|
||||
if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = lineOBJ[x];
|
||||
if ((mask & 16) && ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -399,39 +399,39 @@ void mode0RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 1) && ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = line0[x];
|
||||
if ((mask & 1) && ((uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
|
||||
if ((mask & 2) && ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = line1[x];
|
||||
if ((mask & 2) && ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
|
||||
if ((mask & 4) && ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = line2[x];
|
||||
if ((mask & 4) && ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if ((mask & 8) && ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = line3[x];
|
||||
if ((mask & 8) && ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24))) {
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -444,58 +444,58 @@ void mode0RenderLineAll()
|
|||
if (top & BLDMOD) {
|
||||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
if ((mask & 1) && (uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 1) && (uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x01) {
|
||||
back = line0[x];
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 2) && (uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 2) && (uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x02) {
|
||||
back = line1[x];
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 4) && (uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 4) && (uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 8) && (uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 8) && (uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x08) {
|
||||
back = line3[x];
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 16) && (uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
|
||||
void mode1RenderLine()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0100) {
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, g_line0);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0200) {
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, g_line1);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
|
@ -28,10 +28,10 @@ void mode1RenderLine()
|
|||
changed = 3;
|
||||
gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed, line2);
|
||||
gfxBG2X, gfxBG2Y, changed, g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -44,23 +44,23 @@ void mode1RenderLine()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line0[x] < color) {
|
||||
color = line0[x];
|
||||
if (g_line0[x] < color) {
|
||||
color = g_line0[x];
|
||||
top = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line1[x];
|
||||
top = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -69,40 +69,40 @@ void mode1RenderLine()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line0[x];
|
||||
if ((uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -110,22 +110,22 @@ void mode1RenderLine()
|
|||
|
||||
void mode1RenderLineNoWindow()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0100) {
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, g_line0);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0200) {
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, g_line1);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
|
@ -134,10 +134,10 @@ void mode1RenderLineNoWindow()
|
|||
changed = 3;
|
||||
gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed, line2);
|
||||
gfxBG2X, gfxBG2Y, changed, g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -150,23 +150,23 @@ void mode1RenderLineNoWindow()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line0[x] < color) {
|
||||
color = line0[x];
|
||||
if (g_line0[x] < color) {
|
||||
color = g_line0[x];
|
||||
top = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line1[x];
|
||||
top = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -178,47 +178,47 @@ void mode1RenderLineNoWindow()
|
|||
if (top & BLDMOD) {
|
||||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x01) {
|
||||
back = line0[x];
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x02) {
|
||||
back = line1[x];
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -226,40 +226,40 @@ void mode1RenderLineNoWindow()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line0[x];
|
||||
if ((uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -267,11 +267,11 @@ void mode1RenderLineNoWindow()
|
|||
|
||||
void mode1RenderLineAll()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -300,11 +300,11 @@ void mode1RenderLineAll()
|
|||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0100) {
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, g_line0);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0200) {
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, g_line1);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
|
@ -313,11 +313,11 @@ void mode1RenderLineAll()
|
|||
changed = 3;
|
||||
gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed, line2);
|
||||
gfxBG2X, gfxBG2Y, changed, g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawOBJWin(lineOBJWin);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
gfxDrawOBJWin(g_lineOBJWin);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -335,7 +335,7 @@ void mode1RenderLineAll()
|
|||
uint8_t top = 0x20;
|
||||
uint8_t mask = outMask;
|
||||
|
||||
if (!(lineOBJWin[x] & 0x80000000)) {
|
||||
if (!(g_lineOBJWin[x] & 0x80000000)) {
|
||||
mask = WINOUT >> 8;
|
||||
}
|
||||
|
||||
|
@ -350,23 +350,23 @@ void mode1RenderLineAll()
|
|||
}
|
||||
}
|
||||
|
||||
if (line0[x] < color && (mask & 1)) {
|
||||
color = line0[x];
|
||||
if (g_line0[x] < color && (mask & 1)) {
|
||||
color = g_line0[x];
|
||||
top = 0x01;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line1[x] >> 24) < (uint8_t)(color >> 24) && (mask & 2)) {
|
||||
color = line1[x];
|
||||
if ((uint8_t)(g_line1[x] >> 24) < (uint8_t)(color >> 24) && (mask & 2)) {
|
||||
color = g_line1[x];
|
||||
top = 0x02;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24) && (mask & 4)) {
|
||||
color = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24) && (mask & 4)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24) && (mask & 16)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24) && (mask & 16)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -375,34 +375,34 @@ void mode1RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 1) && (uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line0[x];
|
||||
if ((mask & 1) && (uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
|
||||
if ((mask & 2) && (uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line1[x];
|
||||
if ((mask & 2) && (uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
|
||||
if ((mask & 4) && (uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line2[x];
|
||||
if ((mask & 4) && (uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -416,52 +416,52 @@ void mode1RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 1) && (uint8_t)(line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 1) && (uint8_t)(g_line0[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x01) {
|
||||
back = line0[x];
|
||||
back = g_line0[x];
|
||||
top2 = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 2) && (uint8_t)(line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 2) && (uint8_t)(g_line1[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x02) {
|
||||
back = line1[x];
|
||||
back = g_line1[x];
|
||||
top2 = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 4) && (uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 4) && (uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 16) && (uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
void mode2RenderLine()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@ void mode2RenderLine()
|
|||
|
||||
gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y,
|
||||
changed, line2);
|
||||
changed, g_line2);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0800) {
|
||||
|
@ -31,10 +31,10 @@ void mode2RenderLine()
|
|||
|
||||
gfxDrawRotScreen(BG3CNT, BG3X_L, BG3X_H, BG3Y_L, BG3Y_H,
|
||||
BG3PA, BG3PB, BG3PC, BG3PD, gfxBG3X, gfxBG3Y,
|
||||
changed, line3);
|
||||
changed, g_line3);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -47,18 +47,18 @@ void mode2RenderLine()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line3[x];
|
||||
top = 0x08;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -67,35 +67,35 @@ void mode2RenderLine()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxBG3Changed = 0;
|
||||
|
@ -104,11 +104,11 @@ void mode2RenderLine()
|
|||
|
||||
void mode2RenderLineNoWindow()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -121,7 +121,7 @@ void mode2RenderLineNoWindow()
|
|||
|
||||
gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y,
|
||||
changed, line2);
|
||||
changed, g_line2);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0800) {
|
||||
|
@ -131,10 +131,10 @@ void mode2RenderLineNoWindow()
|
|||
|
||||
gfxDrawRotScreen(BG3CNT, BG3X_L, BG3X_H, BG3Y_L, BG3Y_H,
|
||||
BG3PA, BG3PB, BG3PC, BG3PD, gfxBG3X, gfxBG3Y,
|
||||
changed, line3);
|
||||
changed, g_line3);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -147,18 +147,18 @@ void mode2RenderLineNoWindow()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_line3[x];
|
||||
top = 0x08;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -171,40 +171,40 @@ void mode2RenderLineNoWindow()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x08) {
|
||||
back = line3[x];
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -212,35 +212,35 @@ void mode2RenderLineNoWindow()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((uint8_t)(line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line2[x];
|
||||
if ((uint8_t)(g_line2[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxBG3Changed = 0;
|
||||
|
@ -249,11 +249,11 @@ void mode2RenderLineNoWindow()
|
|||
|
||||
void mode2RenderLineAll()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -288,7 +288,7 @@ void mode2RenderLineAll()
|
|||
|
||||
gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y,
|
||||
changed, line2);
|
||||
changed, g_line2);
|
||||
}
|
||||
|
||||
if (coreOptions.layerEnable & 0x0800) {
|
||||
|
@ -298,11 +298,11 @@ void mode2RenderLineAll()
|
|||
|
||||
gfxDrawRotScreen(BG3CNT, BG3X_L, BG3X_H, BG3Y_L, BG3Y_H,
|
||||
BG3PA, BG3PB, BG3PC, BG3PD, gfxBG3X, gfxBG3Y,
|
||||
changed, line3);
|
||||
changed, g_line3);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawOBJWin(lineOBJWin);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
gfxDrawOBJWin(g_lineOBJWin);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -320,7 +320,7 @@ void mode2RenderLineAll()
|
|||
uint8_t top = 0x20;
|
||||
uint8_t mask = outMask;
|
||||
|
||||
if (!(lineOBJWin[x] & 0x80000000)) {
|
||||
if (!(g_lineOBJWin[x] & 0x80000000)) {
|
||||
mask = WINOUT >> 8;
|
||||
}
|
||||
|
||||
|
@ -335,18 +335,18 @@ void mode2RenderLineAll()
|
|||
}
|
||||
}
|
||||
|
||||
if (line2[x] < color && (mask & 4)) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color && (mask & 4)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(line3[x] >> 24) < (uint8_t)(color >> 24) && (mask & 8)) {
|
||||
color = line3[x];
|
||||
if ((uint8_t)(g_line3[x] >> 24) < (uint8_t)(color >> 24) && (mask & 8)) {
|
||||
color = g_line3[x];
|
||||
top = 0x08;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24) && (mask & 16)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24) && (mask & 16)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -355,29 +355,29 @@ void mode2RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
back = line2[x];
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if ((mask & 8) && (uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = line3[x];
|
||||
if ((mask & 8) && (uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -391,45 +391,45 @@ void mode2RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 8) && (uint8_t)(line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 8) && (uint8_t)(g_line3[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x08) {
|
||||
back = line3[x];
|
||||
back = g_line3[x];
|
||||
top2 = 0x08;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 16) && (uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxBG3Changed = 0;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
void mode3RenderLine()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -24,10 +24,10 @@ void mode3RenderLine()
|
|||
BG2Y_L, BG2Y_H, BG2PA, BG2PB,
|
||||
BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t background;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -40,13 +40,13 @@ void mode3RenderLine()
|
|||
uint32_t color = background;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line2[x] < color) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -55,30 +55,30 @@ void mode3RenderLine()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -86,11 +86,11 @@ void mode3RenderLine()
|
|||
|
||||
void mode3RenderLineNoWindow()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -106,10 +106,10 @@ void mode3RenderLineNoWindow()
|
|||
BG2Y_L, BG2Y_H, BG2PA, BG2PB,
|
||||
BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t background;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -122,13 +122,13 @@ void mode3RenderLineNoWindow()
|
|||
uint32_t color = background;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line2[x] < color) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -141,33 +141,33 @@ void mode3RenderLineNoWindow()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
if (g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -175,30 +175,30 @@ void mode3RenderLineNoWindow()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -206,11 +206,11 @@ void mode3RenderLineNoWindow()
|
|||
|
||||
void mode3RenderLineAll()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x80) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -248,11 +248,11 @@ void mode3RenderLineAll()
|
|||
BG2Y_L, BG2Y_H, BG2PA, BG2PB,
|
||||
BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawOBJWin(lineOBJWin);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
gfxDrawOBJWin(g_lineOBJWin);
|
||||
|
||||
uint8_t inWin0Mask = WININ & 0xFF;
|
||||
uint8_t inWin1Mask = WININ >> 8;
|
||||
|
@ -270,7 +270,7 @@ void mode3RenderLineAll()
|
|||
uint8_t top = 0x20;
|
||||
uint8_t mask = outMask;
|
||||
|
||||
if (!(lineOBJWin[x] & 0x80000000)) {
|
||||
if (!(g_lineOBJWin[x] & 0x80000000)) {
|
||||
mask = WINOUT >> 8;
|
||||
}
|
||||
|
||||
|
@ -285,13 +285,13 @@ void mode3RenderLineAll()
|
|||
}
|
||||
}
|
||||
|
||||
if ((mask & 4) && (line2[x] < color)) {
|
||||
color = line2[x];
|
||||
if ((mask & 4) && (g_line2[x] < color)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = lineOBJ[x];
|
||||
if ((mask & 16) && ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -300,24 +300,24 @@ void mode3RenderLineAll()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
back = line2[x];
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -330,38 +330,38 @@ void mode3RenderLineAll()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 16) && (uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
void mode4RenderLine()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x0080) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -23,10 +23,10 @@ void mode4RenderLine()
|
|||
gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -39,13 +39,13 @@ void mode4RenderLine()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line2[x] < color) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -54,30 +54,30 @@ void mode4RenderLine()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -85,11 +85,11 @@ void mode4RenderLine()
|
|||
|
||||
void mode4RenderLineNoWindow()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x0080) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -104,10 +104,10 @@ void mode4RenderLineNoWindow()
|
|||
gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -120,13 +120,13 @@ void mode4RenderLineNoWindow()
|
|||
uint32_t color = backdrop;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line2[x] < color) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -139,33 +139,33 @@ void mode4RenderLineNoWindow()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
if (g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -173,30 +173,30 @@ void mode4RenderLineNoWindow()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -204,11 +204,11 @@ void mode4RenderLineNoWindow()
|
|||
|
||||
void mode4RenderLineAll()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (DISPCNT & 0x0080) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
|
@ -245,11 +245,11 @@ void mode4RenderLineAll()
|
|||
gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
||||
BG2PA, BG2PB, BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawOBJWin(lineOBJWin);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
gfxDrawOBJWin(g_lineOBJWin);
|
||||
|
||||
uint32_t backdrop;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -267,7 +267,7 @@ void mode4RenderLineAll()
|
|||
uint8_t top = 0x20;
|
||||
uint8_t mask = outMask;
|
||||
|
||||
if (!(lineOBJWin[x] & 0x80000000)) {
|
||||
if (!(g_lineOBJWin[x] & 0x80000000)) {
|
||||
mask = WINOUT >> 8;
|
||||
}
|
||||
|
||||
|
@ -282,13 +282,13 @@ void mode4RenderLineAll()
|
|||
}
|
||||
}
|
||||
|
||||
if ((mask & 4) && (line2[x] < color)) {
|
||||
color = line2[x];
|
||||
if ((mask & 4) && (g_line2[x] < color)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = lineOBJ[x];
|
||||
if ((mask & 16) && ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -297,24 +297,24 @@ void mode4RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
back = line2[x];
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -327,38 +327,38 @@ void mode4RenderLineAll()
|
|||
uint32_t back = backdrop;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 16) && (uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
|
|
@ -6,13 +6,13 @@ void mode5RenderLine()
|
|||
{
|
||||
if (DISPCNT & 0x0080) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
int changed = gfxBG2Changed;
|
||||
|
@ -24,10 +24,10 @@ void mode5RenderLine()
|
|||
BG2Y_L, BG2Y_H, BG2PA, BG2PB,
|
||||
BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t background;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -40,13 +40,13 @@ void mode5RenderLine()
|
|||
uint32_t color = background;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line2[x] < color) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -55,30 +55,30 @@ void mode5RenderLine()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -88,13 +88,13 @@ void mode5RenderLineNoWindow()
|
|||
{
|
||||
if (DISPCNT & 0x0080) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
int changed = gfxBG2Changed;
|
||||
|
@ -106,10 +106,10 @@ void mode5RenderLineNoWindow()
|
|||
BG2Y_L, BG2Y_H, BG2PA, BG2PB,
|
||||
BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
|
||||
uint32_t background;
|
||||
if (customBackdropColor == -1) {
|
||||
|
@ -122,13 +122,13 @@ void mode5RenderLineNoWindow()
|
|||
uint32_t color = background;
|
||||
uint8_t top = 0x20;
|
||||
|
||||
if (line2[x] < color) {
|
||||
color = line2[x];
|
||||
if (g_line2[x] < color) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = lineOBJ[x];
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24)) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -141,33 +141,33 @@ void mode5RenderLineNoWindow()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
if (g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -175,30 +175,30 @@ void mode5RenderLineNoWindow()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if (line2[x] < back) {
|
||||
back = line2[x];
|
||||
if (g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
@ -208,13 +208,13 @@ void mode5RenderLineAll()
|
|||
{
|
||||
if (DISPCNT & 0x0080) {
|
||||
for (int x = 0; x < 240; x++) {
|
||||
lineMix[x] = 0x7fff;
|
||||
g_lineMix[x] = 0x7fff;
|
||||
}
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
|
||||
if (coreOptions.layerEnable & 0x0400) {
|
||||
int changed = gfxBG2Changed;
|
||||
|
@ -226,11 +226,11 @@ void mode5RenderLineAll()
|
|||
BG2Y_L, BG2Y_H, BG2PA, BG2PB,
|
||||
BG2PC, BG2PD,
|
||||
gfxBG2X, gfxBG2Y, changed,
|
||||
line2);
|
||||
g_line2);
|
||||
}
|
||||
|
||||
gfxDrawSprites(lineOBJ);
|
||||
gfxDrawOBJWin(lineOBJWin);
|
||||
gfxDrawSprites(g_lineOBJ);
|
||||
gfxDrawOBJWin(g_lineOBJWin);
|
||||
|
||||
bool inWindow0 = false;
|
||||
bool inWindow1 = false;
|
||||
|
@ -270,7 +270,7 @@ void mode5RenderLineAll()
|
|||
uint8_t top = 0x20;
|
||||
uint8_t mask = outMask;
|
||||
|
||||
if (!(lineOBJWin[x] & 0x80000000)) {
|
||||
if (!(g_lineOBJWin[x] & 0x80000000)) {
|
||||
mask = WINOUT >> 8;
|
||||
}
|
||||
|
||||
|
@ -285,13 +285,13 @@ void mode5RenderLineAll()
|
|||
}
|
||||
}
|
||||
|
||||
if ((mask & 4) && (line2[x] < color)) {
|
||||
color = line2[x];
|
||||
if ((mask & 4) && (g_line2[x] < color)) {
|
||||
color = g_line2[x];
|
||||
top = 0x04;
|
||||
}
|
||||
|
||||
if ((mask & 16) && ((uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = lineOBJ[x];
|
||||
if ((mask & 16) && ((uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(color >> 24))) {
|
||||
color = g_lineOBJ[x];
|
||||
top = 0x10;
|
||||
}
|
||||
|
||||
|
@ -300,24 +300,24 @@ void mode5RenderLineAll()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
back = line2[x];
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
else {
|
||||
switch ((BLDMOD >> 6) & 3) {
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -330,38 +330,38 @@ void mode5RenderLineAll()
|
|||
uint32_t back = background;
|
||||
uint8_t top2 = 0x20;
|
||||
|
||||
if ((mask & 4) && line2[x] < back) {
|
||||
if ((mask & 4) && g_line2[x] < back) {
|
||||
if (top != 0x04) {
|
||||
back = line2[x];
|
||||
back = g_line2[x];
|
||||
top2 = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & 16) && (uint8_t)(lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if ((mask & 16) && (uint8_t)(g_lineOBJ[x] >> 24) < (uint8_t)(back >> 24)) {
|
||||
if (top != 0x10) {
|
||||
back = lineOBJ[x];
|
||||
back = g_lineOBJ[x];
|
||||
top2 = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
if (top2 & (BLDMOD >> 8))
|
||||
color = gfxAlphaBlend(color, back,
|
||||
coeff[COLEV & 0x1F],
|
||||
coeff[(COLEV >> 8) & 0x1F]);
|
||||
g_coeff[COLEV & 0x1F],
|
||||
g_coeff[(COLEV >> 8) & 0x1F]);
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
if (BLDMOD & top)
|
||||
color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxIncreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
case 3:
|
||||
if (BLDMOD & top)
|
||||
color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
||||
color = gfxDecreaseBrightness(color, g_coeff[COLY & 0x1F]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineMix[x] = color;
|
||||
g_lineMix[x] = color;
|
||||
}
|
||||
gfxBG2Changed = 0;
|
||||
gfxLastVCOUNT = VCOUNT;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../Util.h"
|
||||
#include "../common/Port.h"
|
||||
#include "GBA.h"
|
||||
#include "GBAinline.h"
|
||||
#include "Globals.h"
|
||||
|
||||
#include <memory.h>
|
||||
|
@ -56,7 +57,7 @@ void rtcEnableRumble(bool e)
|
|||
|
||||
uint16_t rtcRead(uint32_t address)
|
||||
{
|
||||
int res = 0;
|
||||
uint16_t res = 0;
|
||||
|
||||
switch (address) {
|
||||
case 0x80000c8:
|
||||
|
@ -81,7 +82,7 @@ uint16_t rtcRead(uint32_t address)
|
|||
|
||||
// WarioWare Twisted Tilt Sensor
|
||||
if (rtcClockData.select == 0x0b) {
|
||||
uint16_t v = systemGetSensorZ();
|
||||
uint16_t v = DowncastU16(systemGetSensorZ());
|
||||
v = 0x6C0 + v;
|
||||
res |= ((v >> rtcClockData.reserved[11]) & 1) << 2;
|
||||
}
|
||||
|
@ -95,14 +96,14 @@ uint16_t rtcRead(uint32_t address)
|
|||
break;
|
||||
}
|
||||
|
||||
return READ16LE((&rom[address & 0x1FFFFFE]));
|
||||
return READ16LE((&g_rom[address & 0x1FFFFFE]));
|
||||
}
|
||||
|
||||
static uint8_t toBCD(uint8_t value)
|
||||
{
|
||||
value = value % 100;
|
||||
int l = value % 10;
|
||||
int h = value / 10;
|
||||
uint8_t l = value % 10;
|
||||
uint8_t h = value / 10;
|
||||
return h * 16 + l;
|
||||
}
|
||||
|
||||
|
@ -221,13 +222,13 @@ bool rtcWrite(uint32_t address, uint16_t value)
|
|||
SetGBATime();
|
||||
|
||||
rtcClockData.dataLen = 7;
|
||||
rtcClockData.data[0] = toBCD(gba_time.tm_year);
|
||||
rtcClockData.data[1] = toBCD(gba_time.tm_mon + 1);
|
||||
rtcClockData.data[2] = toBCD(gba_time.tm_mday);
|
||||
rtcClockData.data[3] = toBCD(gba_time.tm_wday);
|
||||
rtcClockData.data[4] = toBCD(gba_time.tm_hour);
|
||||
rtcClockData.data[5] = toBCD(gba_time.tm_min);
|
||||
rtcClockData.data[6] = toBCD(gba_time.tm_sec);
|
||||
rtcClockData.data[0] = toBCD(DowncastU8(gba_time.tm_year));
|
||||
rtcClockData.data[1] = toBCD(DowncastU8(gba_time.tm_mon + 1));
|
||||
rtcClockData.data[2] = toBCD(DowncastU8(gba_time.tm_mday));
|
||||
rtcClockData.data[3] = toBCD(DowncastU8(gba_time.tm_wday));
|
||||
rtcClockData.data[4] = toBCD(DowncastU8(gba_time.tm_hour));
|
||||
rtcClockData.data[5] = toBCD(DowncastU8(gba_time.tm_min));
|
||||
rtcClockData.data[6] = toBCD(DowncastU8(gba_time.tm_sec));
|
||||
rtcClockData.state = DATA;
|
||||
} break;
|
||||
|
||||
|
@ -236,9 +237,9 @@ bool rtcWrite(uint32_t address, uint16_t value)
|
|||
SetGBATime();
|
||||
|
||||
rtcClockData.dataLen = 3;
|
||||
rtcClockData.data[0] = toBCD(gba_time.tm_hour);
|
||||
rtcClockData.data[1] = toBCD(gba_time.tm_min);
|
||||
rtcClockData.data[2] = toBCD(gba_time.tm_sec);
|
||||
rtcClockData.data[0] = toBCD(DowncastU8(gba_time.tm_hour));
|
||||
rtcClockData.data[1] = toBCD(DowncastU8(gba_time.tm_min));
|
||||
rtcClockData.data[2] = toBCD(DowncastU8(gba_time.tm_sec));
|
||||
rtcClockData.state = DATA;
|
||||
} break;
|
||||
|
||||
|
|
|
@ -106,11 +106,11 @@ void Gba_Pcm::init()
|
|||
|
||||
void Gba_Pcm::apply_control(int idx)
|
||||
{
|
||||
shift = ~ioMem[SGCNT0_H] >> (2 + idx) & 1;
|
||||
shift = ~g_ioMem[SGCNT0_H] >> (2 + idx) & 1;
|
||||
|
||||
int ch = 0;
|
||||
if ((soundEnableFlag >> idx & 0x100) && (ioMem[NR52] & 0x80))
|
||||
ch = ioMem[SGCNT0_H + 1] >> (idx * 4) & 3;
|
||||
if ((soundEnableFlag >> idx & 0x100) && (g_ioMem[NR52] & 0x80))
|
||||
ch = g_ioMem[SGCNT0_H + 1] >> (idx * 4) & 3;
|
||||
|
||||
Blip_Buffer* out = 0;
|
||||
switch (ch) {
|
||||
|
@ -186,10 +186,10 @@ void Gba_Pcm_Fifo::timer_overflowed(int which_timer)
|
|||
CPUCheckDMA(3, which ? 4 : 2);
|
||||
if (count == 0) {
|
||||
// Not filled by DMA, so fill with 16 bytes of silence
|
||||
int reg = which ? FIFOB_L : FIFOA_L;
|
||||
const int io_reg = which ? FIFOB_L : FIFOA_L;
|
||||
for (int n = 8; n--;) {
|
||||
soundEvent16(reg, (uint16_t)0);
|
||||
soundEvent16(reg + 2, (uint16_t)0);
|
||||
soundEvent16(io_reg, (uint16_t)0);
|
||||
soundEvent16(io_reg + 2, (uint16_t)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void Gba_Pcm_Fifo::write_control(int data)
|
|||
void Gba_Pcm_Fifo::write_fifo(int data)
|
||||
{
|
||||
fifo[writeIndex] = data & 0xFF;
|
||||
fifo[writeIndex + 1] = data >> 8;
|
||||
fifo[writeIndex + 1] = static_cast<uint8_t>(data >> 8);
|
||||
count += 2;
|
||||
writeIndex = (writeIndex + 2) & 31;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void soundEvent8(uint32_t address, uint8_t data)
|
|||
{
|
||||
int gb_addr = gba_to_gb_sound(address);
|
||||
if (gb_addr) {
|
||||
ioMem[address] = data;
|
||||
g_ioMem[address] = data;
|
||||
gb_apu->write_register(soundTicks, gb_addr, data);
|
||||
|
||||
if (address == NR52)
|
||||
|
@ -272,7 +272,7 @@ static void apply_volume(bool apu_only = false)
|
|||
|
||||
if (gb_apu) {
|
||||
static float const apu_vols[4] = { 0.25f, 0.5f, 1.0f, 0.25f };
|
||||
gb_apu->volume(soundVolume_ * apu_vols[ioMem[SGCNT0_H] & 3]);
|
||||
gb_apu->volume(soundVolume_ * apu_vols[g_ioMem[SGCNT0_H] & 3]);
|
||||
}
|
||||
|
||||
if (!apu_only) {
|
||||
|
@ -285,7 +285,7 @@ static void apply_volume(bool apu_only = false)
|
|||
|
||||
static void write_SGCNT0_H(int data)
|
||||
{
|
||||
WRITE16LE(&ioMem[SGCNT0_H], data & 0x770F);
|
||||
WRITE16LE(&g_ioMem[SGCNT0_H], data & 0x770F);
|
||||
pcm[0].write_control(data);
|
||||
pcm[1].write_control(data >> 4);
|
||||
apply_volume(true);
|
||||
|
@ -301,18 +301,18 @@ void soundEvent16(uint32_t address, uint16_t data)
|
|||
case FIFOA_L:
|
||||
case FIFOA_H:
|
||||
pcm[0].write_fifo(data);
|
||||
WRITE16LE(&ioMem[address], data);
|
||||
WRITE16LE(&g_ioMem[address], data);
|
||||
break;
|
||||
|
||||
case FIFOB_L:
|
||||
case FIFOB_H:
|
||||
pcm[1].write_fifo(data);
|
||||
WRITE16LE(&ioMem[address], data);
|
||||
WRITE16LE(&g_ioMem[address], data);
|
||||
break;
|
||||
|
||||
case SOUNDBIAS:
|
||||
data &= 0xC3FF;
|
||||
WRITE16LE(&ioMem[address], data);
|
||||
WRITE16LE(&g_ioMem[address], data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -406,7 +406,7 @@ void psoundTickfn()
|
|||
|
||||
static void apply_muting()
|
||||
{
|
||||
if (!stereo_buffer || !ioMem)
|
||||
if (!stereo_buffer || !g_ioMem)
|
||||
return;
|
||||
|
||||
// PCM
|
||||
|
@ -436,7 +436,7 @@ static void reset_apu()
|
|||
|
||||
static void remake_stereo_buffer()
|
||||
{
|
||||
if (!ioMem)
|
||||
if (!g_ioMem)
|
||||
return;
|
||||
|
||||
// Clears pointers kept to old stereo_buffer
|
||||
|
@ -777,14 +777,14 @@ static void soundReadGameOld(gzFile in, int version)
|
|||
NR50, NR51, NR52, -1
|
||||
};
|
||||
|
||||
ioMem[NR52] |= 0x80; // old sound played even when this wasn't set (power on)
|
||||
g_ioMem[NR52] |= 0x80; // old sound played even when this wasn't set (power on)
|
||||
|
||||
for (int i = 0; regs_to_copy[i] >= 0; i++)
|
||||
state.apu.regs[gba_to_gb_sound(regs_to_copy[i]) - 0xFF10] = ioMem[regs_to_copy[i]];
|
||||
state.apu.regs[gba_to_gb_sound(regs_to_copy[i]) - 0xFF10] = g_ioMem[regs_to_copy[i]];
|
||||
|
||||
// Copy wave RAM to both banks
|
||||
memcpy(&state.apu.regs[0x20], &ioMem[0x90], 0x10);
|
||||
memcpy(&state.apu.regs[0x30], &ioMem[0x90], 0x10);
|
||||
memcpy(&state.apu.regs[0x20], &g_ioMem[0x90], 0x10);
|
||||
memcpy(&state.apu.regs[0x30], &g_ioMem[0x90], 0x10);
|
||||
|
||||
// Read both banks of wave RAM if available
|
||||
if (version >= SAVE_GAME_VERSION_3)
|
||||
|
@ -811,7 +811,7 @@ void soundReadGame(gzFile in, int version)
|
|||
soundReadGameOld(in, version);
|
||||
|
||||
gb_apu->load_state(state.apu);
|
||||
write_SGCNT0_H(READ16LE(&ioMem[SGCNT0_H]) & 0x770F);
|
||||
write_SGCNT0_H(READ16LE(&g_ioMem[SGCNT0_H]) & 0x770F);
|
||||
|
||||
apply_muting();
|
||||
}
|
||||
|
@ -837,7 +837,7 @@ void soundReadGame(const uint8_t*& in)
|
|||
utilReadDataMem(in, gba_state);
|
||||
|
||||
gb_apu->load_state(state.apu);
|
||||
write_SGCNT0_H(READ16LE(&ioMem[SGCNT0_H]) & 0x770F);
|
||||
write_SGCNT0_H(READ16LE(&g_ioMem[SGCNT0_H]) & 0x770F);
|
||||
|
||||
apply_muting();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ void agbPrintFlush()
|
|||
return;
|
||||
}
|
||||
|
||||
uint8_t* data = &rom[address];
|
||||
uint8_t* data = &g_rom[address];
|
||||
|
||||
while (get != put) {
|
||||
char c = data[get++];
|
||||
|
|
|
@ -847,23 +847,23 @@ void BIOS_RegisterRamReset(uint32_t flags)
|
|||
if (flags) {
|
||||
if (flags & 0x01) {
|
||||
// clear work RAM
|
||||
memset(workRAM, 0, SIZE_WRAM);
|
||||
memset(g_workRAM, 0, SIZE_WRAM);
|
||||
}
|
||||
if (flags & 0x02) {
|
||||
// clear internal RAM
|
||||
memset(internalRAM, 0, 0x7e00); // don't clear 0x7e00-0x7fff
|
||||
memset(g_internalRAM, 0, 0x7e00); // don't clear 0x7e00-0x7fff
|
||||
}
|
||||
if (flags & 0x04) {
|
||||
// clear palette RAM
|
||||
memset(paletteRAM, 0, 0x400);
|
||||
memset(g_paletteRAM, 0, 0x400);
|
||||
}
|
||||
if (flags & 0x08) {
|
||||
// clear VRAM
|
||||
memset(vram, 0, 0x18000);
|
||||
memset(g_vram, 0, 0x18000);
|
||||
}
|
||||
if (flags & 0x10) {
|
||||
// clean OAM
|
||||
memset(oam, 0, 0x400);
|
||||
memset(g_oam, 0, 0x400);
|
||||
}
|
||||
|
||||
if (flags & 0x80) {
|
||||
|
@ -1061,9 +1061,9 @@ void BIOS_SoftReset()
|
|||
reg[R13_SVC].I = 0x03007FE0;
|
||||
reg[R14_SVC].I = 0x00000000;
|
||||
reg[SPSR_SVC].I = 0x00000000;
|
||||
uint8_t b = internalRAM[0x7ffa];
|
||||
uint8_t b = g_internalRAM[0x7ffa];
|
||||
|
||||
memset(&internalRAM[0x7e00], 0, 0x200);
|
||||
memset(&g_internalRAM[0x7e00], 0, 0x200);
|
||||
|
||||
if (b) {
|
||||
armNextPC = 0x02000000;
|
||||
|
|
|
@ -2574,14 +2574,14 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
|||
unsigned effective_address = address - 0x2000000;
|
||||
|
||||
if (effective_address + section_size < SIZE_WRAM) {
|
||||
memcpy(&workRAM[effective_address], source, section_size);
|
||||
memcpy(&g_workRAM[effective_address], source, section_size);
|
||||
size += section_size;
|
||||
}
|
||||
} else {
|
||||
unsigned effective_address = address - 0x8000000;
|
||||
|
||||
if (effective_address + section_size < SIZE_ROM) {
|
||||
memcpy(&rom[effective_address], source, section_size);
|
||||
memcpy(&g_rom[effective_address], source, section_size);
|
||||
size += section_size;
|
||||
}
|
||||
}
|
||||
|
@ -2623,13 +2623,13 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
|||
if (READ32LE(&sh[i]->flags) & 2) { // load section
|
||||
if (coreOptions.cpuIsMultiBoot) {
|
||||
if (READ32LE(&sh[i]->addr) >= 0x2000000 && READ32LE(&sh[i]->addr) <= 0x203ffff) {
|
||||
memcpy(&workRAM[READ32LE(&sh[i]->addr) & 0x3ffff], data + READ32LE(&sh[i]->offset),
|
||||
memcpy(&g_workRAM[READ32LE(&sh[i]->addr) & 0x3ffff], data + READ32LE(&sh[i]->offset),
|
||||
READ32LE(&sh[i]->size));
|
||||
size += READ32LE(&sh[i]->size);
|
||||
}
|
||||
} else {
|
||||
if (READ32LE(&sh[i]->addr) >= 0x8000000 && READ32LE(&sh[i]->addr) <= 0x9ffffff) {
|
||||
memcpy(&rom[READ32LE(&sh[i]->addr) & 0x1ffffff],
|
||||
memcpy(&g_rom[READ32LE(&sh[i]->addr) & 0x1ffffff],
|
||||
data + READ32LE(&sh[i]->offset),
|
||||
READ32LE(&sh[i]->size));
|
||||
size += READ32LE(&sh[i]->size);
|
||||
|
|
|
@ -95,7 +95,7 @@ int CheckEReaderRegion(void) //US = 1, JAP = 2, JAP+ = 3
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < 18; i++)
|
||||
rom_info[i] = rom[0xA0 + i];
|
||||
rom_info[i] = g_rom[0xA0 + i];
|
||||
rom_info[i] = 0;
|
||||
|
||||
if (!strcasecmp(rom_info, US_Ereader))
|
||||
|
@ -200,13 +200,13 @@ void EReaderWriteMemory(uint32_t address, uint32_t value)
|
|||
{
|
||||
switch (address >> 24) {
|
||||
case 2:
|
||||
WRITE32LE(((uint32_t*)&workRAM[address & 0x3FFFF]), value);
|
||||
WRITE32LE(((uint32_t*)&g_workRAM[address & 0x3FFFF]), value);
|
||||
break;
|
||||
case 3:
|
||||
WRITE32LE(((uint32_t*)&internalRAM[address & 0x7FFF]), value);
|
||||
WRITE32LE(((uint32_t*)&g_internalRAM[address & 0x7FFF]), value);
|
||||
break;
|
||||
default:
|
||||
WRITE32LE(((uint32_t*)&rom[address & 0x1FFFFFF]), value);
|
||||
WRITE32LE(((uint32_t*)&g_rom[address & 0x1FFFFFF]), value);
|
||||
//rom[address & 0x1FFFFFF] = data;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ inline void swap(short& a, short& b)
|
|||
void gbafilter_pal(uint16_t* buf, int count)
|
||||
{
|
||||
short temp[3 * 3], s;
|
||||
unsigned pix;
|
||||
uint16_t pix;
|
||||
uint8_t red, green, blue;
|
||||
|
||||
while (count--) {
|
||||
|
|
|
@ -761,22 +761,22 @@ unsigned int SearchResults;
|
|||
|
||||
unsigned int AddressToGBA(uint8_t* mem)
|
||||
{
|
||||
if (mem >= &bios[0] && mem <= &bios[0x3fff])
|
||||
return 0x00000000 + (mem - &bios[0]);
|
||||
else if (mem >= &workRAM[0] && mem <= &workRAM[0x3ffff])
|
||||
return 0x02000000 + (mem - &workRAM[0]);
|
||||
else if (mem >= &internalRAM[0] && mem <= &internalRAM[0x7fff])
|
||||
return 0x03000000 + (mem - &internalRAM[0]);
|
||||
else if (mem >= &ioMem[0] && mem <= &ioMem[0x3ff])
|
||||
return 0x04000000 + (mem - &ioMem[0]);
|
||||
else if (mem >= &paletteRAM[0] && mem <= &paletteRAM[0x3ff])
|
||||
return 0x05000000 + (mem - &paletteRAM[0]);
|
||||
else if (mem >= &vram[0] && mem <= &vram[0x1ffff])
|
||||
return 0x06000000 + (mem - &vram[0]);
|
||||
else if (mem >= &oam[0] && mem <= &oam[0x3ff])
|
||||
return 0x07000000 + (mem - &oam[0]);
|
||||
else if (mem >= &rom[0] && mem <= &rom[0x1ffffff])
|
||||
return 0x08000000 + (mem - &rom[0]);
|
||||
if (mem >= &g_bios[0] && mem <= &g_bios[0x3fff])
|
||||
return 0x00000000 + (mem - &g_bios[0]);
|
||||
else if (mem >= &g_workRAM[0] && mem <= &g_workRAM[0x3ffff])
|
||||
return 0x02000000 + (mem - &g_workRAM[0]);
|
||||
else if (mem >= &g_internalRAM[0] && mem <= &g_internalRAM[0x7fff])
|
||||
return 0x03000000 + (mem - &g_internalRAM[0]);
|
||||
else if (mem >= &g_ioMem[0] && mem <= &g_ioMem[0x3ff])
|
||||
return 0x04000000 + (mem - &g_ioMem[0]);
|
||||
else if (mem >= &g_paletteRAM[0] && mem <= &g_paletteRAM[0x3ff])
|
||||
return 0x05000000 + (mem - &g_paletteRAM[0]);
|
||||
else if (mem >= &g_vram[0] && mem <= &g_vram[0x1ffff])
|
||||
return 0x06000000 + (mem - &g_vram[0]);
|
||||
else if (mem >= &g_oam[0] && mem <= &g_oam[0x3ff])
|
||||
return 0x07000000 + (mem - &g_oam[0]);
|
||||
else if (mem >= &g_rom[0] && mem <= &g_rom[0x1ffffff])
|
||||
return 0x08000000 + (mem - &g_rom[0]);
|
||||
else
|
||||
return 0xFFFFFFFF;
|
||||
};
|
||||
|
@ -796,8 +796,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x02000000;
|
||||
continue;
|
||||
} else {
|
||||
start = bios + (SearchStart & 0x3FFF);
|
||||
end = bios + 0x3FFF;
|
||||
start = g_bios + (SearchStart & 0x3FFF);
|
||||
end = g_bios + 0x3FFF;
|
||||
break;
|
||||
};
|
||||
case 2:
|
||||
|
@ -805,8 +805,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x03000000;
|
||||
continue;
|
||||
} else {
|
||||
start = workRAM + (SearchStart & 0x3FFFF);
|
||||
end = workRAM + 0x3FFFF;
|
||||
start = g_workRAM + (SearchStart & 0x3FFFF);
|
||||
end = g_workRAM + 0x3FFFF;
|
||||
break;
|
||||
};
|
||||
case 3:
|
||||
|
@ -814,8 +814,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x04000000;
|
||||
continue;
|
||||
} else {
|
||||
start = internalRAM + (SearchStart & 0x7FFF);
|
||||
end = internalRAM + 0x7FFF;
|
||||
start = g_internalRAM + (SearchStart & 0x7FFF);
|
||||
end = g_internalRAM + 0x7FFF;
|
||||
break;
|
||||
};
|
||||
case 4:
|
||||
|
@ -823,8 +823,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x05000000;
|
||||
continue;
|
||||
} else {
|
||||
start = ioMem + (SearchStart & 0x3FF);
|
||||
end = ioMem + 0x3FF;
|
||||
start = g_ioMem + (SearchStart & 0x3FF);
|
||||
end = g_ioMem + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 5:
|
||||
|
@ -832,8 +832,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x06000000;
|
||||
continue;
|
||||
} else {
|
||||
start = paletteRAM + (SearchStart & 0x3FF);
|
||||
end = paletteRAM + 0x3FF;
|
||||
start = g_paletteRAM + (SearchStart & 0x3FF);
|
||||
end = g_paletteRAM + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 6:
|
||||
|
@ -841,8 +841,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x07000000;
|
||||
continue;
|
||||
} else {
|
||||
start = vram + (SearchStart & 0x1FFFF);
|
||||
end = vram + 0x1FFFF;
|
||||
start = g_vram + (SearchStart & 0x1FFFF);
|
||||
end = g_vram + 0x1FFFF;
|
||||
break;
|
||||
};
|
||||
case 7:
|
||||
|
@ -850,8 +850,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x08000000;
|
||||
continue;
|
||||
} else {
|
||||
start = oam + (SearchStart & 0x3FF);
|
||||
end = oam + 0x3FF;
|
||||
start = g_oam + (SearchStart & 0x3FF);
|
||||
end = g_oam + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 8:
|
||||
|
@ -861,8 +861,8 @@ void debuggerDoSearch()
|
|||
case 12:
|
||||
case 13:
|
||||
if (final <= 0x09FFFFFF) {
|
||||
start = rom + (SearchStart & 0x01FFFFFF);
|
||||
end = rom + 0x01FFFFFF;
|
||||
start = g_rom + (SearchStart & 0x01FFFFFF);
|
||||
end = g_rom + 0x01FFFFFF;
|
||||
break;
|
||||
};
|
||||
default: {
|
||||
|
|
|
@ -131,8 +131,8 @@ void utilGBAFindSave(const int size)
|
|||
bool rtcFound_ = false;
|
||||
int detectedSaveType = 0;
|
||||
int flashSize_ = 0x10000;
|
||||
uint32_t *p = (uint32_t *)&rom[0];
|
||||
uint32_t *end = (uint32_t *)(&rom[0] + size);
|
||||
uint32_t *p = (uint32_t *)&g_rom[0];
|
||||
uint32_t *end = (uint32_t *)(&g_rom[0] + size);
|
||||
|
||||
while (p < end) {
|
||||
uint32_t d = READ32LE(p);
|
||||
|
@ -183,7 +183,7 @@ void utilGBAFindSave(const int size)
|
|||
|
||||
coreOptions.cpuSaveType = detectedSaveType;
|
||||
coreOptions.rtcEnabled = rtcFound_;
|
||||
flashSize = flashSize_;
|
||||
g_flashSize = flashSize_;
|
||||
}
|
||||
|
||||
void utilUpdateSystemColorMaps(bool lcd)
|
||||
|
|
|
@ -329,10 +329,10 @@ void* retro_get_memory_data(unsigned id)
|
|||
data = flashSaveMemory;
|
||||
break;
|
||||
case RETRO_MEMORY_SYSTEM_RAM:
|
||||
data = workRAM;
|
||||
data = g_workRAM;
|
||||
break;
|
||||
case RETRO_MEMORY_VIDEO_RAM:
|
||||
data = vram;
|
||||
data = g_vram;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -372,7 +372,7 @@ size_t retro_get_memory_size(unsigned id)
|
|||
if ((coreOptions.saveType == GBA_SAVE_EEPROM) | (coreOptions.saveType == GBA_SAVE_EEPROM_SENSOR))
|
||||
size = eepromSize;
|
||||
else if (coreOptions.saveType == GBA_SAVE_FLASH)
|
||||
size = flashSize;
|
||||
size = g_flashSize;
|
||||
else if (coreOptions.saveType == GBA_SAVE_SRAM)
|
||||
size = SIZE_SRAM;
|
||||
break;
|
||||
|
@ -380,7 +380,7 @@ size_t retro_get_memory_size(unsigned id)
|
|||
size = SIZE_WRAM;
|
||||
break;
|
||||
case RETRO_MEMORY_VIDEO_RAM:
|
||||
size = SIZE_VRAM - 0x2000; // usuable vram is only 0x18000
|
||||
size = SIZE_VRAM - 0x2000; // usuable g_vram is only 0x18000
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -808,10 +808,10 @@ static void load_image_preferences(void)
|
|||
bool hasRumble = false;
|
||||
char buffer[12 + 1];
|
||||
unsigned i = 0, found_no = 0;
|
||||
unsigned long romCrc32 = crc32(0, rom, romSize);
|
||||
unsigned long romCrc32 = crc32(0, g_rom, romSize);
|
||||
|
||||
coreOptions.cpuSaveType = GBA_SAVE_AUTO;
|
||||
flashSize = SIZE_FLASH512;
|
||||
g_flashSize = SIZE_FLASH512;
|
||||
eepromSize = SIZE_EEPROM_512;
|
||||
coreOptions.rtcEnabled = false;
|
||||
coreOptions.mirroringEnable = false;
|
||||
|
@ -820,18 +820,18 @@ static void load_image_preferences(void)
|
|||
|
||||
buffer[0] = 0;
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (rom[0xa0 + i] == 0)
|
||||
if (g_rom[0xa0 + i] == 0)
|
||||
break;
|
||||
buffer[i] = rom[0xa0 + i];
|
||||
buffer[i] = g_rom[0xa0 + i];
|
||||
}
|
||||
|
||||
buffer[i] = 0;
|
||||
log("Game Title : %s\n", buffer);
|
||||
|
||||
buffer[0] = rom[0xac];
|
||||
buffer[1] = rom[0xad];
|
||||
buffer[2] = rom[0xae];
|
||||
buffer[3] = rom[0xaf];
|
||||
buffer[0] = g_rom[0xac];
|
||||
buffer[1] = g_rom[0xad];
|
||||
buffer[2] = g_rom[0xae];
|
||||
buffer[3] = g_rom[0xaf];
|
||||
buffer[4] = 0;
|
||||
log("Game Code : %s\n", buffer);
|
||||
|
||||
|
@ -851,9 +851,9 @@ static void load_image_preferences(void)
|
|||
|
||||
unsigned size = gbaover[found_no].saveSize;
|
||||
if (coreOptions.cpuSaveType == GBA_SAVE_SRAM)
|
||||
flashSize = SIZE_SRAM;
|
||||
g_flashSize = SIZE_SRAM;
|
||||
else if (coreOptions.cpuSaveType == GBA_SAVE_FLASH)
|
||||
flashSize = (size == SIZE_FLASH1M) ? SIZE_FLASH1M : SIZE_FLASH512;
|
||||
g_flashSize = (size == SIZE_FLASH1M) ? SIZE_FLASH1M : SIZE_FLASH512;
|
||||
else if ((coreOptions.cpuSaveType == GBA_SAVE_EEPROM) || (coreOptions.cpuSaveType == GBA_SAVE_EEPROM_SENSOR))
|
||||
eepromSize = (size == SIZE_EEPROM_8K) ? SIZE_EEPROM_8K : SIZE_EEPROM_512;
|
||||
}
|
||||
|
@ -866,8 +866,8 @@ static void load_image_preferences(void)
|
|||
|
||||
coreOptions.saveType = coreOptions.cpuSaveType;
|
||||
|
||||
if (flashSize == SIZE_FLASH512 || flashSize == SIZE_FLASH1M)
|
||||
flashSetSize(flashSize);
|
||||
if (g_flashSize == SIZE_FLASH512 || g_flashSize == SIZE_FLASH1M)
|
||||
flashSetSize(g_flashSize);
|
||||
|
||||
if (option_forceRTCenable)
|
||||
coreOptions.rtcEnabled = true;
|
||||
|
@ -886,7 +886,7 @@ static void load_image_preferences(void)
|
|||
log("has RTC : %s.\n", coreOptions.rtcEnabled ? "Yes" : "No");
|
||||
log("cpuSaveType : %s.\n", savetype[coreOptions.cpuSaveType]);
|
||||
if (coreOptions.cpuSaveType == 3)
|
||||
log("flashSize : %d.\n", flashSize);
|
||||
log("g_flashSize : %d.\n", g_flashSize);
|
||||
else if (coreOptions.cpuSaveType == 1)
|
||||
log("eepromSize : %d.\n", eepromSize);
|
||||
log("mirroringEnable : %s.\n", coreOptions.mirroringEnable ? "Yes" : "No");
|
||||
|
@ -1634,22 +1634,22 @@ bool retro_load_game(const struct retro_game_info *game)
|
|||
struct retro_memory_descriptor desc[11];
|
||||
memset(desc, 0, sizeof(desc));
|
||||
|
||||
desc[0].start=0x03000000; desc[0].select=0xFF000000; desc[0].len=0x8000; desc[0].ptr=internalRAM;//fast WRAM
|
||||
desc[1].start=0x02000000; desc[1].select=0xFF000000; desc[1].len=0x40000; desc[1].ptr=workRAM;//slow WRAM
|
||||
desc[0].start=0x03000000; desc[0].select=0xFF000000; desc[0].len=0x8000; desc[0].ptr=g_internalRAM;//fast WRAM
|
||||
desc[1].start=0x02000000; desc[1].select=0xFF000000; desc[1].len=0x40000; desc[1].ptr=g_workRAM;//slow WRAM
|
||||
/* TODO: if SRAM is flash, use start=0 addrspace="S" instead */
|
||||
desc[2].start=0x0E000000; desc[2].select=0; desc[2].len=flashSize; desc[2].ptr=flashSaveMemory;//SRAM
|
||||
desc[3].start=0x08000000; desc[3].select=0; desc[3].len=romSize; desc[3].ptr=rom;//ROM
|
||||
desc[2].start=0x0E000000; desc[2].select=0; desc[2].len=g_flashSize; desc[2].ptr=flashSaveMemory;//SRAM
|
||||
desc[3].start=0x08000000; desc[3].select=0; desc[3].len=romSize; desc[3].ptr=g_rom;//ROM
|
||||
desc[3].flags=RETRO_MEMDESC_CONST;
|
||||
desc[4].start=0x0A000000; desc[4].select=0; desc[4].len=romSize; desc[4].ptr=rom;//ROM mirror 1
|
||||
desc[4].start=0x0A000000; desc[4].select=0; desc[4].len=romSize; desc[4].ptr=g_rom;//ROM mirror 1
|
||||
desc[4].flags=RETRO_MEMDESC_CONST;
|
||||
desc[5].start=0x0C000000; desc[5].select=0; desc[5].len=romSize; desc[5].ptr=rom;//ROM mirror 2
|
||||
desc[5].start=0x0C000000; desc[5].select=0; desc[5].len=romSize; desc[5].ptr=g_rom;//ROM mirror 2
|
||||
desc[5].flags=RETRO_MEMDESC_CONST;
|
||||
desc[6].start=0x00000000; desc[6].select=0; desc[6].len=0x4000; desc[6].ptr=bios;//BIOS
|
||||
desc[6].start=0x00000000; desc[6].select=0; desc[6].len=0x4000; desc[6].ptr=g_bios;//BIOS
|
||||
desc[6].flags=RETRO_MEMDESC_CONST;
|
||||
desc[7].start=0x06000000; desc[7].select=0xFF000000; desc[7].len=0x18000; desc[7].ptr=vram;//VRAM
|
||||
desc[8].start=0x05000000; desc[8].select=0xFF000000; desc[8].len=0x400; desc[8].ptr=paletteRAM;//palettes
|
||||
desc[9].start=0x07000000; desc[9].select=0xFF000000; desc[9].len=0x400; desc[9].ptr=oam;//OAM
|
||||
desc[10].start=0x04000000;desc[10].select=0; desc[10].len=0x400; desc[10].ptr=ioMem;//bunch of registers
|
||||
desc[7].start=0x06000000; desc[7].select=0xFF000000; desc[7].len=0x18000; desc[7].ptr=g_vram;//VRAM
|
||||
desc[8].start=0x05000000; desc[8].select=0xFF000000; desc[8].len=0x400; desc[8].ptr=g_paletteRAM;//palettes
|
||||
desc[9].start=0x07000000; desc[9].select=0xFF000000; desc[9].len=0x400; desc[9].ptr=g_oam;//OAM
|
||||
desc[10].start=0x04000000;desc[10].select=0; desc[10].len=0x400; desc[10].ptr=g_ioMem;//bunch of registers
|
||||
|
||||
struct retro_memory_map retromap = {
|
||||
desc,
|
||||
|
@ -1780,8 +1780,8 @@ void systemDrawScreen(void)
|
|||
{
|
||||
unsigned pitch = systemWidth * (systemColorDepth >> 3);
|
||||
if (ifb_filter_func)
|
||||
ifb_filter_func(pix, pitch, systemWidth, systemHeight);
|
||||
video_cb(pix, systemWidth, systemHeight, pitch);
|
||||
ifb_filter_func(g_pix, pitch, systemWidth, systemHeight);
|
||||
video_cb(g_pix, systemWidth, systemHeight, pitch);
|
||||
}
|
||||
|
||||
void systemSendScreen(void)
|
||||
|
|
|
@ -552,10 +552,10 @@ static void sdlApplyPerImagePreferences()
|
|||
|
||||
char buffer[7];
|
||||
buffer[0] = '[';
|
||||
buffer[1] = rom[0xac];
|
||||
buffer[2] = rom[0xad];
|
||||
buffer[3] = rom[0xae];
|
||||
buffer[4] = rom[0xaf];
|
||||
buffer[1] = g_rom[0xac];
|
||||
buffer[2] = g_rom[0xad];
|
||||
buffer[3] = g_rom[0xae];
|
||||
buffer[4] = g_rom[0xaf];
|
||||
buffer[5] = ']';
|
||||
buffer[6] = 0;
|
||||
|
||||
|
@ -1751,7 +1751,7 @@ int main(int argc, char** argv)
|
|||
int patchnum;
|
||||
for (patchnum = 0; patchnum < patchNum; patchnum++) {
|
||||
fprintf(stdout, "Trying patch %s%s\n", patchNames[patchnum],
|
||||
applyPatch(patchNames[patchnum], &rom, &size) ? " [success]" : "");
|
||||
applyPatch(patchNames[patchnum], &g_rom, &size) ? " [success]" : "");
|
||||
}
|
||||
CPUReset();
|
||||
}
|
||||
|
@ -1765,15 +1765,15 @@ int main(int argc, char** argv)
|
|||
soundInit();
|
||||
cartridgeType = 0;
|
||||
strcpy(filename, "gnu_stub");
|
||||
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);
|
||||
g_rom = (uint8_t*)malloc(0x2000000);
|
||||
g_workRAM = (uint8_t*)calloc(1, 0x40000);
|
||||
g_bios = (uint8_t*)calloc(1, 0x4000);
|
||||
g_internalRAM = (uint8_t*)calloc(1, 0x8000);
|
||||
g_paletteRAM = (uint8_t*)calloc(1, 0x400);
|
||||
g_vram = (uint8_t*)calloc(1, 0x20000);
|
||||
g_oam = (uint8_t*)calloc(1, 0x400);
|
||||
g_pix = (uint8_t*)calloc(1, 4 * 241 * 162);
|
||||
g_ioMem = (uint8_t*)calloc(1, 0x400);
|
||||
|
||||
emulator = GBASystem;
|
||||
|
||||
|
@ -1918,7 +1918,7 @@ int main(int argc, char** argv)
|
|||
SDL_GL_DeleteContext(glcontext);
|
||||
}
|
||||
|
||||
if (gbRom != NULL || rom != NULL) {
|
||||
if (gbRom != NULL || g_rom != NULL) {
|
||||
sdlWriteBattery();
|
||||
emulator.emuCleanUp();
|
||||
}
|
||||
|
@ -2001,9 +2001,9 @@ void systemDrawScreen()
|
|||
}
|
||||
|
||||
if (ifbFunction)
|
||||
ifbFunction(pix + srcPitch, srcPitch, sizeX, sizeY);
|
||||
ifbFunction(g_pix + srcPitch, srcPitch, sizeX, sizeY);
|
||||
|
||||
filterFunction(pix + srcPitch, srcPitch, delta, screen,
|
||||
filterFunction(g_pix + srcPitch, srcPitch, delta, screen,
|
||||
destPitch, sizeX, sizeY);
|
||||
|
||||
if (openGL) {
|
||||
|
|
|
@ -1599,8 +1599,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x03000000;
|
||||
continue;
|
||||
} else {
|
||||
start = workRAM + (SearchStart & 0x3FFFF);
|
||||
end = workRAM + 0x3FFFF;
|
||||
start = g_workRAM + (SearchStart & 0x3FFFF);
|
||||
end = g_workRAM + 0x3FFFF;
|
||||
break;
|
||||
};
|
||||
case 3:
|
||||
|
@ -1608,8 +1608,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x04000000;
|
||||
continue;
|
||||
} else {
|
||||
start = internalRAM + (SearchStart & 0x7FFF);
|
||||
end = internalRAM + 0x7FFF;
|
||||
start = g_internalRAM + (SearchStart & 0x7FFF);
|
||||
end = g_internalRAM + 0x7FFF;
|
||||
break;
|
||||
};
|
||||
case 4:
|
||||
|
@ -1617,8 +1617,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x05000000;
|
||||
continue;
|
||||
} else {
|
||||
start = ioMem + (SearchStart & 0x3FF);
|
||||
end = ioMem + 0x3FF;
|
||||
start = g_ioMem + (SearchStart & 0x3FF);
|
||||
end = g_ioMem + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 5:
|
||||
|
@ -1626,8 +1626,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x06000000;
|
||||
continue;
|
||||
} else {
|
||||
start = paletteRAM + (SearchStart & 0x3FF);
|
||||
end = paletteRAM + 0x3FF;
|
||||
start = g_paletteRAM + (SearchStart & 0x3FF);
|
||||
end = g_paletteRAM + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 6:
|
||||
|
@ -1635,8 +1635,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x07000000;
|
||||
continue;
|
||||
} else {
|
||||
start = vram + (SearchStart & 0x1FFFF);
|
||||
end = vram + 0x1FFFF;
|
||||
start = g_vram + (SearchStart & 0x1FFFF);
|
||||
end = g_vram + 0x1FFFF;
|
||||
break;
|
||||
};
|
||||
case 7:
|
||||
|
@ -1644,8 +1644,8 @@ void debuggerDoSearch()
|
|||
SearchStart = 0x08000000;
|
||||
continue;
|
||||
} else {
|
||||
start = oam + (SearchStart & 0x3FF);
|
||||
end = oam + 0x3FF;
|
||||
start = g_oam + (SearchStart & 0x3FF);
|
||||
end = g_oam + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 8:
|
||||
|
@ -1700,18 +1700,18 @@ unsigned int AddressToGBA(uint8_t* mem)
|
|||
{
|
||||
if (mem >= &bios[0] && mem <= &bios[0x3fff])
|
||||
return 0x00000000 + (mem - &bios[0]);
|
||||
else if (mem >= &workRAM[0] && mem <= &workRAM[0x3ffff])
|
||||
return 0x02000000 + (mem - &workRAM[0]);
|
||||
else if (mem >= &internalRAM[0] && mem <= &internalRAM[0x7fff])
|
||||
return 0x03000000 + (mem - &internalRAM[0]);
|
||||
else if (mem >= &ioMem[0] && mem <= &ioMem[0x3ff])
|
||||
return 0x04000000 + (mem - &ioMem[0]);
|
||||
else if (mem >= &paletteRAM[0] && mem <= &paletteRAM[0x3ff])
|
||||
return 0x05000000 + (mem - &paletteRAM[0]);
|
||||
else if (mem >= &vram[0] && mem <= &vram[0x1ffff])
|
||||
return 0x06000000 + (mem - &vram[0]);
|
||||
else if (mem >= &oam[0] && mem <= &oam[0x3ff])
|
||||
return 0x07000000 + (mem - &oam[0]);
|
||||
else if (mem >= &g_workRAM[0] && mem <= &g_workRAM[0x3ffff])
|
||||
return 0x02000000 + (mem - &g_workRAM[0]);
|
||||
else if (mem >= &g_internalRAM[0] && mem <= &g_internalRAM[0x7fff])
|
||||
return 0x03000000 + (mem - &g_internalRAM[0]);
|
||||
else if (mem >= &g_ioMem[0] && mem <= &g_ioMem[0x3ff])
|
||||
return 0x04000000 + (mem - &g_ioMem[0]);
|
||||
else if (mem >= &g_paletteRAM[0] && mem <= &g_paletteRAM[0x3ff])
|
||||
return 0x05000000 + (mem - &g_paletteRAM[0]);
|
||||
else if (mem >= &g_vram[0] && mem <= &g_vram[0x1ffff])
|
||||
return 0x06000000 + (mem - &g_vram[0]);
|
||||
else if (mem >= &g_oam[0] && mem <= &g_oam[0x3ff])
|
||||
return 0x07000000 + (mem - &g_oam[0]);
|
||||
else if (mem >= &rom[0] && mem <= &rom[0x1ffffff])
|
||||
return 0x08000000 + (mem - &rom[0]);
|
||||
else
|
||||
|
|
|
@ -28,10 +28,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <wchar.h>
|
||||
#include <locale.h>
|
||||
#ifndef _MSC_VER
|
||||
|
@ -51,8 +49,8 @@ void format_perror(const char* fmt, va_list args) {
|
|||
static char error_str[MSG_SIZE];
|
||||
static char fmt_str[MSG_SIZE];
|
||||
strcpy(fmt_str, msg_prefix);
|
||||
strncat(fmt_str, fmt, MSG_SIZE - sizeof(msg_prefix));
|
||||
vsnprintf(error_str, sizeof(error_str), fmt_str, args);
|
||||
strncat(fmt_str, fmt, MSG_SIZE - strlen(msg_prefix));
|
||||
vsnprintf(error_str, MSG_SIZE, fmt_str, args);
|
||||
perror(error_str);
|
||||
}
|
||||
|
||||
|
@ -65,9 +63,10 @@ void die(const char* fmt, ...) {
|
|||
}
|
||||
|
||||
void* safe_malloc(size_t size) {
|
||||
void* allocated;
|
||||
if (!(allocated = malloc(size)))
|
||||
void* allocated = malloc(size);
|
||||
if (!allocated) {
|
||||
die("out of memory");
|
||||
}
|
||||
return allocated;
|
||||
}
|
||||
|
||||
|
@ -81,8 +80,10 @@ char* file_name_to_identifier(const char* file_name_cstr) {
|
|||
size_t file_name_len = 0;
|
||||
int between_tokens = 0;
|
||||
|
||||
if ((file_name_len = mbstowcs(file_name, file_name_cstr, BUF_SIZE - 1)) == -1)
|
||||
file_name_len = mbstowcs(file_name, file_name_cstr, BUF_SIZE - 1);
|
||||
if (file_name_len == (size_t)(-1)) {
|
||||
die("cannot convert '%s' to locale representation", file_name_cstr);
|
||||
}
|
||||
|
||||
*identifier = 0;
|
||||
|
||||
|
@ -108,7 +109,7 @@ char* file_name_to_identifier(const char* file_name_cstr) {
|
|||
|
||||
*identifier_ptr = 0;
|
||||
|
||||
if (wcstombs(identifier_cstr, identifier, WBUF_SIZE - 1) == -1)
|
||||
if (wcstombs(identifier_cstr, identifier, WBUF_SIZE - 1) == (size_t)(-1))
|
||||
die("failed to convert wide character string to bytes");
|
||||
|
||||
free(file_name);
|
||||
|
@ -151,7 +152,8 @@ void die_usage(const char* fmt, ...) {
|
|||
va_list args;
|
||||
va_start(args, fmt);
|
||||
strcpy(fmt_str, msg_prefix);
|
||||
strncat(fmt_str, fmt, MSG_SIZE - sizeof(msg_prefix));
|
||||
// Need to reserve 1 byte for the newline.
|
||||
strncat(fmt_str, fmt, MSG_SIZE - strlen(msg_prefix) - 1);
|
||||
strcat(fmt_str, "\n");
|
||||
vfprintf(stderr, fmt_str, args);
|
||||
va_end(args);
|
||||
|
@ -171,7 +173,8 @@ int main(int argc, const char** argv) {
|
|||
const char* out_file_name = argc >= 3 ? argv[2] : NULL;
|
||||
const char* var_name = argc >= 4 ? argv[3] : NULL;
|
||||
char* computed_identifier = NULL;
|
||||
int i = 0, file_pos = 0, in_fd = -1;
|
||||
size_t i = 0;
|
||||
int file_pos = 0;
|
||||
size_t bytes_read = 0;
|
||||
unsigned char* buf = safe_malloc(BUF_SIZE);
|
||||
FILE *in_file, *out_file;
|
||||
|
@ -194,11 +197,23 @@ int main(int argc, const char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!(in_file = !in_file_name || !strcmp(in_file_name, "-") ? stdin : fopen(in_file_name, "rb")))
|
||||
die("can't open input file '%s'", in_file_name);
|
||||
if (!in_file_name || !strcmp(in_file_name, "-")) {
|
||||
in_file = stdin;
|
||||
} else {
|
||||
in_file = fopen(in_file_name, "rb");
|
||||
if (!in_file) {
|
||||
die("can't open input file '%s'", in_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(out_file = !out_file_name || !strcmp(out_file_name, "-") ? stdout : fopen(out_file_name, "w")))
|
||||
die("can't open '%s' for writing", out_file_name);
|
||||
if (!out_file_name || !strcmp(out_file_name, "-")) {
|
||||
out_file = stdout;
|
||||
} else {
|
||||
out_file = fopen(out_file_name, "w");
|
||||
if (!out_file) {
|
||||
die("can't open output file '%s'", out_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_file_name && !var_name)
|
||||
var_name = computed_identifier = file_name_to_identifier(in_file_name);
|
||||
|
@ -209,16 +224,19 @@ int main(int argc, const char** argv) {
|
|||
var_name ? var_name : "resource_data"
|
||||
);
|
||||
|
||||
in_fd = fileno(in_file);
|
||||
|
||||
while ((bytes_read = read(in_fd, buf, BUF_SIZE))) {
|
||||
bytes_read = fread(buf, 1, BUF_SIZE, in_file);
|
||||
while (bytes_read != 0) {
|
||||
for (i = 0; i < bytes_read; i++) {
|
||||
char* comma = bytes_read < BUF_SIZE && i == bytes_read - 1 ? "" : ",";
|
||||
|
||||
fprintf(out_file, "0x%02x%s", buf[i], comma);
|
||||
|
||||
if (++file_pos % 16 == 0) fputc('\n', out_file);
|
||||
file_pos++;
|
||||
if (file_pos % 16 == 0) {
|
||||
fputc('\n', out_file);
|
||||
}
|
||||
}
|
||||
bytes_read = fread(buf, 1, BUF_SIZE, in_file);
|
||||
}
|
||||
|
||||
fputs("};\n", out_file);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "wxvbam.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <wx/aboutdlg.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/numdlg.h>
|
||||
|
@ -315,29 +313,29 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA)
|
|||
wxString rom_crc32;
|
||||
rom_crc32.Printf(wxT("%08X"), panel->rom_crc32);
|
||||
SetDialogLabel(dlg, wxT("Title"), panel->rom_name, 30);
|
||||
setlabs("IntTitle", rom[0xa0], 12);
|
||||
setlabs("IntTitle", g_rom[0xa0], 12);
|
||||
SetDialogLabel(dlg, wxT("Scene"), panel->rom_scene_rls_name, 30);
|
||||
SetDialogLabel(dlg, wxT("Release"), panel->rom_scene_rls, 4);
|
||||
SetDialogLabel(dlg, wxT("CRC32"), rom_crc32, 8);
|
||||
setlabs("GameCode", rom[0xac], 4);
|
||||
setlabs("MakerCode", rom[0xb0], 2);
|
||||
setlabs("GameCode", g_rom[0xac], 4);
|
||||
setlabs("MakerCode", g_rom[0xb0], 2);
|
||||
s = dialogs::GetGameMakerName(s.ToStdString());
|
||||
setlab("MakerName");
|
||||
setblab("UnitCode", rom[0xb3]);
|
||||
s.Printf(wxT("%02x"), (unsigned int)rom[0xb4]);
|
||||
setblab("UnitCode", g_rom[0xb3]);
|
||||
s.Printf(wxT("%02x"), (unsigned int)g_rom[0xb4]);
|
||||
|
||||
if (rom[0xb4] & 0x80)
|
||||
if (g_rom[0xb4] & 0x80)
|
||||
s.append(wxT(" (DACS)"));
|
||||
|
||||
setlab("DeviceType");
|
||||
setblab("Version", rom[0xbc]);
|
||||
setblab("Version", g_rom[0xbc]);
|
||||
uint8_t crc = 0x19;
|
||||
|
||||
for (int i = 0xa0; i < 0xbd; i++)
|
||||
crc += rom[i];
|
||||
crc += g_rom[i];
|
||||
|
||||
crc = -crc;
|
||||
s.Printf(wxT("%02x (%02x)"), crc, rom[0xbd]);
|
||||
s.Printf(wxT("%02x (%02x)"), crc, g_rom[0xbd]);
|
||||
setlab("CRC");
|
||||
dlg->Fit();
|
||||
ShowModal(dlg);
|
||||
|
@ -485,12 +483,12 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import Game Shark code file...", CMDE
|
|||
if (f.Read(&slen, sizeof(slen)) != sizeof(slen) || slen > 1024) // arbitrary upper bound
|
||||
break;
|
||||
|
||||
char buf[1024];
|
||||
char buf2[1024];
|
||||
|
||||
if (f.Read(buf, slen) != slen)
|
||||
if (f.Read(buf2, slen) != slen)
|
||||
break;
|
||||
|
||||
lst->Append(wxString(buf, wxConvLibc, slen));
|
||||
lst->Append(wxString(buf2, wxConvLibc, slen));
|
||||
uint32_t ncodes;
|
||||
|
||||
if (f.Read(&ncodes, sizeof(ncodes)) != sizeof(ncodes))
|
||||
|
@ -635,7 +633,7 @@ EVT_HANDLER_MASK(ExportGamesharkSnapshot, "Export GameShark snapshot...", CMDEN_
|
|||
wxTextCtrl *tit = XRCCTRL(*infodlg, "Title", wxTextCtrl),
|
||||
*dsc = XRCCTRL(*infodlg, "Description", wxTextCtrl),
|
||||
*n = XRCCTRL(*infodlg, "Notes", wxTextCtrl);
|
||||
tit->SetValue(wxString((const char*)&rom[0xa0], wxConvLibc, 12));
|
||||
tit->SetValue(wxString((const char*)&g_rom[0xa0], wxConvLibc, 12));
|
||||
dsc->SetValue(wxDateTime::Now().Format(wxT("%c")));
|
||||
n->SetValue(_("Exported from Visual Boy Advance-M"));
|
||||
|
||||
|
@ -836,8 +834,6 @@ EVT_HANDLER_MASK(RecordAVIStopRecording, "Stop video recording", CMDEN_VREC)
|
|||
#endif
|
||||
}
|
||||
|
||||
static wxString mov_path;
|
||||
|
||||
EVT_HANDLER_MASK(RecordMovieStartRecording, "Start game recording...", CMDEN_NGREC)
|
||||
{
|
||||
static wxString mov_exts;
|
||||
|
@ -1408,8 +1404,6 @@ EVT_HANDLER_MASK(IncrGameSlotSave, "Increase state slot number and save", CMDEN_
|
|||
|
||||
EVT_HANDLER_MASK(Rewind, "Rewind", CMDEN_REWIND)
|
||||
{
|
||||
MainFrame* mf = wxGetApp().frame;
|
||||
GameArea* panel = mf->GetPanel();
|
||||
int rew_st = (panel->next_rewind_state + NUM_REWINDS - 1) % NUM_REWINDS;
|
||||
|
||||
// if within 5 seconds of last one, and > 1 state, delete last state & move back
|
||||
|
@ -2003,10 +1997,10 @@ EVT_HANDLER(GameBoyAdvanceConfigure, "Game Boy Advance options...")
|
|||
*ovmir = XRCCTRL(*dlg, "OvMirroring", wxChoice);
|
||||
|
||||
if (panel->game_type() == IMAGE_GBA) {
|
||||
wxString s = wxString((const char*)&rom[0xac], wxConvLibc, 4);
|
||||
wxString s = wxString((const char*)&g_rom[0xac], wxConvLibc, 4);
|
||||
XRCCTRL(*dlg, "GameCode", wxControl)
|
||||
->SetLabel(s);
|
||||
cmt = wxString((const char*)&rom[0xa0], wxConvLibc, 12);
|
||||
cmt = wxString((const char*)&g_rom[0xa0], wxConvLibc, 12);
|
||||
wxFileConfig* cfg = wxGetApp().overrides;
|
||||
|
||||
if (cfg->HasGroup(s)) {
|
||||
|
@ -2040,7 +2034,7 @@ EVT_HANDLER(GameBoyAdvanceConfigure, "Game Boy Advance options...")
|
|||
|
||||
if (panel->game_type() == IMAGE_GBA) {
|
||||
agbPrintEnable(OPTION(kPrefAgbPrint));
|
||||
wxString s = wxString((const char*)&rom[0xac], wxConvLibc, 4);
|
||||
wxString s = wxString((const char*)&g_rom[0xac], wxConvLibc, 4);
|
||||
wxFileConfig* cfg = wxGetApp().overrides;
|
||||
bool chg;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "../strutils.h"
|
||||
#include "opts.h"
|
||||
#include "wx/log.h"
|
||||
#include "wxlogdebug.h"
|
||||
|
||||
namespace config {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "config/option-observer.h"
|
||||
#include "config/option-proxy.h"
|
||||
#include "dialogs/validated-child.h"
|
||||
#include "widgets/group-check-box.h"
|
||||
#include "widgets/option-validator.h"
|
||||
|
||||
namespace dialogs {
|
||||
|
|
|
@ -239,7 +239,7 @@ void DirectSound::resume()
|
|||
}
|
||||
}
|
||||
|
||||
void DirectSound::write(uint16_t* finalWave, int length)
|
||||
void DirectSound::write(uint16_t* finalWave, int)
|
||||
{
|
||||
if (!pDirectSound)
|
||||
return;
|
||||
|
@ -332,7 +332,7 @@ struct devnames {
|
|||
wxArrayString *names, *ids;
|
||||
};
|
||||
|
||||
static BOOL CALLBACK DSEnumCB(LPGUID guid, LPCTSTR desc, LPCTSTR drvnam, LPVOID user)
|
||||
static BOOL CALLBACK DSEnumCB(LPGUID guid, LPCTSTR desc, LPCTSTR, LPVOID user)
|
||||
{
|
||||
devnames* dn = (devnames*)user;
|
||||
dn->names->push_back(desc);
|
||||
|
|
|
@ -48,11 +48,11 @@ public:
|
|||
getlab(prio, "Priority", "3");
|
||||
getlab(mosaic, "Mosaic", "0");
|
||||
getlab(overflow, "Overflow", "0");
|
||||
getlab(coords, "Coords", "(1023,1023)");
|
||||
getlab(addr, "Address", "0xWWWWWWWW");
|
||||
getlab(tile, "Tile", "1023");
|
||||
getlab(flip, "Flip", "HV");
|
||||
getlab(palette, "Palette", "---");
|
||||
getlab(coords_, "Coords", "(1023,1023)");
|
||||
getlab(addr_, "Address", "0xWWWWWWWW");
|
||||
getlab(tile_, "Tile", "1023");
|
||||
getlab(flip_, "Flip", "HV");
|
||||
getlab(palette_, "Palette", "---");
|
||||
Fit();
|
||||
selx = sely = -1;
|
||||
Update();
|
||||
|
@ -218,37 +218,37 @@ public:
|
|||
selx = sely = -1;
|
||||
|
||||
if (selx < 0) {
|
||||
coords->SetLabel(wxEmptyString);
|
||||
addr->SetLabel(wxEmptyString);
|
||||
tile->SetLabel(wxEmptyString);
|
||||
flip->SetLabel(wxEmptyString);
|
||||
palette->SetLabel(wxEmptyString);
|
||||
coords_->SetLabel(wxEmptyString);
|
||||
addr_->SetLabel(wxEmptyString);
|
||||
tile_->SetLabel(wxEmptyString);
|
||||
flip_->SetLabel(wxEmptyString);
|
||||
palette_->SetLabel(wxEmptyString);
|
||||
} else {
|
||||
wxString s;
|
||||
s.Printf(wxT("(%d,%d)"), selx, sely);
|
||||
coords->SetLabel(s);
|
||||
coords_->SetLabel(s);
|
||||
uint32_t address = AddressFromSel();
|
||||
s.Printf(wxT("0x%08X"), address);
|
||||
addr->SetLabel(s);
|
||||
addr_->SetLabel(s);
|
||||
|
||||
if ((!mode || (mode < 3 || mode > 5)) && bg < 2) {
|
||||
uint16_t value = *((uint16_t*)&vram[address - 0x6000000]);
|
||||
uint16_t value = *((uint16_t*)&g_vram[address - 0x6000000]);
|
||||
s.Printf(wxT("%d"), value & 1023);
|
||||
tile->SetLabel(s);
|
||||
tile_->SetLabel(s);
|
||||
s = value & 1024 ? wxT('H') : wxT('-');
|
||||
s += value & 2048 ? wxT('V') : wxT('-');
|
||||
flip->SetLabel(s);
|
||||
flip_->SetLabel(s);
|
||||
|
||||
if (control & 0x80)
|
||||
palette->SetLabel(wxT("---"));
|
||||
palette_->SetLabel(wxT("---"));
|
||||
else {
|
||||
s.Printf(wxT("%d"), (value >> 12) & 15);
|
||||
palette->SetLabel(s);
|
||||
palette_->SetLabel(s);
|
||||
}
|
||||
} else {
|
||||
tile->SetLabel(wxT("---"));
|
||||
flip->SetLabel(wxT("--"));
|
||||
palette->SetLabel(wxT("---"));
|
||||
tile_->SetLabel(wxT("---"));
|
||||
flip_->SetLabel(wxT("--"));
|
||||
palette_->SetLabel(wxT("---"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ protected:
|
|||
wxRadioButton *fr0, *fr1, *bg0, *bg1, *bg2, *bg3;
|
||||
wxControl *modelab, *mapbase, *charbase, *size, *colors, *prio, *mosaic,
|
||||
*overflow;
|
||||
wxControl *coords, *addr, *tile, *flip, *palette;
|
||||
wxControl *coords_, *addr_, *tile_, *flip_, *palette_;
|
||||
int selx, sely;
|
||||
|
||||
// following routines were copied from win32/MapView.cpp with little
|
||||
|
@ -269,9 +269,9 @@ protected:
|
|||
|
||||
void renderTextScreen()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint16_t* screenBase = (uint16_t*)&vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* charBase = &g_vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint16_t* screenBase = (uint16_t*)&g_vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint8_t* bmp = image.GetData();
|
||||
int sizeX = 256;
|
||||
int sizeY = 256;
|
||||
|
@ -440,9 +440,9 @@ protected:
|
|||
|
||||
void renderRotScreen()
|
||||
{
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint8_t* charBase = &vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint8_t* screenBase = (uint8_t*)&vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* charBase = &g_vram[((control >> 2) & 0x03) * 0x4000];
|
||||
uint8_t* screenBase = (uint8_t*)&g_vram[((control >> 8) & 0x1f) * 0x800];
|
||||
uint8_t* bmp = image.GetData();
|
||||
int sizeX = 128;
|
||||
int sizeY = 128;
|
||||
|
@ -502,7 +502,7 @@ protected:
|
|||
void renderMode3()
|
||||
{
|
||||
uint8_t* bmp = image.GetData();
|
||||
uint16_t* src = (uint16_t*)&vram[0];
|
||||
uint16_t* src = (uint16_t*)&g_vram[0];
|
||||
BMPSize(240, 160);
|
||||
|
||||
for (int y = 0; y < 160; y++) {
|
||||
|
@ -520,8 +520,8 @@ protected:
|
|||
void renderMode4()
|
||||
{
|
||||
uint8_t* bmp = image.GetData();
|
||||
uint8_t* src = frame ? &vram[0xa000] : &vram[0];
|
||||
uint16_t* pal = (uint16_t*)&paletteRAM[0];
|
||||
uint8_t* src = frame ? &g_vram[0xa000] : &g_vram[0];
|
||||
uint16_t* pal = (uint16_t*)&g_paletteRAM[0];
|
||||
BMPSize(240, 160);
|
||||
|
||||
for (int y = 0; y < 160; y++) {
|
||||
|
@ -540,7 +540,7 @@ protected:
|
|||
void renderMode5()
|
||||
{
|
||||
uint8_t* bmp = image.GetData();
|
||||
uint16_t* src = (uint16_t*)(frame ? &vram[0xa000] : &vram[0]);
|
||||
uint16_t* src = (uint16_t*)(frame ? &g_vram[0xa000] : &g_vram[0]);
|
||||
BMPSize(160, 128);
|
||||
|
||||
for (int y = 0; y < 128; y++) {
|
||||
|
@ -573,12 +573,12 @@ public:
|
|||
getradio(, "CharBase1", charbase, 0x0800);
|
||||
getradio(, "MapBase0", mapbase, 0x1800);
|
||||
getradio(, "MapBase1", mapbase, 0x1c00);
|
||||
getlab(coords, "Coords", "(2WW,2WW)");
|
||||
getlab(addr, "Address", "0xWWWW");
|
||||
getlab(tile, "Tile", "2WW");
|
||||
getlab(flip, "Flip", "HV");
|
||||
getlab(palette, "Palette", "---");
|
||||
getlab(prio, "Priority", "P");
|
||||
getlab(coords_, "Coords", "(2WW,2WW)");
|
||||
getlab(addr_, "Address", "0xWWWW");
|
||||
getlab(tile_, "Tile", "2WW");
|
||||
getlab(flip_, "Flip", "HV");
|
||||
getlab(palette_, "Palette", "---");
|
||||
getlab(prio_, "Priority", "P");
|
||||
Fit();
|
||||
selx = sely = -1;
|
||||
Update();
|
||||
|
@ -673,19 +673,19 @@ public:
|
|||
selx = sely = -1;
|
||||
|
||||
if (selx < 0) {
|
||||
coords->SetLabel(wxEmptyString);
|
||||
addr->SetLabel(wxEmptyString);
|
||||
tile->SetLabel(wxEmptyString);
|
||||
flip->SetLabel(wxEmptyString);
|
||||
palette->SetLabel(wxEmptyString);
|
||||
prio->SetLabel(wxEmptyString);
|
||||
coords_->SetLabel(wxEmptyString);
|
||||
addr_->SetLabel(wxEmptyString);
|
||||
tile_->SetLabel(wxEmptyString);
|
||||
flip_->SetLabel(wxEmptyString);
|
||||
palette_->SetLabel(wxEmptyString);
|
||||
prio_->SetLabel(wxEmptyString);
|
||||
} else {
|
||||
wxString s;
|
||||
s.Printf(wxT("(%d,%d)"), selx, sely);
|
||||
coords->SetLabel(s);
|
||||
coords_->SetLabel(s);
|
||||
uint16_t address = mapbase + 0x8000 + (sely >> 3) * 32 + (selx >> 3);
|
||||
s.Printf(wxT("0x%04X"), address);
|
||||
addr->SetLabel(s);
|
||||
addr_->SetLabel(s);
|
||||
uint8_t attrs = 0;
|
||||
uint8_t tilev = gbMemoryMap[9][address & 0xfff];
|
||||
|
||||
|
@ -702,24 +702,24 @@ public:
|
|||
}
|
||||
|
||||
s.Printf(wxT("%d"), (int)tilev);
|
||||
tile->SetLabel(s);
|
||||
tile_->SetLabel(s);
|
||||
s = attrs & 0x20 ? wxT('H') : wxT('-');
|
||||
s += attrs & 0x40 ? wxT('V') : wxT('-');
|
||||
flip->SetLabel(s);
|
||||
flip_->SetLabel(s);
|
||||
|
||||
if (gbCgbMode) {
|
||||
s.Printf(wxT("%d"), attrs & 7);
|
||||
palette->SetLabel(s);
|
||||
palette_->SetLabel(s);
|
||||
} else
|
||||
palette->SetLabel(wxT("---"));
|
||||
palette_->SetLabel(wxT("---"));
|
||||
|
||||
prio->SetLabel(wxString(attrs & 0x80 ? wxT('P') : wxT('-')));
|
||||
prio_->SetLabel(wxString(attrs & 0x80 ? wxT('P') : wxT('-')));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
int charbase, mapbase;
|
||||
wxControl *coords, *addr, *tile, *flip, *palette, *prio;
|
||||
wxControl *coords_, *addr_, *tile_, *flip_, *palette_, *prio_;
|
||||
int selx, sely;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@ -780,9 +780,9 @@ public:
|
|||
systemBlueShift = 19;
|
||||
|
||||
for (int sprite_no = 0; sprite_no < 128; sprite_no++) {
|
||||
uint16_t* sparms = &((uint16_t*)oam)[4 * sprite_no];
|
||||
uint16_t* sparms = &((uint16_t*)g_oam)[4 * sprite_no];
|
||||
uint16_t a0 = sparms[0], a1 = sparms[1], a2 = sparms[2];
|
||||
uint16_t* pal = &((uint16_t*)paletteRAM)[0x100];
|
||||
uint16_t* pal = &((uint16_t*)g_paletteRAM)[0x100];
|
||||
int sizeX = 8, sizeY = 8;
|
||||
|
||||
// following is almost verbatim from OamView.cpp
|
||||
|
@ -869,7 +869,7 @@ public:
|
|||
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint32_t color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 8 + (x >> 3) * 64 + (x & 7)) & 0x7FFF)];
|
||||
uint32_t color = g_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;
|
||||
|
@ -891,7 +891,7 @@ public:
|
|||
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
uint32_t color = vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 4 + (x >> 3) * 32 + ((x & 7) >> 1)) & 0x7FFF)];
|
||||
uint32_t color = g_vram[0x10000 + (((c + (y >> 3) * inc) * 32 + (y & 7) * 4 + (x >> 3) * 32 + ((x & 7) >> 1)) & 0x7FFF)];
|
||||
|
||||
if (x & 1)
|
||||
color >>= 4;
|
||||
|
@ -1225,8 +1225,8 @@ public:
|
|||
}
|
||||
void Update()
|
||||
{
|
||||
if (paletteRAM) {
|
||||
uint16_t* pp = (uint16_t*)paletteRAM;
|
||||
if (g_paletteRAM) {
|
||||
uint16_t* pp = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* bmp = colbmp;
|
||||
|
||||
for (int i = 0; i < 512; i++, pp++) {
|
||||
|
@ -1451,35 +1451,35 @@ public:
|
|||
TileViewer()
|
||||
: GfxViewer(wxT("TileViewer"), 32 * 8, 32 * 8)
|
||||
{
|
||||
is256 = charbase = 0;
|
||||
getradio(, "Color16", is256, 0);
|
||||
getradio(, "Color256", is256, 1);
|
||||
getradio(, "CharBase0", charbase, 0);
|
||||
getradio(, "CharBase1", charbase, 0x4000);
|
||||
getradio(, "CharBase2", charbase, 0x8000);
|
||||
getradio(, "CharBase3", charbase, 0xc000);
|
||||
getradio(, "CharBase4", charbase, 0x10000);
|
||||
getslider(, "Palette", palette);
|
||||
getlab(tileno, "Tile", "1WWW");
|
||||
getlab(addr, "Address", "06WWWWWW");
|
||||
selx = sely = -1;
|
||||
is256_ = charbase_ = 0;
|
||||
getradio(, "Color16", is256_, 0);
|
||||
getradio(, "Color256", is256_, 1);
|
||||
getradio(, "CharBase0", charbase_, 0);
|
||||
getradio(, "CharBase1", charbase_, 0x4000);
|
||||
getradio(, "CharBase2", charbase_, 0x8000);
|
||||
getradio(, "CharBase3", charbase_, 0xc000);
|
||||
getradio(, "CharBase4", charbase_, 0x10000);
|
||||
getslider(, "Palette", palette_);
|
||||
getlab(tileno_, "Tile", "1WWW");
|
||||
getlab(addr_, "Address", "06WWWWWW");
|
||||
selx_ = sely_ = -1;
|
||||
Fit();
|
||||
Update();
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
// Following copied almost verbatim from TileView.cpp
|
||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||
uint8_t* charBase = &vram[charbase];
|
||||
uint16_t* palette = (uint16_t*)g_paletteRAM;
|
||||
uint8_t* charBase = &g_vram[charbase_];
|
||||
int maxY;
|
||||
|
||||
if (is256) {
|
||||
if (is256_) {
|
||||
int tile = 0;
|
||||
maxY = 16;
|
||||
|
||||
for (int y = 0; y < maxY; y++) {
|
||||
for (int x = 0; x < 32; x++) {
|
||||
if (charbase == 4 * 0x4000)
|
||||
if (charbase_ == 4 * 0x4000)
|
||||
render256(tile, x, y, charBase, &palette[256]);
|
||||
else
|
||||
render256(tile, x, y, charBase, palette);
|
||||
|
@ -1493,7 +1493,7 @@ public:
|
|||
int tile = 0;
|
||||
maxY = 32;
|
||||
|
||||
if (charbase == 3 * 0x4000)
|
||||
if (charbase_ == 3 * 0x4000)
|
||||
maxY = 16;
|
||||
|
||||
for (int y = 0; y < maxY; y++) {
|
||||
|
@ -1511,32 +1511,32 @@ public:
|
|||
}
|
||||
void UpdateMouseInfoEv(wxMouseEvent& ev)
|
||||
{
|
||||
selx = ev.GetX();
|
||||
sely = ev.GetY();
|
||||
selx_ = ev.GetX();
|
||||
sely_ = ev.GetY();
|
||||
UpdateMouseInfo();
|
||||
}
|
||||
|
||||
void UpdateMouseInfo()
|
||||
{
|
||||
if (selx > gv->bmw || sely > gv->bmh)
|
||||
selx = sely = -1;
|
||||
if (selx_ > gv->bmw || sely_ > gv->bmh)
|
||||
selx_ = sely_ = -1;
|
||||
|
||||
if (selx < 0) {
|
||||
addr->SetLabel(wxEmptyString);
|
||||
tileno->SetLabel(wxEmptyString);
|
||||
if (selx_ < 0) {
|
||||
addr_->SetLabel(wxEmptyString);
|
||||
tileno_->SetLabel(wxEmptyString);
|
||||
} else {
|
||||
int x = selx / 8;
|
||||
int y = sely / 8;
|
||||
int x = selx_ / 8;
|
||||
int y = sely_ / 8;
|
||||
int t = 32 * y + x;
|
||||
|
||||
if (is256)
|
||||
if (is256_)
|
||||
t *= 2;
|
||||
|
||||
wxString s;
|
||||
s.Printf(wxT("%d"), t);
|
||||
tileno->SetLabel(s);
|
||||
s.Printf(wxT("%08X"), 0x6000000 + charbase + 32 * t);
|
||||
addr->SetLabel(s);
|
||||
tileno_->SetLabel(s);
|
||||
s.Printf(wxT("%08X"), 0x6000000 + charbase_ + 32 * t);
|
||||
addr_->SetLabel(s);
|
||||
}
|
||||
}
|
||||
// following 2 functions copied almost verbatim from TileView.cpp
|
||||
|
@ -1560,9 +1560,9 @@ public:
|
|||
void render16(int tile, int x, int y, uint8_t* charBase, uint16_t* palette)
|
||||
{
|
||||
uint8_t* bmp = &image.GetData()[24 * x + 8 * 32 * 24 * y];
|
||||
int pal = this->palette;
|
||||
int pal = this->palette_;
|
||||
|
||||
if (this->charbase == 4 * 0x4000)
|
||||
if (this->charbase_ == 4 * 0x4000)
|
||||
pal += 16;
|
||||
|
||||
for (int j = 0; j < 8; j++) {
|
||||
|
@ -1624,9 +1624,9 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
int charbase, is256, palette;
|
||||
wxControl *tileno, *addr;
|
||||
int selx, sely;
|
||||
int charbase_, is256_, palette_;
|
||||
wxControl *tileno_, *addr_;
|
||||
int selx_, sely_;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -992,13 +992,13 @@ public:
|
|||
block->size = 0x40000;
|
||||
block->offset = 0x2000000;
|
||||
block->bits = (uint8_t*)malloc(0x40000 >> 3);
|
||||
block->data = workRAM;
|
||||
block->data = g_workRAM;
|
||||
block->saved = (uint8_t*)malloc(0x40000);
|
||||
block++;
|
||||
block->size = 0x8000;
|
||||
block->offset = 0x3000000;
|
||||
block->bits = (uint8_t*)malloc(0x8000 >> 3);
|
||||
block->data = internalRAM;
|
||||
block->data = g_internalRAM;
|
||||
block->saved = (uint8_t*)malloc(0x8000);
|
||||
}
|
||||
|
||||
|
@ -1460,7 +1460,7 @@ public:
|
|||
type->SetSelection(coreOptions.saveType);
|
||||
|
||||
if (coreOptions.saveType == GBA_SAVE_FLASH) {
|
||||
size->SetSelection(flashSize == 0x20000 ? 1 : 0);
|
||||
size->SetSelection(g_flashSize == 0x20000 ? 1 : 0);
|
||||
size->Enable();
|
||||
} else {
|
||||
size->Disable();
|
||||
|
|
|
@ -312,20 +312,20 @@ void GameArea::LoadGame(const wxString& name)
|
|||
return;
|
||||
}
|
||||
|
||||
rom_crc32 = crc32(0L, rom, rom_size);
|
||||
rom_crc32 = crc32(0L, g_rom, rom_size);
|
||||
|
||||
if (loadpatch) {
|
||||
// don't use real rom size or it might try to resize rom[]
|
||||
// instead, use known size of rom[]
|
||||
int size = 0x2000000 < rom_size ? 0x2000000 : rom_size;
|
||||
applyPatch(UTF8(pfn.GetFullPath()), &rom, &size);
|
||||
applyPatch(UTF8(pfn.GetFullPath()), &g_rom, &size);
|
||||
// that means we no longer really know rom_size either <sigh>
|
||||
|
||||
gbaUpdateRomSize(size);
|
||||
}
|
||||
|
||||
wxFileConfig* cfg = wxGetApp().overrides;
|
||||
wxString id = wxString((const char*)&rom[0xac], wxConvLibc, 4);
|
||||
wxString id = wxString((const char*)&g_rom[0xac], wxConvLibc, 4);
|
||||
|
||||
if (cfg->HasGroup(id)) {
|
||||
cfg->SetPath(id);
|
||||
|
|
|
@ -81,7 +81,7 @@ void systemSendScreen()
|
|||
{
|
||||
#ifndef NO_FFMPEG
|
||||
GameArea* ga = wxGetApp().frame->GetPanel();
|
||||
if (ga) ga->AddFrame(pix);
|
||||
if (ga) ga->AddFrame(g_pix);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -97,12 +97,12 @@ void systemDrawScreen()
|
|||
#ifndef NO_FFMPEG
|
||||
|
||||
if (ga)
|
||||
ga->AddFrame(pix);
|
||||
ga->AddFrame(g_pix);
|
||||
|
||||
#endif
|
||||
|
||||
if (ga && ga->panel)
|
||||
ga->panel->DrawArea(&pix);
|
||||
ga->panel->DrawArea(&g_pix);
|
||||
}
|
||||
|
||||
// record a game "movie"
|
||||
|
@ -275,7 +275,7 @@ void systemStartGamePlayback(const wxString& fname, MVFormatID format)
|
|||
if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false))
|
||||
fn.append(wxT(".vmv"));
|
||||
|
||||
uint32_t version;
|
||||
uint32_t version = 0;
|
||||
|
||||
if (!game_file.Open(fn, wxT("rb")) || game_file.Read(&version, sizeof(version)) != sizeof(version) || wxUINT32_SWAP_ON_BE(version) < 1 || wxUINT32_SWAP_ON_BE(version) > 2) {
|
||||
wxLogError(_("Cannot open recording file %s"), fname.c_str());
|
||||
|
|
|
@ -4,8 +4,11 @@
|
|||
|
||||
#include "../common/cstdint.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/vlbox.h>
|
||||
|
||||
#include "../gba/armdis.h"
|
||||
#include "config/option-proxy.h"
|
||||
#include "keep-on-top-styler.h"
|
||||
|
@ -363,18 +366,18 @@ public:
|
|||
baddialog();
|
||||
}
|
||||
|
||||
addr = XRCCTRL(*this, "Address", wxChoice);
|
||||
addr_ = XRCCTRL(*this, "Address", wxChoice);
|
||||
val = XRCCTRL(*this, "Value", wxControl);
|
||||
|
||||
if (!addr || !val)
|
||||
if (!addr_ || !val)
|
||||
baddialog();
|
||||
|
||||
addr->Clear();
|
||||
addr_->Clear();
|
||||
wxString longline = lline;
|
||||
int lwidth = 0;
|
||||
|
||||
for (long unsigned int i = 0; i < NUM_IOREGS; i++) {
|
||||
addr->Append(wxGetTranslation(ioregs[i].name));
|
||||
addr_->Append(wxGetTranslation(ioregs[i].name));
|
||||
|
||||
// find longest label
|
||||
// this is probably horribly expensive
|
||||
|
@ -401,14 +404,14 @@ public:
|
|||
|
||||
bitlab[0]->SetLabel(lline);
|
||||
Fit();
|
||||
addr->SetSelection(0);
|
||||
addr_->SetSelection(0);
|
||||
Select(0);
|
||||
}
|
||||
|
||||
void SelectEv(wxCommandEvent& ev)
|
||||
{
|
||||
(void)ev; // unused params
|
||||
Select(addr->GetSelection());
|
||||
Select(addr_->GetSelection());
|
||||
}
|
||||
|
||||
void Select(int sel)
|
||||
|
@ -424,14 +427,11 @@ public:
|
|||
Update(sel);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
Update(addr->GetSelection());
|
||||
}
|
||||
void Update() { Update(addr_->GetSelection()); }
|
||||
|
||||
void Update(int sel)
|
||||
{
|
||||
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&ioMem[ioregs[sel].offset];
|
||||
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&g_ioMem[ioregs[sel].offset];
|
||||
uint16_t mask, reg = *addr;
|
||||
int i;
|
||||
|
||||
|
@ -474,8 +474,8 @@ public:
|
|||
void Apply(wxCommandEvent& ev)
|
||||
{
|
||||
(void)ev; // unused params
|
||||
int sel = addr->GetSelection();
|
||||
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&ioMem[ioregs[sel].offset];
|
||||
int sel = addr_->GetSelection();
|
||||
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&g_ioMem[ioregs[sel].offset];
|
||||
uint16_t mask, reg = *addr;
|
||||
reg &= ~ioregs[sel].write;
|
||||
int i;
|
||||
|
@ -490,7 +490,7 @@ public:
|
|||
}
|
||||
|
||||
static wxString lline;
|
||||
wxChoice* addr;
|
||||
wxChoice* addr_;
|
||||
wxControl* val;
|
||||
wxCheckBox* bit[16];
|
||||
wxControl* bitlab[16];
|
||||
|
@ -614,11 +614,15 @@ public:
|
|||
MemViewerBase(uint32_t max)
|
||||
: Viewer(wxT("MemViewer"))
|
||||
{
|
||||
if (!(mv = XRCCTRL(*this, "MemView", MemView)))
|
||||
mv = XRCCTRL(*this, "MemView", MemView);
|
||||
if (!mv) {
|
||||
baddialog();
|
||||
}
|
||||
|
||||
if (!(bs = XRCCTRL(*this, "BlockStart", wxChoice)))
|
||||
bs = XRCCTRL(*this, "BlockStart", wxChoice);
|
||||
if (bs) {
|
||||
baddialog();
|
||||
}
|
||||
|
||||
bs->Append(wxT(""));
|
||||
bs->SetFocus();
|
||||
|
@ -809,9 +813,7 @@ END_EVENT_TABLE()
|
|||
|
||||
class MemViewer : public MemViewerBase {
|
||||
public:
|
||||
MemViewer()
|
||||
: MemViewerBase(~0)
|
||||
{
|
||||
MemViewer() : MemViewerBase(std::numeric_limits<uint32_t>::max()) {
|
||||
bs->Append("0x00000000 - BIOS");
|
||||
bs->Append("0x02000000 - WRAM");
|
||||
bs->Append("0x03000000 - IRAM");
|
||||
|
|
|
@ -540,9 +540,9 @@ void MemView::KeyEvent(wxKeyEvent& ev)
|
|||
}
|
||||
|
||||
// write value; this will not return until value has been written
|
||||
wxCommandEvent ev(EVT_WRITEVAL, GetId());
|
||||
ev.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(ev);
|
||||
wxCommandEvent new_event(EVT_WRITEVAL, GetId());
|
||||
new_event.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(new_event);
|
||||
// now refresh whole screen. Really need to make this more
|
||||
// efficient some day
|
||||
Repaint();
|
||||
|
@ -766,9 +766,9 @@ DEFINE_EVENT_TYPE(EVT_WRITEVAL)
|
|||
ColorView::ColorView(wxWindow* parent, wxWindowID id)
|
||||
// default for MSW appears to be BORDER_SUNKEN
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE),
|
||||
r(0),
|
||||
g(0),
|
||||
b(0)
|
||||
r_(0),
|
||||
g_(0),
|
||||
b_(0)
|
||||
{
|
||||
wxBoxSizer* sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
cp = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(75, 75),
|
||||
|
@ -1107,23 +1107,28 @@ GfxViewer::GfxViewer(const wxString& dname, int maxw, int maxh)
|
|||
, image(maxw, maxh)
|
||||
{
|
||||
gv = XRCCTRL(*this, "GfxView", GfxPanel);
|
||||
|
||||
if (!gv || !(gvs = dynamic_cast<wxScrolledWindow*>(gv->GetParent())))
|
||||
if (!gv) {
|
||||
baddialog();
|
||||
}
|
||||
|
||||
gvs->SetMinSize(gvs->GetSize());
|
||||
gvs->SetScrollRate(1, 1);
|
||||
gvs_ = dynamic_cast<wxScrolledWindow*>(gv->GetParent());
|
||||
if (!gvs_) {
|
||||
baddialog();
|
||||
}
|
||||
|
||||
gvs_->SetMinSize(gvs_->GetSize());
|
||||
gvs_->SetScrollRate(1, 1);
|
||||
gv->SetSize(maxw, maxh);
|
||||
gvs->SetVirtualSize(maxw, maxh);
|
||||
gvs_->SetVirtualSize(maxw, maxh);
|
||||
gv->im = ℑ
|
||||
gv->bmw = maxw;
|
||||
gv->bmh = maxh;
|
||||
ColorView* cv;
|
||||
colorctrl(cv, "Color");
|
||||
pixview(gv->pv, "Zoom", 8, 8, cv);
|
||||
str = XRCCTRL(*this, "Stretch", wxCheckBox);
|
||||
str_ = XRCCTRL(*this, "Stretch", wxCheckBox);
|
||||
|
||||
if (!str)
|
||||
if (!str_)
|
||||
baddialog();
|
||||
}
|
||||
|
||||
|
@ -1140,9 +1145,9 @@ void GfxViewer::BMPSize(int w, int h)
|
|||
gv->bmw = w;
|
||||
gv->bmh = h;
|
||||
|
||||
if (!str->GetValue()) {
|
||||
if (!str_->GetValue()) {
|
||||
gv->SetSize(w, h);
|
||||
gvs->SetVirtualSize(gv->GetSize());
|
||||
gvs_->SetVirtualSize(gv->GetSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1152,23 +1157,23 @@ void GfxViewer::StretchTog(wxCommandEvent& ev)
|
|||
(void)ev; // unused params
|
||||
wxSize sz;
|
||||
|
||||
if (str->GetValue()) {
|
||||
if (str_->GetValue()) {
|
||||
// first time to remove scrollbars
|
||||
gvs->SetVirtualSize(gvs->GetClientSize());
|
||||
gvs_->SetVirtualSize(gvs_->GetClientSize());
|
||||
// second time to expand to outer edges
|
||||
sz = gvs->GetClientSize();
|
||||
sz = gvs_->GetClientSize();
|
||||
} else
|
||||
sz = wxSize(gv->bmw, gv->bmh);
|
||||
|
||||
gv->SetSize(sz);
|
||||
gvs->SetVirtualSize(sz);
|
||||
gvs_->SetVirtualSize(sz);
|
||||
}
|
||||
|
||||
void GfxViewer::SaveBMP(wxCommandEvent& ev)
|
||||
{
|
||||
(void)ev; // unused params
|
||||
GameArea* panel = wxGetApp().frame->GetPanel();
|
||||
bmp_save_dir = wxGetApp().frame->GetGamePath(OPTION(kGenScreenshotDir));
|
||||
bmp_save_dir_ = wxGetApp().frame->GetGamePath(OPTION(kGenScreenshotDir));
|
||||
// no attempt is made here to translate the dialog type name
|
||||
// it's just a suggested name, anyway
|
||||
wxString def_name = panel->game_name() + wxT('-') + dname;
|
||||
|
@ -1180,11 +1185,11 @@ void GfxViewer::SaveBMP(wxCommandEvent& ev)
|
|||
else
|
||||
def_name.append(".bmp");
|
||||
|
||||
wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir, def_name,
|
||||
wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir_, def_name,
|
||||
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
dlg.SetFilterIndex(capture_format);
|
||||
int ret = dlg.ShowModal();
|
||||
bmp_save_dir = dlg.GetDirectory();
|
||||
bmp_save_dir_ = dlg.GetDirectory();
|
||||
|
||||
if (ret != wxID_OK)
|
||||
return;
|
||||
|
@ -1209,7 +1214,7 @@ void GfxViewer::RefreshEv(wxCommandEvent& ev)
|
|||
Update();
|
||||
}
|
||||
|
||||
wxString GfxViewer::bmp_save_dir = wxEmptyString;
|
||||
wxString GfxViewer::bmp_save_dir_ = wxEmptyString;
|
||||
|
||||
BEGIN_EVENT_TABLE(GfxViewer, Viewer)
|
||||
EVT_CHECKBOX(XRCID("Stretch"), GfxViewer::StretchTog)
|
||||
|
|
|
@ -253,13 +253,13 @@ public:
|
|||
void SetRGB(int r, int g, int b);
|
||||
void GetRGB(int& _r, int& _g, int& _b)
|
||||
{
|
||||
_r = r;
|
||||
_g = g;
|
||||
_b = b;
|
||||
_r = r_;
|
||||
_g = g_;
|
||||
_b = b_;
|
||||
}
|
||||
|
||||
protected:
|
||||
int r, g, b;
|
||||
int r_, g_, b_;
|
||||
wxPanel* cp;
|
||||
wxStaticText *rt, *gt, *bt;
|
||||
};
|
||||
|
@ -385,9 +385,9 @@ protected:
|
|||
GfxPanel* gv;
|
||||
|
||||
private:
|
||||
static wxString bmp_save_dir;
|
||||
wxScrolledWindow* gvs;
|
||||
wxCheckBox* str;
|
||||
static wxString bmp_save_dir_;
|
||||
wxScrolledWindow* gvs_;
|
||||
wxCheckBox* str_;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId)
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole, LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
if (flow == eRender && last_device.compare(pwstrDeviceId) != 0) {
|
||||
last_device = pwstrDeviceId;
|
||||
|
@ -148,10 +148,10 @@ public:
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR, DWORD) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR, const PROPERTYKEY) { return S_OK; }
|
||||
|
||||
void do_register(XAudio2_Output* p_instance)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
}
|
||||
|
||||
STDMETHOD_(void, OnBufferEnd)
|
||||
(void* pBufferContext)
|
||||
(void*)
|
||||
{
|
||||
assert(hBufferEndEvent != NULL);
|
||||
SetEvent(hBufferEndEvent);
|
||||
|
@ -219,17 +219,17 @@ public:
|
|||
|
||||
// dummies:
|
||||
STDMETHOD_(void, OnVoiceProcessingPassStart)
|
||||
(UINT32 BytesRequired) {}
|
||||
(UINT32) {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassEnd)
|
||||
() {}
|
||||
STDMETHOD_(void, OnStreamEnd)
|
||||
() {}
|
||||
STDMETHOD_(void, OnBufferStart)
|
||||
(void* pBufferContext) {}
|
||||
(void*) {}
|
||||
STDMETHOD_(void, OnLoopEnd)
|
||||
(void* pBufferContext) {}
|
||||
(void*) {}
|
||||
STDMETHOD_(void, OnVoiceError)
|
||||
(void* pBufferContext, HRESULT Error){};
|
||||
(void*, HRESULT){};
|
||||
};
|
||||
|
||||
// Class Declaration
|
||||
|
@ -512,7 +512,7 @@ bool XAudio2_Output::init(long sampleRate)
|
|||
return true;
|
||||
}
|
||||
|
||||
void XAudio2_Output::write(uint16_t* finalWave, int length)
|
||||
void XAudio2_Output::write(uint16_t* finalWave, int)
|
||||
{
|
||||
if (!initialized || failed)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue