gb folder is done, next up gba, once this is all up I'm going to look at enhancing the cores
This commit is contained in:
parent
1f37311a4a
commit
1944613131
|
@ -1,7 +1,7 @@
|
|||
#include "../common/Types.h"
|
||||
#include <cstdlib>
|
||||
|
||||
u8* gbMemoryMap[16];
|
||||
uint8_t* gbMemoryMap[16];
|
||||
|
||||
int gbRomSizeMask = 0;
|
||||
int gbRomSize = 0;
|
||||
|
@ -9,24 +9,24 @@ int gbRamSizeMask = 0;
|
|||
int gbRamSize = 0;
|
||||
int gbTAMA5ramSize = 0;
|
||||
|
||||
u8* gbMemory = NULL;
|
||||
u8* gbVram = NULL;
|
||||
u8* gbRom = NULL;
|
||||
u8* gbRam = NULL;
|
||||
u8* gbWram = NULL;
|
||||
u16* gbLineBuffer = NULL;
|
||||
u8* gbTAMA5ram = NULL;
|
||||
uint8_t* gbMemory = NULL;
|
||||
uint8_t* gbVram = NULL;
|
||||
uint8_t* gbRom = NULL;
|
||||
uint8_t* gbRam = NULL;
|
||||
uint8_t* gbWram = NULL;
|
||||
uint16_t* gbLineBuffer = NULL;
|
||||
uint8_t* gbTAMA5ram = NULL;
|
||||
|
||||
u16 gbPalette[128];
|
||||
u8 gbBgp[4] = { 0, 1, 2, 3 };
|
||||
u8 gbObp0[4] = { 0, 1, 2, 3 };
|
||||
u8 gbObp1[4] = { 0, 1, 2, 3 };
|
||||
uint16_t gbPalette[128];
|
||||
uint8_t gbBgp[4] = { 0, 1, 2, 3 };
|
||||
uint8_t gbObp0[4] = { 0, 1, 2, 3 };
|
||||
uint8_t gbObp1[4] = { 0, 1, 2, 3 };
|
||||
int gbWindowLine = -1;
|
||||
|
||||
bool genericflashcardEnable = false;
|
||||
int gbCgbMode = 0;
|
||||
|
||||
u16 gbColorFilter[32768];
|
||||
uint16_t gbColorFilter[32768];
|
||||
int gbColorOption = 0;
|
||||
int gbPaletteOption = 0;
|
||||
int gbEmulatorType = 0;
|
||||
|
@ -37,4 +37,4 @@ int gbBorderRowSkip = 0;
|
|||
int gbBorderColumnSkip = 0;
|
||||
int gbDmaTicks = 0;
|
||||
|
||||
u8 (*gbSerialFunction)(u8) = NULL;
|
||||
uint8_t (*gbSerialFunction)(uint8_t) = NULL;
|
||||
|
|
|
@ -7,20 +7,20 @@ extern int gbRamSize;
|
|||
extern int gbRamSizeMask;
|
||||
extern int gbTAMA5ramSize;
|
||||
|
||||
extern u8* bios;
|
||||
extern uint8_t* bios;
|
||||
|
||||
extern u8* gbRom;
|
||||
extern u8* gbRam;
|
||||
extern u8* gbVram;
|
||||
extern u8* gbWram;
|
||||
extern u8* gbMemory;
|
||||
extern u16* gbLineBuffer;
|
||||
extern u8* gbTAMA5ram;
|
||||
extern uint8_t* gbRom;
|
||||
extern uint8_t* gbRam;
|
||||
extern uint8_t* gbVram;
|
||||
extern uint8_t* gbWram;
|
||||
extern uint8_t* gbMemory;
|
||||
extern uint16_t* gbLineBuffer;
|
||||
extern uint8_t* gbTAMA5ram;
|
||||
|
||||
extern u8* gbMemoryMap[16];
|
||||
extern uint8_t* gbMemoryMap[16];
|
||||
|
||||
extern int gbFrameSkip;
|
||||
extern u16 gbColorFilter[32768];
|
||||
extern uint16_t gbColorFilter[32768];
|
||||
extern int gbColorOption;
|
||||
extern int gbPaletteOption;
|
||||
extern int gbEmulatorType;
|
||||
|
@ -30,32 +30,32 @@ extern int gbCgbMode;
|
|||
extern int gbSgbMode;
|
||||
extern int gbWindowLine;
|
||||
extern int gbSpeed;
|
||||
extern u8 gbBgp[4];
|
||||
extern u8 gbObp0[4];
|
||||
extern u8 gbObp1[4];
|
||||
extern u16 gbPalette[128];
|
||||
extern uint8_t gbBgp[4];
|
||||
extern uint8_t gbObp0[4];
|
||||
extern uint8_t gbObp1[4];
|
||||
extern uint16_t gbPalette[128];
|
||||
extern bool gbScreenOn;
|
||||
extern bool gbDrawWindow;
|
||||
extern u8 gbSCYLine[300];
|
||||
extern uint8_t gbSCYLine[300];
|
||||
// gbSCXLine is used for the emulation (bug) of the SX change
|
||||
// found in the Artic Zone game.
|
||||
extern u8 gbSCXLine[300];
|
||||
extern uint8_t gbSCXLine[300];
|
||||
// gbBgpLine is used for the emulation of the
|
||||
// Prehistorik Man's title screen scroller.
|
||||
extern u8 gbBgpLine[300];
|
||||
extern u8 gbObp0Line[300];
|
||||
extern u8 gbObp1Line[300];
|
||||
extern uint8_t gbBgpLine[300];
|
||||
extern uint8_t gbObp0Line[300];
|
||||
extern uint8_t gbObp1Line[300];
|
||||
// gbSpritesTicks is used for the emulation of Parodius' Laser Beam.
|
||||
extern u8 gbSpritesTicks[300];
|
||||
extern uint8_t gbSpritesTicks[300];
|
||||
|
||||
extern u8 register_LCDC;
|
||||
extern u8 register_LY;
|
||||
extern u8 register_SCY;
|
||||
extern u8 register_SCX;
|
||||
extern u8 register_WY;
|
||||
extern u8 register_WX;
|
||||
extern u8 register_VBK;
|
||||
extern u8 oldRegister_WY;
|
||||
extern uint8_t register_LCDC;
|
||||
extern uint8_t register_LY;
|
||||
extern uint8_t register_SCY;
|
||||
extern uint8_t register_SCX;
|
||||
extern uint8_t register_WY;
|
||||
extern uint8_t register_WX;
|
||||
extern uint8_t register_VBK;
|
||||
extern uint8_t oldRegister_WY;
|
||||
|
||||
extern int emulating;
|
||||
extern bool genericflashcardEnable;
|
||||
|
@ -68,6 +68,6 @@ extern int gbDmaTicks;
|
|||
extern void gbRenderLine();
|
||||
extern void gbDrawSprites(bool);
|
||||
|
||||
extern u8 (*gbSerialFunction)(u8);
|
||||
extern uint8_t (*gbSerialFunction)(uint8_t);
|
||||
|
||||
#endif // GBGLOBALS_H
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include "../common/Port.h"
|
||||
#include "gb.h"
|
||||
#include "gbGlobals.h"
|
||||
u8 gbDaysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const u8 gbDisabledRam[8] = { 0x80, 0xff, 0xf0, 0x00, 0x30, 0xbf, 0xbf, 0xbf };
|
||||
uint8_t gbDaysinMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const uint8_t gbDisabledRam[8] = { 0x80, 0xff, 0xf0, 0x00, 0x30, 0xbf, 0xbf, 0xbf };
|
||||
extern int gbGBCColorType;
|
||||
extern gbRegister PC;
|
||||
|
||||
|
@ -19,7 +19,7 @@ mapperMBC1 gbDataMBC1 = {
|
|||
};
|
||||
|
||||
// MBC1 ROM write registers
|
||||
void mapperMBC1ROM(u16 address, u8 value)
|
||||
void mapperMBC1ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -153,7 +153,7 @@ void mapperMBC1ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC1 RAM write
|
||||
void mapperMBC1RAM(u16 address, u8 value)
|
||||
void mapperMBC1RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (gbDataMBC1.mapperRAMEnable) {
|
||||
if (gbRamSize) {
|
||||
|
@ -164,7 +164,7 @@ void mapperMBC1RAM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC1 read RAM
|
||||
u8 mapperMBC1ReadRAM(u16 address)
|
||||
uint8_t mapperMBC1ReadRAM(uint16_t address)
|
||||
{
|
||||
|
||||
if (gbDataMBC1.mapperRAMEnable)
|
||||
|
@ -237,7 +237,7 @@ mapperMBC2 gbDataMBC2 = {
|
|||
};
|
||||
|
||||
// MBC2 ROM write registers
|
||||
void mapperMBC2ROM(u16 address, u8 value)
|
||||
void mapperMBC2ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
switch (address & 0x6000) {
|
||||
case 0x0000: // RAM enable
|
||||
|
@ -269,7 +269,7 @@ void mapperMBC2ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC2 RAM write
|
||||
void mapperMBC2RAM(u16 address, u8 value)
|
||||
void mapperMBC2RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (gbDataMBC2.mapperRAMEnable) {
|
||||
if (gbRamSize && address < 0xa200) {
|
||||
|
@ -353,7 +353,7 @@ void memoryUpdateMBC3Clock()
|
|||
}
|
||||
|
||||
// MBC3 ROM write registers
|
||||
void mapperMBC3ROM(u16 address, u8 value)
|
||||
void mapperMBC3ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -412,7 +412,7 @@ void mapperMBC3ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC3 RAM write
|
||||
void mapperMBC3RAM(u16 address, u8 value)
|
||||
void mapperMBC3RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (gbDataMBC3.mapperRAMEnable) {
|
||||
if (gbDataMBC3.mapperRAMBank != -1) {
|
||||
|
@ -447,7 +447,7 @@ void mapperMBC3RAM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC3 read RAM
|
||||
u8 mapperMBC3ReadRAM(u16 address)
|
||||
uint8_t mapperMBC3ReadRAM(uint16_t address)
|
||||
{
|
||||
if (gbDataMBC3.mapperRAMEnable) {
|
||||
if (gbDataMBC3.mapperRAMBank != -1) {
|
||||
|
@ -520,7 +520,7 @@ mapperMBC5 gbDataMBC5 = {
|
|||
};
|
||||
|
||||
// MBC5 ROM write registers
|
||||
void mapperMBC5ROM(u16 address, u8 value)
|
||||
void mapperMBC5ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -580,7 +580,7 @@ void mapperMBC5ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC5 RAM write
|
||||
void mapperMBC5RAM(u16 address, u8 value)
|
||||
void mapperMBC5RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (gbDataMBC5.mapperRAMEnable) {
|
||||
if (gbRamSize) {
|
||||
|
@ -591,7 +591,7 @@ void mapperMBC5RAM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC5 read RAM
|
||||
u8 mapperMBC5ReadRAM(u16 address)
|
||||
uint8_t mapperMBC5ReadRAM(uint16_t address)
|
||||
{
|
||||
|
||||
if (gbDataMBC5.mapperRAMEnable)
|
||||
|
@ -652,7 +652,7 @@ mapperMBC7 gbDataMBC7 = {
|
|||
};
|
||||
|
||||
// MBC7 ROM write registers
|
||||
void mapperMBC7ROM(u16 address, u8 value)
|
||||
void mapperMBC7ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -694,7 +694,7 @@ void mapperMBC7ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MBC7 read RAM
|
||||
u8 mapperMBC7ReadRAM(u16 address)
|
||||
uint8_t mapperMBC7ReadRAM(uint16_t address)
|
||||
{
|
||||
switch (address & 0xa0f0) {
|
||||
case 0xa000:
|
||||
|
@ -738,7 +738,7 @@ u8 mapperMBC7ReadRAM(u16 address)
|
|||
}
|
||||
|
||||
// MBC7 RAM write
|
||||
void mapperMBC7RAM(u16 address, u8 value)
|
||||
void mapperMBC7RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (address == 0xa080) {
|
||||
// special processing needed
|
||||
|
@ -827,7 +827,7 @@ void mapperMBC7RAM(u16 address, u8 value)
|
|||
} else if ((gbDataMBC7.address >> 6) == 2) {
|
||||
if (gbDataMBC7.writeEnable) {
|
||||
for (int i = 0; i < 256; i++)
|
||||
WRITE16LE((u16*)&gbMemory[0xa000 + i * 2], 0xffff);
|
||||
WRITE16LE((uint16_t*)&gbMemory[0xa000 + i * 2], 0xffff);
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
|
||||
}
|
||||
gbDataMBC7.state = 5;
|
||||
|
@ -901,7 +901,7 @@ mapperHuC1 gbDataHuC1 = {
|
|||
};
|
||||
|
||||
// HuC1 ROM write registers
|
||||
void mapperHuC1ROM(u16 address, u8 value)
|
||||
void mapperHuC1ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -956,7 +956,7 @@ void mapperHuC1ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// HuC1 RAM write
|
||||
void mapperHuC1RAM(u16 address, u8 value)
|
||||
void mapperHuC1RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (gbDataHuC1.mapperRAMEnable) {
|
||||
if (gbRamSize) {
|
||||
|
@ -995,7 +995,7 @@ mapperHuC3 gbDataHuC3 = {
|
|||
};
|
||||
|
||||
// HuC3 ROM write registers
|
||||
void mapperHuC3ROM(u16 address, u8 value)
|
||||
void mapperHuC3ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -1039,7 +1039,7 @@ void mapperHuC3ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// HuC3 read RAM
|
||||
u8 mapperHuC3ReadRAM(u16 address)
|
||||
uint8_t mapperHuC3ReadRAM(uint16_t address)
|
||||
{
|
||||
if (gbDataHuC3.mapperRAMFlag > 0x0b && gbDataHuC3.mapperRAMFlag < 0x0e) {
|
||||
if (gbDataHuC3.mapperRAMFlag != 0x0c)
|
||||
|
@ -1050,7 +1050,7 @@ u8 mapperHuC3ReadRAM(u16 address)
|
|||
}
|
||||
|
||||
// HuC3 RAM write
|
||||
void mapperHuC3RAM(u16 address, u8 value)
|
||||
void mapperHuC3RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int* p;
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ void memoryUpdateTAMA5Clock()
|
|||
}
|
||||
|
||||
// TAMA5 RAM write
|
||||
void mapperTAMA5RAM(u16 address, u8 value)
|
||||
void mapperTAMA5RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if ((address & 0xffff) <= 0xa001) {
|
||||
switch (address & 1) {
|
||||
|
@ -1390,7 +1390,7 @@ void mapperTAMA5RAM(u16 address, u8 value)
|
|||
if ((value & 0x0e) == 0x0c) {
|
||||
gbDataTAMA5.mapperRamByteSelect = gbDataTAMA5.mapperCommands[6] | (gbDataTAMA5.mapperCommands[7] << 4);
|
||||
|
||||
u8 byte = gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect];
|
||||
uint8_t byte = gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect];
|
||||
|
||||
gbMemoryMap[0xa][0] = (value & 1) ? byte >> 4 : byte & 0x0f;
|
||||
|
||||
|
@ -1413,7 +1413,7 @@ void mapperTAMA5RAM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// TAMA5 read RAM
|
||||
u8 mapperTAMA5ReadRAM(u16 address)
|
||||
uint8_t mapperTAMA5ReadRAM(uint16_t address)
|
||||
{
|
||||
return gbMemoryMap[address >> 12][address & 0xfff];
|
||||
}
|
||||
|
@ -1448,7 +1448,7 @@ mapperMMM01 gbDataMMM01 = {
|
|||
};
|
||||
|
||||
// MMM01 ROM write registers
|
||||
void mapperMMM01ROM(u16 address, u8 value)
|
||||
void mapperMMM01ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ void mapperMMM01ROM(u16 address, u8 value)
|
|||
}
|
||||
|
||||
// MMM01 RAM write
|
||||
void mapperMMM01RAM(u16 address, u8 value)
|
||||
void mapperMMM01RAM(uint16_t address, uint8_t value)
|
||||
{
|
||||
if (gbDataMMM01.mapperRAMEnable) {
|
||||
if (gbRamSize) {
|
||||
|
@ -1558,7 +1558,7 @@ void memoryUpdateMapMMM01()
|
|||
}
|
||||
|
||||
// GameGenie ROM write registers
|
||||
void mapperGGROM(u16 address, u8 value)
|
||||
void mapperGGROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
switch (address & 0x6000) {
|
||||
case 0x0000: // RAM enable register
|
||||
|
@ -1577,7 +1577,7 @@ void mapperGGROM(u16 address, u8 value)
|
|||
// GS3 Used to emulate the GS V3.0 rom bank switching
|
||||
mapperGS3 gbDataGS3 = { 1 }; // ROM bank
|
||||
|
||||
void mapperGS3ROM(u16 address, u8 value)
|
||||
void mapperGS3ROM(uint16_t address, uint8_t value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
|
|
|
@ -144,35 +144,35 @@ extern mapperTAMA5 gbDataTAMA5;
|
|||
extern mapperMMM01 gbDataMMM01;
|
||||
extern mapperGS3 gbDataGS3;
|
||||
|
||||
void mapperMBC1ROM(u16, u8);
|
||||
void mapperMBC1RAM(u16, u8);
|
||||
u8 mapperMBC1ReadRAM(u16);
|
||||
void mapperMBC2ROM(u16, u8);
|
||||
void mapperMBC2RAM(u16, u8);
|
||||
void mapperMBC3ROM(u16, u8);
|
||||
void mapperMBC3RAM(u16, u8);
|
||||
u8 mapperMBC3ReadRAM(u16);
|
||||
void mapperMBC5ROM(u16, u8);
|
||||
void mapperMBC5RAM(u16, u8);
|
||||
u8 mapperMBC5ReadRAM(u16);
|
||||
void mapperMBC7ROM(u16, u8);
|
||||
void mapperMBC7RAM(u16, u8);
|
||||
u8 mapperMBC7ReadRAM(u16);
|
||||
void mapperHuC1ROM(u16, u8);
|
||||
void mapperHuC1RAM(u16, u8);
|
||||
void mapperHuC3ROM(u16, u8);
|
||||
void mapperHuC3RAM(u16, u8);
|
||||
u8 mapperHuC3ReadRAM(u16);
|
||||
void mapperTAMA5RAM(u16, u8);
|
||||
u8 mapperTAMA5ReadRAM(u16);
|
||||
void mapperMBC1ROM(uint16_t, uint8_t);
|
||||
void mapperMBC1RAM(uint16_t, uint8_t);
|
||||
uint8_t mapperMBC1ReadRAM(uint16_t);
|
||||
void mapperMBC2ROM(uint16_t, uint8_t);
|
||||
void mapperMBC2RAM(uint16_t, uint8_t);
|
||||
void mapperMBC3ROM(uint16_t, uint8_t);
|
||||
void mapperMBC3RAM(uint16_t, uint8_t);
|
||||
uint8_t mapperMBC3ReadRAM(uint16_t);
|
||||
void mapperMBC5ROM(uint16_t, uint8_t);
|
||||
void mapperMBC5RAM(uint16_t, uint8_t);
|
||||
uint8_t mapperMBC5ReadRAM(uint16_t);
|
||||
void mapperMBC7ROM(uint16_t, uint8_t);
|
||||
void mapperMBC7RAM(uint16_t, uint8_t);
|
||||
uint8_t mapperMBC7ReadRAM(uint16_t);
|
||||
void mapperHuC1ROM(uint16_t, uint8_t);
|
||||
void mapperHuC1RAM(uint16_t, uint8_t);
|
||||
void mapperHuC3ROM(uint16_t, uint8_t);
|
||||
void mapperHuC3RAM(uint16_t, uint8_t);
|
||||
uint8_t mapperHuC3ReadRAM(uint16_t);
|
||||
void mapperTAMA5RAM(uint16_t, uint8_t);
|
||||
uint8_t mapperTAMA5ReadRAM(uint16_t);
|
||||
void memoryUpdateTAMA5Clock();
|
||||
void mapperMMM01ROM(u16, u8);
|
||||
void mapperMMM01RAM(u16, u8);
|
||||
void mapperGGROM(u16, u8);
|
||||
void mapperGS3ROM(u16, u8);
|
||||
// extern void (*mapper)(u16,u8);
|
||||
// extern void (*mapperRAM)(u16,u8);
|
||||
// extern u8 (*mapperReadRAM)(u16);
|
||||
void mapperMMM01ROM(uint16_t, uint8_t);
|
||||
void mapperMMM01RAM(uint16_t, uint8_t);
|
||||
void mapperGGROM(uint16_t, uint8_t);
|
||||
void mapperGS3ROM(uint16_t, uint8_t);
|
||||
// extern void (*mapper)(uint16_t,uint8_t);
|
||||
// extern void (*mapperRAM)(uint16_t,uint8_t);
|
||||
// extern uint8_t (*mapperReadRAM)(uint16_t);
|
||||
|
||||
extern void memoryUpdateMapMBC1();
|
||||
extern void memoryUpdateMapMBC2();
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
|
||||
u8 gbPrinterStatus = 0;
|
||||
uint8_t gbPrinterStatus = 0;
|
||||
int gbPrinterState = 0;
|
||||
u8 gbPrinterData[0x280 * 9];
|
||||
u8 gbPrinterPacket[0x400];
|
||||
uint8_t gbPrinterData[0x280 * 9];
|
||||
uint8_t gbPrinterPacket[0x400];
|
||||
int gbPrinterCount = 0;
|
||||
int gbPrinterDataCount = 0;
|
||||
int gbPrinterDataSize = 0;
|
||||
|
@ -13,7 +13,7 @@ int gbPrinterResult = 0;
|
|||
|
||||
bool gbPrinterCheckCRC()
|
||||
{
|
||||
u16 crc = 0;
|
||||
uint16_t crc = 0;
|
||||
|
||||
for (int i = 2; i < (6 + gbPrinterDataSize); i++) {
|
||||
crc += gbPrinterPacket[i];
|
||||
|
@ -61,7 +61,7 @@ void gbPrinterShowData()
|
|||
pal[3].b = 0;
|
||||
set_palette(pal);
|
||||
acquire_screen();
|
||||
u8 *data = gbPrinterData;
|
||||
uint8_t *data = gbPrinterData;
|
||||
for(int y = 0; y < 0x12; y++) {
|
||||
for(int x = 0; x < 0x14; x++) {
|
||||
for(int k = 0; k < 8; k++) {
|
||||
|
@ -89,11 +89,11 @@ void gbPrinterReceiveData()
|
|||
{
|
||||
int i = gbPrinterDataCount;
|
||||
if (gbPrinterPacket[3]) { // compressed
|
||||
u8* data = &gbPrinterPacket[6];
|
||||
u8* dest = &gbPrinterData[gbPrinterDataCount];
|
||||
uint8_t* data = &gbPrinterPacket[6];
|
||||
uint8_t* dest = &gbPrinterData[gbPrinterDataCount];
|
||||
int len = 0;
|
||||
while (len < gbPrinterDataSize) {
|
||||
u8 control = *data++;
|
||||
uint8_t control = *data++;
|
||||
if (control & 0x80) { // repeated data
|
||||
control &= 0x7f;
|
||||
control += 2;
|
||||
|
@ -139,7 +139,7 @@ void gbPrinterCommand()
|
|||
}
|
||||
}
|
||||
|
||||
u8 gbPrinterSend(u8 b)
|
||||
uint8_t gbPrinterSend(uint8_t b)
|
||||
{
|
||||
switch (gbPrinterState) {
|
||||
case 0:
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
#include "../System.h"
|
||||
|
||||
u8 gbPrinterSend(u8 b);
|
||||
uint8_t gbPrinterSend(uint8_t b);
|
||||
|
||||
#endif // GBPRINTER_H
|
||||
|
|
222
src/gb/gbSGB.cpp
222
src/gb/gbSGB.cpp
|
@ -7,7 +7,7 @@
|
|||
#include "gb.h"
|
||||
#include "gbGlobals.h"
|
||||
|
||||
extern u8* pix;
|
||||
extern uint8_t* pix;
|
||||
extern bool speedup;
|
||||
extern bool gbSgbResetFlag;
|
||||
|
||||
|
@ -15,8 +15,8 @@ extern bool gbSgbResetFlag;
|
|||
#define GBSGB_RESET 1
|
||||
#define GBSGB_PACKET_TRANSMIT 2
|
||||
|
||||
u8* gbSgbBorderChar = NULL;
|
||||
u8* gbSgbBorder = NULL;
|
||||
uint8_t* gbSgbBorderChar = NULL;
|
||||
uint8_t* gbSgbBorder = NULL;
|
||||
|
||||
int gbSgbCGBSupport = 0;
|
||||
int gbSgbMask = 0;
|
||||
|
@ -25,30 +25,30 @@ int gbSgbPacketState = GBSGB_NONE;
|
|||
int gbSgbBit = 0;
|
||||
int gbSgbPacketTimeout = 0;
|
||||
int GBSGB_PACKET_TIMEOUT = 66666;
|
||||
u8 gbSgbPacket[16 * 7];
|
||||
uint8_t gbSgbPacket[16 * 7];
|
||||
int gbSgbPacketNBits = 0;
|
||||
int gbSgbPacketByte = 0;
|
||||
int gbSgbPacketNumber = 0;
|
||||
int gbSgbMultiplayer = 0;
|
||||
int gbSgbFourPlayers = 0;
|
||||
u8 gbSgbNextController = 0x0f;
|
||||
u8 gbSgbReadingController = 0;
|
||||
u16 gbSgbSCPPalette[4 * 512];
|
||||
u8 gbSgbATF[20 * 18];
|
||||
u8 gbSgbATFList[45 * 20 * 18];
|
||||
u8 gbSgbScreenBuffer[4160];
|
||||
uint8_t gbSgbNextController = 0x0f;
|
||||
uint8_t gbSgbReadingController = 0;
|
||||
uint16_t gbSgbSCPPalette[4 * 512];
|
||||
uint8_t gbSgbATF[20 * 18];
|
||||
uint8_t gbSgbATFList[45 * 20 * 18];
|
||||
uint8_t gbSgbScreenBuffer[4160];
|
||||
|
||||
inline void gbSgbDraw24Bit(u8* p, u16 v)
|
||||
inline void gbSgbDraw24Bit(uint8_t* p, uint16_t v)
|
||||
{
|
||||
memcpy(p, &systemColorMap32[v], 3);
|
||||
}
|
||||
|
||||
inline void gbSgbDraw32Bit(u32* p, u16 v)
|
||||
inline void gbSgbDraw32Bit(uint32_t* p, uint16_t v)
|
||||
{
|
||||
*p = systemColorMap32[v];
|
||||
}
|
||||
|
||||
inline void gbSgbDraw16Bit(u16* p, u16 v)
|
||||
inline void gbSgbDraw16Bit(uint16_t* p, uint16_t v)
|
||||
{
|
||||
*p = systemColorMap16[v];
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ void gbSgbReset()
|
|||
|
||||
void gbSgbInit()
|
||||
{
|
||||
gbSgbBorderChar = (u8*)malloc(32 * 256);
|
||||
gbSgbBorder = (u8*)malloc(2048);
|
||||
gbSgbBorderChar = (uint8_t*)malloc(32 * 256);
|
||||
gbSgbBorder = (uint8_t*)malloc(2048);
|
||||
|
||||
gbSgbReset();
|
||||
}
|
||||
|
@ -108,13 +108,13 @@ void gbSgbShutdown()
|
|||
}
|
||||
}
|
||||
|
||||
void gbSgbFillScreen(u16 color)
|
||||
void gbSgbFillScreen(uint16_t color)
|
||||
{
|
||||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
for (int y = 0; y < 144; y++) {
|
||||
int yLine = (y + gbBorderRowSkip + 1) * (gbBorderLineSkip + 2) + gbBorderColumnSkip;
|
||||
u16* dest = (u16*)pix + yLine;
|
||||
uint16_t* dest = (uint16_t*)pix + yLine;
|
||||
for (register int x = 0; x < 160; x++)
|
||||
gbSgbDraw16Bit(dest++, color);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void gbSgbFillScreen(u16 color)
|
|||
case 24: {
|
||||
for (int y = 0; y < 144; y++) {
|
||||
int yLine = (y + gbBorderRowSkip) * gbBorderLineSkip + gbBorderColumnSkip;
|
||||
u8* dest = (u8*)pix + yLine * 3;
|
||||
uint8_t* dest = (uint8_t*)pix + yLine * 3;
|
||||
for (register int x = 0; x < 160; x++) {
|
||||
gbSgbDraw24Bit(dest, color);
|
||||
dest += 3;
|
||||
|
@ -132,7 +132,7 @@ void gbSgbFillScreen(u16 color)
|
|||
case 32: {
|
||||
for (int y = 0; y < 144; y++) {
|
||||
int yLine = (y + gbBorderRowSkip + 1) * (gbBorderLineSkip + 1) + gbBorderColumnSkip;
|
||||
u32* dest = (u32*)pix + yLine;
|
||||
uint32_t* dest = (uint32_t*)pix + yLine;
|
||||
for (register int x = 0; x < 160; x++) {
|
||||
gbSgbDraw32Bit(dest++, color);
|
||||
}
|
||||
|
@ -145,12 +145,12 @@ void gbSgbFillScreen(u16 color)
|
|||
|
||||
void gbSgbRenderScreenToBuffer()
|
||||
{
|
||||
u16 mapAddress = 0x9800;
|
||||
uint16_t mapAddress = 0x9800;
|
||||
|
||||
if (register_LCDC & 0x08)
|
||||
mapAddress = 0x9c00;
|
||||
|
||||
u16 patternAddress = 0x8800;
|
||||
uint16_t patternAddress = 0x8800;
|
||||
|
||||
int flag = 1;
|
||||
|
||||
|
@ -159,7 +159,7 @@ void gbSgbRenderScreenToBuffer()
|
|||
flag = 0;
|
||||
}
|
||||
|
||||
u8* toAddress = gbSgbScreenBuffer;
|
||||
uint8_t* toAddress = gbSgbScreenBuffer;
|
||||
|
||||
for (int i = 0; i < 13; i++) {
|
||||
for (int j = 0; j < 20; j++) {
|
||||
|
@ -181,36 +181,36 @@ void gbSgbRenderScreenToBuffer()
|
|||
|
||||
void gbSgbDrawBorderTile(int x, int y, int tile, int attr)
|
||||
{
|
||||
u16* dest = (u16*)pix + ((y + 1) * (256 + 2)) + x;
|
||||
u8* dest8 = (u8*)pix + ((y * 256) + x) * 3;
|
||||
u32* dest32 = (u32*)pix + ((y + 1) * 257) + x;
|
||||
uint16_t* dest = (uint16_t*)pix + ((y + 1) * (256 + 2)) + x;
|
||||
uint8_t* dest8 = (uint8_t*)pix + ((y * 256) + x) * 3;
|
||||
uint32_t* dest32 = (uint32_t*)pix + ((y + 1) * 257) + x;
|
||||
|
||||
u8* tileAddress = &gbSgbBorderChar[tile * 32];
|
||||
u8* tileAddress2 = &gbSgbBorderChar[tile * 32 + 16];
|
||||
uint8_t* tileAddress = &gbSgbBorderChar[tile * 32];
|
||||
uint8_t* tileAddress2 = &gbSgbBorderChar[tile * 32 + 16];
|
||||
|
||||
u8 l = 8;
|
||||
uint8_t l = 8;
|
||||
|
||||
u8 palette = ((attr >> 2) & 7);
|
||||
uint8_t palette = ((attr >> 2) & 7);
|
||||
|
||||
if (palette < 4)
|
||||
palette += 4;
|
||||
|
||||
palette *= 16;
|
||||
|
||||
u8 xx = 0;
|
||||
u8 yy = 0;
|
||||
uint8_t xx = 0;
|
||||
uint8_t yy = 0;
|
||||
|
||||
int flipX = attr & 0x40;
|
||||
int flipY = attr & 0x80;
|
||||
|
||||
while (l > 0) {
|
||||
u8 mask = 0x80;
|
||||
u8 a = *tileAddress++;
|
||||
u8 b = *tileAddress++;
|
||||
u8 c = *tileAddress2++;
|
||||
u8 d = *tileAddress2++;
|
||||
uint8_t mask = 0x80;
|
||||
uint8_t a = *tileAddress++;
|
||||
uint8_t b = *tileAddress++;
|
||||
uint8_t c = *tileAddress2++;
|
||||
uint8_t d = *tileAddress2++;
|
||||
|
||||
u8 yyy;
|
||||
uint8_t yyy;
|
||||
if (!flipY)
|
||||
yyy = yy;
|
||||
else
|
||||
|
@ -218,7 +218,7 @@ void gbSgbDrawBorderTile(int x, int y, int tile, int attr)
|
|||
|
||||
while (mask > 0) {
|
||||
|
||||
u8 color = 0;
|
||||
uint8_t color = 0;
|
||||
if (a & mask)
|
||||
color++;
|
||||
if (b & mask)
|
||||
|
@ -229,14 +229,14 @@ void gbSgbDrawBorderTile(int x, int y, int tile, int attr)
|
|||
color += 8;
|
||||
|
||||
if (color || (y + yy < 40 || y + yy >= 184) || (x + xx < 48 || x + xx >= 208)) {
|
||||
u8 xxx;
|
||||
uint8_t xxx;
|
||||
|
||||
if (!flipX)
|
||||
xxx = xx;
|
||||
else
|
||||
xxx = 7 - xx;
|
||||
|
||||
u16 cc;
|
||||
uint16_t cc;
|
||||
if (color) {
|
||||
cc = gbPalette[palette + color];
|
||||
} else {
|
||||
|
@ -270,12 +270,12 @@ void gbSgbDrawBorderTile(int x, int y, int tile, int attr)
|
|||
void gbSgbRenderBorder()
|
||||
{
|
||||
if (gbBorderOn) {
|
||||
u8* fromAddress = gbSgbBorder;
|
||||
uint8_t* fromAddress = gbSgbBorder;
|
||||
|
||||
for (u8 y = 0; y < 28; y++) {
|
||||
for (u8 x = 0; x < 32; x++) {
|
||||
u8 tile = *fromAddress++;
|
||||
u8 attr = *fromAddress++;
|
||||
for (uint8_t y = 0; y < 28; y++) {
|
||||
for (uint8_t x = 0; x < 32; x++) {
|
||||
uint8_t tile = *fromAddress++;
|
||||
uint8_t attr = *fromAddress++;
|
||||
|
||||
gbSgbDrawBorderTile(x * 8, y * 8, tile, attr);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ void gbSgbPicture()
|
|||
|
||||
memcpy(gbSgbBorder, gbSgbScreenBuffer, 2048);
|
||||
|
||||
u16* paletteAddr = (u16*)&gbSgbScreenBuffer[2048];
|
||||
uint16_t* paletteAddr = (uint16_t*)&gbSgbScreenBuffer[2048];
|
||||
|
||||
for (int i = 64; i < 128; i++) {
|
||||
gbPalette[i] = READ16LE(paletteAddr++);
|
||||
|
@ -317,9 +317,9 @@ void gbSgbPicture()
|
|||
gbSgbCGBSupport = 0;
|
||||
}
|
||||
|
||||
void gbSgbSetPalette(int a, int b, u16* p)
|
||||
void gbSgbSetPalette(int a, int b, uint16_t* p)
|
||||
{
|
||||
u16 bit00 = READ16LE(p++);
|
||||
uint16_t bit00 = READ16LE(p++);
|
||||
int i;
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
|
@ -339,7 +339,7 @@ void gbSgbScpPalette()
|
|||
{
|
||||
gbSgbRenderScreenToBuffer();
|
||||
|
||||
u16* fromAddress = (u16*)gbSgbScreenBuffer;
|
||||
uint16_t* fromAddress = (uint16_t*)gbSgbScreenBuffer;
|
||||
|
||||
for (int i = 0; i < 512 * 4; i++) {
|
||||
gbSgbSCPPalette[i] = READ16LE(fromAddress++);
|
||||
|
@ -363,19 +363,19 @@ void gbSgbSetATF(int n)
|
|||
|
||||
void gbSgbSetPalette()
|
||||
{
|
||||
u16 pal = READ16LE((((u16*)&gbSgbPacket[1]))) & 511;
|
||||
memcpy(&gbPalette[0], &gbSgbSCPPalette[pal * 4], 4 * sizeof(u16));
|
||||
uint16_t pal = READ16LE((((uint16_t*)&gbSgbPacket[1]))) & 511;
|
||||
memcpy(&gbPalette[0], &gbSgbSCPPalette[pal * 4], 4 * sizeof(uint16_t));
|
||||
|
||||
pal = READ16LE((((u16*)&gbSgbPacket[3]))) & 511;
|
||||
memcpy(&gbPalette[4], &gbSgbSCPPalette[pal * 4], 4 * sizeof(u16));
|
||||
pal = READ16LE((((uint16_t*)&gbSgbPacket[3]))) & 511;
|
||||
memcpy(&gbPalette[4], &gbSgbSCPPalette[pal * 4], 4 * sizeof(uint16_t));
|
||||
|
||||
pal = READ16LE((((u16*)&gbSgbPacket[5]))) & 511;
|
||||
memcpy(&gbPalette[8], &gbSgbSCPPalette[pal * 4], 4 * sizeof(u16));
|
||||
pal = READ16LE((((uint16_t*)&gbSgbPacket[5]))) & 511;
|
||||
memcpy(&gbPalette[8], &gbSgbSCPPalette[pal * 4], 4 * sizeof(uint16_t));
|
||||
|
||||
pal = READ16LE((((u16*)&gbSgbPacket[7]))) & 511;
|
||||
memcpy(&gbPalette[12], &gbSgbSCPPalette[pal * 4], 4 * sizeof(u16));
|
||||
pal = READ16LE((((uint16_t*)&gbSgbPacket[7]))) & 511;
|
||||
memcpy(&gbPalette[12], &gbSgbSCPPalette[pal * 4], 4 * sizeof(uint16_t));
|
||||
|
||||
u8 atf = gbSgbPacket[9];
|
||||
uint8_t atf = gbSgbPacket[9];
|
||||
|
||||
if (atf & 0x80) {
|
||||
gbSgbSetATF(atf & 0x3f);
|
||||
|
@ -390,26 +390,26 @@ void gbSgbSetPalette()
|
|||
|
||||
void gbSgbAttributeBlock()
|
||||
{
|
||||
u8* fromAddress = &gbSgbPacket[1];
|
||||
uint8_t* fromAddress = &gbSgbPacket[1];
|
||||
|
||||
u8 nDataSet = *fromAddress++;
|
||||
uint8_t nDataSet = *fromAddress++;
|
||||
if (nDataSet > 12)
|
||||
nDataSet = 12;
|
||||
if (nDataSet == 0)
|
||||
nDataSet = 1;
|
||||
|
||||
while (nDataSet) {
|
||||
u8 controlCode = (*fromAddress++) & 7;
|
||||
u8 paletteDesignation = (*fromAddress++) & 0x3f;
|
||||
u8 startH = (*fromAddress++) & 0x1f;
|
||||
u8 startV = (*fromAddress++) & 0x1f;
|
||||
u8 endH = (*fromAddress++) & 0x1f;
|
||||
u8 endV = (*fromAddress++) & 0x1f;
|
||||
uint8_t controlCode = (*fromAddress++) & 7;
|
||||
uint8_t paletteDesignation = (*fromAddress++) & 0x3f;
|
||||
uint8_t startH = (*fromAddress++) & 0x1f;
|
||||
uint8_t startV = (*fromAddress++) & 0x1f;
|
||||
uint8_t endH = (*fromAddress++) & 0x1f;
|
||||
uint8_t endV = (*fromAddress++) & 0x1f;
|
||||
|
||||
u8* toAddress = gbSgbATF;
|
||||
uint8_t* toAddress = gbSgbATF;
|
||||
|
||||
for (u8 y = 0; y < 18; y++) {
|
||||
for (u8 x = 0; x < 20; x++) {
|
||||
for (uint8_t y = 0; y < 18; y++) {
|
||||
for (uint8_t x = 0; x < 20; x++) {
|
||||
if (x < startH || y < startV || x > endH || y > endV) {
|
||||
// outside
|
||||
if (controlCode & 0x04)
|
||||
|
@ -432,7 +432,7 @@ void gbSgbAttributeBlock()
|
|||
}
|
||||
}
|
||||
|
||||
void gbSgbSetColumnPalette(u8 col, u8 p)
|
||||
void gbSgbSetColumnPalette(uint8_t col, uint8_t p)
|
||||
{
|
||||
// if(col < 0)
|
||||
// col = 0;
|
||||
|
@ -441,15 +441,15 @@ void gbSgbSetColumnPalette(u8 col, u8 p)
|
|||
|
||||
p &= 3;
|
||||
|
||||
u8* toAddress = &gbSgbATF[col];
|
||||
uint8_t* toAddress = &gbSgbATF[col];
|
||||
|
||||
for (u8 y = 0; y < 18; y++) {
|
||||
for (uint8_t y = 0; y < 18; y++) {
|
||||
*toAddress = p;
|
||||
toAddress += 20;
|
||||
}
|
||||
}
|
||||
|
||||
void gbSgbSetRowPalette(u8 row, u8 p)
|
||||
void gbSgbSetRowPalette(uint8_t row, uint8_t p)
|
||||
{
|
||||
// if(row < 0)
|
||||
// row = 0;
|
||||
|
@ -458,26 +458,26 @@ void gbSgbSetRowPalette(u8 row, u8 p)
|
|||
|
||||
p &= 3;
|
||||
|
||||
u8* toAddress = &gbSgbATF[row * 20];
|
||||
uint8_t* toAddress = &gbSgbATF[row * 20];
|
||||
|
||||
for (u8 x = 0; x < 20; x++) {
|
||||
for (uint8_t x = 0; x < 20; x++) {
|
||||
*toAddress++ = p;
|
||||
}
|
||||
}
|
||||
|
||||
void gbSgbAttributeDivide()
|
||||
{
|
||||
u8 control = gbSgbPacket[1];
|
||||
u8 coord = gbSgbPacket[2];
|
||||
u8 colorBR = control & 3;
|
||||
u8 colorAL = (control >> 2) & 3;
|
||||
u8 colorOL = (control >> 4) & 3;
|
||||
uint8_t control = gbSgbPacket[1];
|
||||
uint8_t coord = gbSgbPacket[2];
|
||||
uint8_t colorBR = control & 3;
|
||||
uint8_t colorAL = (control >> 2) & 3;
|
||||
uint8_t colorOL = (control >> 4) & 3;
|
||||
|
||||
if (control & 0x40) {
|
||||
if (coord > 17)
|
||||
coord = 17;
|
||||
|
||||
for (u8 i = 0; i < 18; i++) {
|
||||
for (uint8_t i = 0; i < 18; i++) {
|
||||
if (i < coord)
|
||||
gbSgbSetRowPalette(i, colorAL);
|
||||
else if (i > coord)
|
||||
|
@ -489,7 +489,7 @@ void gbSgbAttributeDivide()
|
|||
if (coord > 19)
|
||||
coord = 19;
|
||||
|
||||
for (u8 i = 0; i < 20; i++) {
|
||||
for (uint8_t i = 0; i < 20; i++) {
|
||||
if (i < coord)
|
||||
gbSgbSetColumnPalette(i, colorAL);
|
||||
else if (i > coord)
|
||||
|
@ -502,17 +502,17 @@ void gbSgbAttributeDivide()
|
|||
|
||||
void gbSgbAttributeLine()
|
||||
{
|
||||
u8* fromAddress = &gbSgbPacket[1];
|
||||
uint8_t* fromAddress = &gbSgbPacket[1];
|
||||
|
||||
u8 nDataSet = *fromAddress++;
|
||||
uint8_t nDataSet = *fromAddress++;
|
||||
|
||||
if (nDataSet > 0x6e)
|
||||
nDataSet = 0x6e;
|
||||
|
||||
while (nDataSet) {
|
||||
u8 line = *fromAddress++;
|
||||
u8 num = line & 0x1f;
|
||||
u8 pal = (line >> 5) & 0x03;
|
||||
uint8_t line = *fromAddress++;
|
||||
uint8_t num = line & 0x1f;
|
||||
uint8_t pal = (line >> 5) & 0x03;
|
||||
if (line & 0x80) {
|
||||
if (num > 17)
|
||||
num = 17;
|
||||
|
@ -528,22 +528,22 @@ void gbSgbAttributeLine()
|
|||
|
||||
void gbSgbAttributeCharacter()
|
||||
{
|
||||
u8 startH = gbSgbPacket[1] & 0x1f;
|
||||
u8 startV = gbSgbPacket[2] & 0x1f;
|
||||
int nDataSet = READ16LE(((u16*)&gbSgbPacket[3]));
|
||||
uint8_t startH = gbSgbPacket[1] & 0x1f;
|
||||
uint8_t startV = gbSgbPacket[2] & 0x1f;
|
||||
int nDataSet = READ16LE(((uint16_t*)&gbSgbPacket[3]));
|
||||
int style = gbSgbPacket[5] & 1;
|
||||
if (startH > 19)
|
||||
startH = 19;
|
||||
if (startV > 17)
|
||||
startV = 17;
|
||||
|
||||
u8 s = 6;
|
||||
u8* fromAddress = &gbSgbPacket[6];
|
||||
u8 v = *fromAddress++;
|
||||
uint8_t s = 6;
|
||||
uint8_t* fromAddress = &gbSgbPacket[6];
|
||||
uint8_t v = *fromAddress++;
|
||||
|
||||
if (style) {
|
||||
while (nDataSet) {
|
||||
u8 p = (v >> s) & 3;
|
||||
uint8_t p = (v >> s) & 3;
|
||||
gbSgbATF[startV * 20 + startH] = p;
|
||||
startV++;
|
||||
if (startV == 18) {
|
||||
|
@ -563,7 +563,7 @@ void gbSgbAttributeCharacter()
|
|||
}
|
||||
} else {
|
||||
while (nDataSet) {
|
||||
u8 p = (v >> s) & 3;
|
||||
uint8_t p = (v >> s) & 3;
|
||||
gbSgbATF[startV * 20 + startH] = p;
|
||||
startH++;
|
||||
if (startH == 20) {
|
||||
|
@ -588,13 +588,13 @@ void gbSgbSetATFList()
|
|||
{
|
||||
gbSgbRenderScreenToBuffer();
|
||||
|
||||
u8* fromAddress = gbSgbScreenBuffer;
|
||||
u8* toAddress = gbSgbATFList;
|
||||
uint8_t* fromAddress = gbSgbScreenBuffer;
|
||||
uint8_t* toAddress = gbSgbATFList;
|
||||
|
||||
for (int i = 0; i < 45; i++) {
|
||||
for (int j = 0; j < 90; j++) {
|
||||
u8 v = *fromAddress++;
|
||||
u8 s = 6;
|
||||
uint8_t v = *fromAddress++;
|
||||
uint8_t s = 6;
|
||||
if (i == 2)
|
||||
s = 6;
|
||||
for (int k = 0; k < 4; k++) {
|
||||
|
@ -616,7 +616,7 @@ void gbSgbMaskEnable()
|
|||
break;
|
||||
case 2:
|
||||
gbSgbFillScreen(0x0000);
|
||||
// memset(&gbPalette[0], 0, 128*sizeof(u16));
|
||||
// memset(&gbPalette[0], 0, 128*sizeof(uint16_t));
|
||||
break;
|
||||
case 3:
|
||||
gbSgbFillScreen(gbPalette[0]);
|
||||
|
@ -684,16 +684,16 @@ void gbSgbCommand()
|
|||
|
||||
switch (command) {
|
||||
case 0x00:
|
||||
gbSgbSetPalette(0, 1, (u16*)&gbSgbPacket[1]);
|
||||
gbSgbSetPalette(0, 1, (uint16_t*)&gbSgbPacket[1]);
|
||||
break;
|
||||
case 0x01:
|
||||
gbSgbSetPalette(2, 3, (u16*)&gbSgbPacket[1]);
|
||||
gbSgbSetPalette(2, 3, (uint16_t*)&gbSgbPacket[1]);
|
||||
break;
|
||||
case 0x02:
|
||||
gbSgbSetPalette(0, 3, (u16*)&gbSgbPacket[1]);
|
||||
gbSgbSetPalette(0, 3, (uint16_t*)&gbSgbPacket[1]);
|
||||
break;
|
||||
case 0x03:
|
||||
gbSgbSetPalette(1, 2, (u16*)&gbSgbPacket[1]);
|
||||
gbSgbSetPalette(1, 2, (uint16_t*)&gbSgbPacket[1]);
|
||||
break;
|
||||
case 0x04:
|
||||
gbSgbAttributeBlock();
|
||||
|
@ -740,7 +740,7 @@ void gbSgbResetPacketState()
|
|||
gbSgbPacketTimeout = 0;
|
||||
}
|
||||
|
||||
void gbSgbDoBitTransfer(u8 value)
|
||||
void gbSgbDoBitTransfer(uint8_t value)
|
||||
{
|
||||
value = value & 0x30;
|
||||
switch (gbSgbPacketState) {
|
||||
|
@ -841,8 +841,8 @@ variable_desc gbSgbSaveStruct[] = {
|
|||
{ &gbSgbPacketByte, sizeof(int) },
|
||||
{ &gbSgbPacketNumber, sizeof(int) },
|
||||
{ &gbSgbMultiplayer, sizeof(int) },
|
||||
{ &gbSgbNextController, sizeof(u8) },
|
||||
{ &gbSgbReadingController, sizeof(u8) },
|
||||
{ &gbSgbNextController, sizeof(uint8_t) },
|
||||
{ &gbSgbReadingController, sizeof(uint8_t) },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
@ -854,8 +854,8 @@ variable_desc gbSgbSaveStructV3[] = {
|
|||
{ &gbSgbPacketByte, sizeof(int) },
|
||||
{ &gbSgbPacketNumber, sizeof(int) },
|
||||
{ &gbSgbMultiplayer, sizeof(int) },
|
||||
{ &gbSgbNextController, sizeof(u8) },
|
||||
{ &gbSgbReadingController, sizeof(u8) },
|
||||
{ &gbSgbNextController, sizeof(uint8_t) },
|
||||
{ &gbSgbReadingController, sizeof(uint8_t) },
|
||||
{ &gbSgbFourPlayers, sizeof(int) },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
@ -869,7 +869,7 @@ void gbSgbSaveGame(gzFile gzFile)
|
|||
|
||||
utilGzWrite(gzFile, gbSgbPacket, 16 * 7);
|
||||
|
||||
utilGzWrite(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(u16));
|
||||
utilGzWrite(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(uint16_t));
|
||||
utilGzWrite(gzFile, gbSgbATF, 20 * 18);
|
||||
utilGzWrite(gzFile, gbSgbATFList, 45 * 20 * 18);
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ void gbSgbReadGame(gzFile gzFile, int version)
|
|||
|
||||
utilGzRead(gzFile, gbSgbPacket, 16 * 7);
|
||||
|
||||
utilGzRead(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(u16));
|
||||
utilGzRead(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(uint16_t));
|
||||
utilGzRead(gzFile, gbSgbATF, 20 * 18);
|
||||
utilGzRead(gzFile, gbSgbATFList, 45 * 20 * 18);
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ void gbSgbShutdown();
|
|||
void gbSgbCommand();
|
||||
void gbSgbResetPacketState();
|
||||
void gbSgbReset();
|
||||
void gbSgbDoBitTransfer(u8);
|
||||
void gbSgbDoBitTransfer(uint8_t);
|
||||
void gbSgbSaveGame(gzFile);
|
||||
void gbSgbReadGame(gzFile, int version);
|
||||
void gbSgbRenderBorder();
|
||||
|
||||
extern u8 gbSgbATF[20 * 18];
|
||||
extern uint8_t gbSgbATF[20 * 18];
|
||||
extern int gbSgbMode;
|
||||
extern int gbSgbMask;
|
||||
extern int gbSgbMultiplayer;
|
||||
extern u8 gbSgbNextController;
|
||||
extern uint8_t gbSgbNextController;
|
||||
extern int gbSgbPacketTimeout;
|
||||
extern u8 gbSgbReadingController;
|
||||
extern uint8_t gbSgbReadingController;
|
||||
extern int gbSgbFourPlayers;
|
||||
|
||||
#endif // GBSGB_H
|
||||
|
|
|
@ -29,7 +29,7 @@ static inline blip_time_t blip_time()
|
|||
return (SOUND_CLOCK_TICKS - soundTicks) * ticks_to_time;
|
||||
}
|
||||
|
||||
u8 gbSoundRead(u16 address)
|
||||
uint8_t gbSoundRead(uint16_t address)
|
||||
{
|
||||
if (gb_apu && address >= NR10 && address <= 0xFF3F)
|
||||
return gb_apu->read_register(blip_time(), address);
|
||||
|
@ -37,7 +37,7 @@ u8 gbSoundRead(u16 address)
|
|||
return gbMemory[address];
|
||||
}
|
||||
|
||||
void gbSoundEvent(register u16 address, register int data)
|
||||
void gbSoundEvent(register uint16_t address, register int data)
|
||||
{
|
||||
gbMemory[address] = data;
|
||||
|
||||
|
@ -326,9 +326,9 @@ static variable_desc gbsound_format2[] = {
|
|||
};
|
||||
|
||||
static variable_desc gbsound_format3[] = {
|
||||
SKIP(u8[2 * 735], soundBuffer),
|
||||
SKIP(u8[2 * 735], soundBuffer),
|
||||
SKIP(u16[735], soundFinalWave),
|
||||
SKIP(uint8_t[2 * 735], soundBuffer),
|
||||
SKIP(uint8_t[2 * 735], soundBuffer),
|
||||
SKIP(uint16_t[735], soundFinalWave),
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
@ -402,7 +402,7 @@ static variable_desc gb_state[] = {
|
|||
LOAD(int, state.version), // room_for_expansion will be used by later versions
|
||||
|
||||
// APU
|
||||
LOAD(u8[0x40], state.apu.regs), // last values written to registers and wave RAM (both banks)
|
||||
LOAD(uint8_t[0x40], state.apu.regs), // last values written to registers and wave RAM (both banks)
|
||||
LOAD(int, state.apu.frame_time), // clocks until next frame sequencer action
|
||||
LOAD(int, state.apu.frame_phase), // next step frame sequencer will run
|
||||
|
||||
|
|
|
@ -56,11 +56,11 @@ extern gb_effects_config_t gb_effects_config; // current configuration
|
|||
void gbSoundReset();
|
||||
|
||||
// Emulates write to sound hardware
|
||||
void gbSoundEvent(u16 address, int data);
|
||||
void gbSoundEvent(uint16_t address, int data);
|
||||
#define SOUND_EVENT gbSoundEvent
|
||||
|
||||
// Emulates read from sound hardware
|
||||
u8 gbSoundRead(u16 address);
|
||||
uint8_t gbSoundRead(uint16_t address);
|
||||
|
||||
// Notifies emulator that SOUND_CLOCK_TICKS clocks have passed
|
||||
void gbSoundTick();
|
||||
|
|
|
@ -20,16 +20,15 @@
|
|||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
/**
|
||||
* GameBoyAdvanceCheatEditDialog
|
||||
*
|
||||
* A unified cheat editing dialog for multiple code types.
|
||||
*/
|
||||
CheatEditDialog::CheatEditDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog)
|
||||
CheatEditDialog::CheatEditDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
{
|
||||
refBuilder->get_widget("CheatDescEntry", m_poCheatDescEntry);
|
||||
refBuilder->get_widget("CheatTypeComboBox", m_poCheatTypeComboBox);
|
||||
|
@ -60,8 +59,7 @@ ECheatType CheatEditDialog::vGetType()
|
|||
{
|
||||
Gtk::TreeModel::iterator iter = m_poCheatTypeComboBox->get_active();
|
||||
|
||||
if (iter)
|
||||
{
|
||||
if (iter) {
|
||||
Gtk::TreeModel::Row row = *iter;
|
||||
|
||||
return row[m_oTypeModel.iType];
|
||||
|
@ -75,8 +73,7 @@ void CheatEditDialog::vSetWindow(VBA::Window * _poWindow)
|
|||
m_poWindow = _poWindow;
|
||||
|
||||
// GameBoy Advance
|
||||
if (m_poWindow->eGetCartridge() == VBA::Window::CartridgeGBA)
|
||||
{
|
||||
if (m_poWindow->eGetCartridge() == VBA::Window::CartridgeGBA) {
|
||||
Gtk::TreeModel::Row row = *(m_poCheatTypeStore->append());
|
||||
|
||||
row[m_oTypeModel.iType] = CheatGeneric;
|
||||
|
@ -95,8 +92,7 @@ void CheatEditDialog::vSetWindow(VBA::Window * _poWindow)
|
|||
m_poCheatTypeComboBox->set_active(CheatGeneric);
|
||||
}
|
||||
// GameBoy
|
||||
else if (m_poWindow->eGetCartridge() == VBA::Window::CartridgeGB)
|
||||
{
|
||||
else if (m_poWindow->eGetCartridge() == VBA::Window::CartridgeGB) {
|
||||
Gtk::TreeModel::Row row = *(m_poCheatTypeStore->append());
|
||||
|
||||
row[m_oTypeModel.iType] = CheatGS;
|
||||
|
@ -116,7 +112,8 @@ void CheatEditDialog::vOnApply()
|
|||
response(Gtk::RESPONSE_APPLY);
|
||||
}
|
||||
|
||||
void CheatEditDialog::vOnCancel() {
|
||||
void CheatEditDialog::vOnCancel()
|
||||
{
|
||||
response(Gtk::RESPONSE_CANCEL);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,14 @@
|
|||
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
enum ECheatType { CheatGeneric, CheatGSA, CheatCBA, CheatGS, CheatGG };
|
||||
namespace VBA {
|
||||
enum ECheatType { CheatGeneric,
|
||||
CheatGSA,
|
||||
CheatCBA,
|
||||
CheatGS,
|
||||
CheatGG };
|
||||
|
||||
class EditCheatCodeColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
class EditCheatCodeColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
public:
|
||||
EditCheatCodeColumns()
|
||||
{
|
||||
|
@ -48,8 +50,7 @@ class EditCheatCodeColumns : public Gtk::TreeModel::ColumnRecord
|
|||
Gtk::TreeModelColumn<ECheatType> iType;
|
||||
};
|
||||
|
||||
class CheatEditDialog : public Gtk::Dialog
|
||||
{
|
||||
class CheatEditDialog : public Gtk::Dialog {
|
||||
public:
|
||||
CheatEditDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
Glib::RefPtr<Gtk::TextBuffer> vGetCode();
|
||||
|
|
|
@ -24,11 +24,10 @@
|
|||
#include "intl.h"
|
||||
#include <vector>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
CheatListDialog::CheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog)
|
||||
CheatListDialog::CheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
{
|
||||
refBuilder->get_widget("CheatOpenButton", m_poCheatOpenButton);
|
||||
refBuilder->get_widget("CheatSaveButton", m_poCheatSaveButton);
|
||||
|
@ -74,15 +73,13 @@ void CheatListDialog::vOnCheatListOpen()
|
|||
|
||||
oDialog.set_current_folder(Glib::get_home_dir());
|
||||
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK) {
|
||||
// delete existing cheats before loading the list
|
||||
vRemoveAllCheats();
|
||||
|
||||
m_poCheatListStore->clear();
|
||||
|
||||
if (vCheatListOpen(oDialog.get_filename().c_str()))
|
||||
{
|
||||
if (vCheatListOpen(oDialog.get_filename().c_str())) {
|
||||
vUpdateList();
|
||||
break;
|
||||
}
|
||||
|
@ -121,8 +118,7 @@ void CheatListDialog::vOnCheatRemove()
|
|||
{
|
||||
Gtk::TreeModel::iterator iter = m_poCheatTreeView->get_selection()->get_selected();
|
||||
|
||||
if (iter)
|
||||
{
|
||||
if (iter) {
|
||||
Gtk::TreeModel::Row row = *iter;
|
||||
|
||||
vRemoveCheat(row[m_oRecordModel.iIndex]);
|
||||
|
@ -142,8 +138,7 @@ void CheatListDialog::vOnCheatMarkAll()
|
|||
{
|
||||
Gtk::TreeModel::Children cListEntries = m_poCheatListStore->children();
|
||||
|
||||
for (Gtk::TreeModel::iterator iter = cListEntries.begin(); iter; iter++)
|
||||
{
|
||||
for (Gtk::TreeModel::iterator iter = cListEntries.begin(); iter; iter++) {
|
||||
Gtk::TreeModel::Row row = *iter;
|
||||
|
||||
row[m_oRecordModel.bEnabled] = bMark;
|
||||
|
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class ListCheatCodeColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
namespace VBA {
|
||||
class ListCheatCodeColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
public:
|
||||
ListCheatCodeColumns()
|
||||
{
|
||||
|
@ -46,15 +44,15 @@ class ListCheatCodeColumns : public Gtk::TreeModel::ColumnRecord
|
|||
Gtk::TreeModelColumn<Glib::ustring> uDesc;
|
||||
};
|
||||
|
||||
class CheatListDialog : public Gtk::Dialog
|
||||
{
|
||||
class CheatListDialog : public Gtk::Dialog {
|
||||
public:
|
||||
CheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
void vSetWindow(VBA::Window* _poWindow);
|
||||
|
||||
protected:
|
||||
virtual void vAddCheat(Glib::ustring sDesc, ECheatType type,
|
||||
Glib::RefPtr<Gtk::TextBuffer> buffer) = 0;
|
||||
Glib::RefPtr<Gtk::TextBuffer> buffer)
|
||||
= 0;
|
||||
virtual bool vCheatListOpen(const char* file) = 0;
|
||||
virtual void vCheatListSave(const char* file) = 0;
|
||||
virtual void vRemoveCheat(int index) = 0;
|
||||
|
|
|
@ -23,31 +23,27 @@
|
|||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/iochannel.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace Config
|
||||
{
|
||||
namespace VBA {
|
||||
namespace Config {
|
||||
|
||||
using std::string;
|
||||
using Glib::IOChannel;
|
||||
|
||||
Line::Line(const string & _rsKey, const string & _rsValue) :
|
||||
m_sKey(_rsKey),
|
||||
m_sValue(_rsValue)
|
||||
Line::Line(const string& _rsKey, const string& _rsValue)
|
||||
: m_sKey(_rsKey)
|
||||
, m_sValue(_rsValue)
|
||||
{
|
||||
}
|
||||
|
||||
Section::Section(const string & _rsName) :
|
||||
m_sName(_rsName)
|
||||
Section::Section(const string& _rsName)
|
||||
: m_sName(_rsName)
|
||||
{
|
||||
}
|
||||
|
||||
bool Section::bKeyExists(const string& _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->m_sKey == _rsKey) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -56,10 +52,8 @@ bool Section::bKeyExists(const string & _rsKey)
|
|||
|
||||
void Section::vSetKey(const string& _rsKey, const string& _rsValue)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->m_sKey == _rsKey) {
|
||||
it->m_sValue = _rsValue;
|
||||
return;
|
||||
}
|
||||
|
@ -69,10 +63,8 @@ void Section::vSetKey(const string & _rsKey, const string & _rsValue)
|
|||
|
||||
string Section::sGetKey(const string& _rsKey) const
|
||||
{
|
||||
for (const_iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
for (const_iterator it = begin(); it != end(); it++) {
|
||||
if (it->m_sKey == _rsKey) {
|
||||
return it->m_sValue;
|
||||
}
|
||||
}
|
||||
|
@ -81,10 +73,8 @@ string Section::sGetKey(const string & _rsKey) const
|
|||
|
||||
void Section::vRemoveKey(const string& _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->m_sKey == _rsKey) {
|
||||
erase(it);
|
||||
return;
|
||||
}
|
||||
|
@ -106,10 +96,8 @@ File::~File()
|
|||
|
||||
bool File::bSectionExists(const string& _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->sGetName() == _rsName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -119,15 +107,12 @@ bool File::bSectionExists(const string & _rsName)
|
|||
Section* File::poAddSection(const string& _rsName)
|
||||
{
|
||||
Section* poSection = NULL;
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->sGetName() == _rsName) {
|
||||
poSection = &(*it);
|
||||
}
|
||||
}
|
||||
if (poSection == NULL)
|
||||
{
|
||||
if (poSection == NULL) {
|
||||
push_back(Section(_rsName));
|
||||
poSection = &back();
|
||||
}
|
||||
|
@ -136,10 +121,8 @@ Section * File::poAddSection(const string & _rsName)
|
|||
|
||||
Section* File::poGetSection(const string& _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->sGetName() == _rsName) {
|
||||
return &(*it);
|
||||
}
|
||||
}
|
||||
|
@ -148,10 +131,8 @@ Section * File::poGetSection(const string & _rsName)
|
|||
|
||||
void File::vRemoveSection(const string& _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (it->sGetName() == _rsName) {
|
||||
erase(it);
|
||||
return;
|
||||
}
|
||||
|
@ -167,38 +148,25 @@ void File::vLoad(const string & _rsFile,
|
|||
char** lines = g_strsplit(sBuffer.c_str(), "\n", 0);
|
||||
char* tmp;
|
||||
int i = 0;
|
||||
while (lines[i])
|
||||
{
|
||||
if (lines[i][0] == '[')
|
||||
{
|
||||
if ((tmp = strchr(lines[i], ']')))
|
||||
{
|
||||
while (lines[i]) {
|
||||
if (lines[i][0] == '[') {
|
||||
if ((tmp = strchr(lines[i], ']'))) {
|
||||
*tmp = '\0';
|
||||
if (_bAddSection)
|
||||
{
|
||||
if (_bAddSection) {
|
||||
poSection = poAddSection(&lines[i][1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
} else {
|
||||
try {
|
||||
poSection = poGetSection(&lines[i][1]);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} catch (...) {
|
||||
poSection = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (lines[i][0] != '#' && poSection != NULL)
|
||||
{
|
||||
if ((tmp = strchr(lines[i], '=')))
|
||||
{
|
||||
} else if (lines[i][0] != '#' && poSection != NULL) {
|
||||
if ((tmp = strchr(lines[i], '='))) {
|
||||
*tmp = '\0';
|
||||
tmp++;
|
||||
if (_bAddKey || poSection->bKeyExists(lines[i]))
|
||||
{
|
||||
if (_bAddKey || poSection->bKeyExists(lines[i])) {
|
||||
poSection->vSetKey(lines[i], tmp);
|
||||
}
|
||||
}
|
||||
|
@ -215,15 +183,13 @@ void File::vSave(const string & _rsFile)
|
|||
|
||||
for (const_iterator poSection = begin();
|
||||
poSection != end();
|
||||
poSection++)
|
||||
{
|
||||
poSection++) {
|
||||
string sName = "[" + poSection->sGetName() + "]\n";
|
||||
poFile->write(sName);
|
||||
|
||||
for (Section::const_iterator poLine = poSection->begin();
|
||||
poLine != poSection->end();
|
||||
poLine++)
|
||||
{
|
||||
poLine++) {
|
||||
string sLine = poLine->m_sKey + "=" + poLine->m_sValue + "\n";
|
||||
poFile->write(sLine);
|
||||
}
|
||||
|
@ -240,15 +206,13 @@ std::ostream & operator<<(std::ostream & _roOut, const File & _roFile)
|
|||
{
|
||||
for (File::const_iterator poSection = _roFile.begin();
|
||||
poSection != _roFile.end();
|
||||
poSection++)
|
||||
{
|
||||
poSection++) {
|
||||
string sName = "[" + poSection->sGetName() + "]\n";
|
||||
_roOut << sName;
|
||||
|
||||
for (Section::const_iterator poLine = poSection->begin();
|
||||
poLine != poSection->end();
|
||||
poLine++)
|
||||
{
|
||||
poLine++) {
|
||||
string sLine = poLine->m_sKey + "=" + poLine->m_sValue + "\n";
|
||||
_roOut << sLine;
|
||||
}
|
||||
|
|
|
@ -23,12 +23,9 @@
|
|||
#include <list>
|
||||
#include <sstream>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace Config
|
||||
{
|
||||
class NotFound
|
||||
{
|
||||
namespace VBA {
|
||||
namespace Config {
|
||||
class NotFound {
|
||||
public:
|
||||
virtual ~NotFound()
|
||||
{
|
||||
|
@ -40,10 +37,10 @@ class NotFound
|
|||
}
|
||||
};
|
||||
|
||||
class SectionNotFound : public NotFound
|
||||
{
|
||||
class SectionNotFound : public NotFound {
|
||||
public:
|
||||
SectionNotFound(const std::string &_rsName) : m_sName(_rsName)
|
||||
SectionNotFound(const std::string& _rsName)
|
||||
: m_sName(_rsName)
|
||||
{
|
||||
}
|
||||
virtual ~SectionNotFound()
|
||||
|
@ -59,11 +56,11 @@ class SectionNotFound : public NotFound
|
|||
std::string m_sName;
|
||||
};
|
||||
|
||||
class KeyNotFound : public NotFound
|
||||
{
|
||||
class KeyNotFound : public NotFound {
|
||||
public:
|
||||
KeyNotFound(const std::string& _rsSection, const std::string& _rsKey)
|
||||
: m_sSection(_rsSection), m_sKey(_rsKey)
|
||||
: m_sSection(_rsSection)
|
||||
, m_sKey(_rsKey)
|
||||
{
|
||||
}
|
||||
virtual ~KeyNotFound()
|
||||
|
@ -84,8 +81,7 @@ class KeyNotFound : public NotFound
|
|||
std::string m_sKey;
|
||||
};
|
||||
|
||||
class Line
|
||||
{
|
||||
class Line {
|
||||
public:
|
||||
Line(const std::string& _rsKey, const std::string& _rsValue);
|
||||
|
||||
|
@ -93,8 +89,7 @@ class Line
|
|||
std::string m_sValue;
|
||||
};
|
||||
|
||||
class Section : private std::list<Line>
|
||||
{
|
||||
class Section : private std::list<Line> {
|
||||
public:
|
||||
explicit Section(const std::string& _rsName);
|
||||
|
||||
|
@ -108,9 +103,11 @@ class Section : private std::list<Line>
|
|||
std::string sGetKey(const std::string& _rsKey) const;
|
||||
void vRemoveKey(const std::string& _rsKey);
|
||||
|
||||
template <typename T> void vSetKey(const std::string &_rsKey, const T &_rValue);
|
||||
template <typename T>
|
||||
void vSetKey(const std::string& _rsKey, const T& _rValue);
|
||||
|
||||
template <typename T> T oGetKey(const std::string &_rsKey) const;
|
||||
template <typename T>
|
||||
T oGetKey(const std::string& _rsKey) const;
|
||||
|
||||
// read only
|
||||
typedef std::list<Line>::const_iterator const_iterator;
|
||||
|
@ -136,8 +133,7 @@ class Section : private std::list<Line>
|
|||
std::string m_sName;
|
||||
};
|
||||
|
||||
class File : private std::list<Section>
|
||||
{
|
||||
class File : private std::list<Section> {
|
||||
public:
|
||||
File();
|
||||
File(const std::string& _rsFile);
|
||||
|
@ -176,7 +172,8 @@ class File : private std::list<Section>
|
|||
// debug
|
||||
std::ostream& operator<<(std::ostream& _roOut, const File& _roConfig);
|
||||
|
||||
template <typename T> void Section::vSetKey(const std::string &_rsKey, const T &_rValue)
|
||||
template <typename T>
|
||||
void Section::vSetKey(const std::string& _rsKey, const T& _rValue)
|
||||
{
|
||||
std::ostringstream oOut;
|
||||
oOut << _rValue;
|
||||
|
@ -189,7 +186,8 @@ template <typename T> void Section::vSetKey(const std::string &_rsKey, const T &
|
|||
push_back(Line(_rsKey, oOut.str()));
|
||||
}
|
||||
|
||||
template <typename T> T Section::oGetKey(const std::string &_rsKey) const
|
||||
template <typename T>
|
||||
T Section::oGetKey(const std::string& _rsKey) const
|
||||
{
|
||||
T oValue;
|
||||
for (const_iterator it = begin(); it != end(); it++) {
|
||||
|
|
|
@ -22,11 +22,9 @@
|
|||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
const DirectoriesConfigDialog::SDirEntry DirectoriesConfigDialog::m_astDirs[] =
|
||||
{
|
||||
const DirectoriesConfigDialog::SDirEntry DirectoriesConfigDialog::m_astDirs[] = {
|
||||
{ "gba_roms", N_("GBA roms :"), "GBARomsDirEntry" },
|
||||
{ "gb_roms", N_("GB roms :"), "GBRomsDirEntry" },
|
||||
{ "batteries", N_("Batteries :"), "BatteriesDirEntry" },
|
||||
|
@ -35,16 +33,15 @@ const DirectoriesConfigDialog::SDirEntry DirectoriesConfigDialog::m_astDirs[] =
|
|||
{ "captures", N_("Captures :"), "CapturesDirEntry" }
|
||||
};
|
||||
|
||||
DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) :
|
||||
Gtk::Dialog(_("Directories config"), true),
|
||||
m_poConfig(_poConfig)
|
||||
DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section* _poConfig)
|
||||
: Gtk::Dialog(_("Directories config"), true)
|
||||
, m_poConfig(_poConfig)
|
||||
{
|
||||
Gtk::Table* poTable = Gtk::manage(new Gtk::Table(G_N_ELEMENTS(m_astDirs), 2, false));
|
||||
poTable->set_border_width(5);
|
||||
poTable->set_spacings(5);
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++) {
|
||||
Gtk::Label* poLabel = Gtk::manage(new Gtk::Label(gettext(m_astDirs[i].m_csLabel), Gtk::ALIGN_END));
|
||||
m_poButtons[i] = Gtk::manage(new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
|
||||
m_poButtons[i]->set_current_folder(m_poConfig->sGetKey(m_astDirs[i].m_csKey));
|
||||
|
@ -60,8 +57,7 @@ DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) :
|
|||
|
||||
void DirectoriesConfigDialog::on_response(int response_id)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++) {
|
||||
m_poConfig->vSetKey(m_astDirs[i].m_csKey, m_poButtons[i]->get_current_folder());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
|
||||
#include "configfile.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class DirectoriesConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class DirectoriesConfigDialog : public Gtk::Dialog {
|
||||
public:
|
||||
DirectoriesConfigDialog(Config::Section* _poConfig);
|
||||
|
||||
|
|
|
@ -18,21 +18,20 @@
|
|||
|
||||
#include "displayconfig.h"
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "filters.h"
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
, m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("FiltersComboBox", m_poFiltersComboBox);
|
||||
refBuilder->get_widget("IBFiltersComboBox", m_poIBFiltersComboBox);
|
||||
|
@ -46,13 +45,11 @@ DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefP
|
|||
m_poOutputOpenGLRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputOpenGL));
|
||||
m_poOutputCairoRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputCairo));
|
||||
|
||||
|
||||
// Populate the filters combobox
|
||||
Glib::RefPtr<Gtk::ListStore> poFiltersListStore;
|
||||
poFiltersListStore = Glib::RefPtr<Gtk::ListStore>::cast_static(refBuilder->get_object("FiltersListStore"));
|
||||
|
||||
for (guint i = FirstFilter; i <= LastFilter; i++)
|
||||
{
|
||||
for (guint i = FirstFilter; i <= LastFilter; i++) {
|
||||
Gtk::TreeModel::Row row = *(poFiltersListStore->append());
|
||||
row->set_value(0, std::string(pcsGetFilterName((EFilter)i)));
|
||||
}
|
||||
|
@ -61,8 +58,7 @@ DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefP
|
|||
Glib::RefPtr<Gtk::ListStore> poIBFiltersListStore;
|
||||
poIBFiltersListStore = Glib::RefPtr<Gtk::ListStore>::cast_static(refBuilder->get_object("IBFiltersListStore"));
|
||||
|
||||
for (guint i = FirstFilterIB; i <= LastFilterIB; i++)
|
||||
{
|
||||
for (guint i = FirstFilterIB; i <= LastFilterIB; i++) {
|
||||
Gtk::TreeModel::Row row = *(poIBFiltersListStore->append());
|
||||
row->set_value(0, std::string(pcsGetFilterIBName((EFilterIB)i)));
|
||||
}
|
||||
|
@ -84,8 +80,7 @@ void DisplayConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window *
|
|||
|
||||
// Set the default output module
|
||||
VBA::Window::EVideoOutput _eOutput = (VBA::Window::EVideoOutput)m_poConfig->oGetKey<int>("output");
|
||||
switch (_eOutput)
|
||||
{
|
||||
switch (_eOutput) {
|
||||
case VBA::Window::OutputOpenGL:
|
||||
m_poOutputOpenGLRadioButton->set_active();
|
||||
break;
|
||||
|
@ -98,8 +93,7 @@ void DisplayConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window *
|
|||
void DisplayConfigDialog::vOnFilterChanged()
|
||||
{
|
||||
int iFilter = m_poFiltersComboBox->get_active_row_number();
|
||||
if (iFilter >= 0)
|
||||
{
|
||||
if (iFilter >= 0) {
|
||||
m_poConfig->vSetKey("filter2x", iFilter);
|
||||
m_poWindow->vApplyConfigFilter();
|
||||
}
|
||||
|
@ -108,8 +102,7 @@ void DisplayConfigDialog::vOnFilterChanged()
|
|||
void DisplayConfigDialog::vOnFilterIBChanged()
|
||||
{
|
||||
int iFilterIB = m_poIBFiltersComboBox->get_active_row_number();
|
||||
if (iFilterIB >= 0)
|
||||
{
|
||||
if (iFilterIB >= 0) {
|
||||
m_poConfig->vSetKey("filterIB", iFilterIB);
|
||||
m_poWindow->vApplyConfigFilterIB();
|
||||
}
|
||||
|
@ -122,12 +115,10 @@ void DisplayConfigDialog::vOnOutputChanged(VBA::Window::EVideoOutput _eOutput)
|
|||
if (_eOutput == eOldOutput)
|
||||
return;
|
||||
|
||||
if (_eOutput == VBA::Window::OutputOpenGL && m_poOutputOpenGLRadioButton->get_active())
|
||||
{
|
||||
if (_eOutput == VBA::Window::OutputOpenGL && m_poOutputOpenGLRadioButton->get_active()) {
|
||||
m_poConfig->vSetKey("output", VBA::Window::OutputOpenGL);
|
||||
m_poWindow->vApplyConfigScreenArea();
|
||||
} else if (_eOutput == VBA::Window::OutputCairo && m_poOutputCairoRadioButton->get_active())
|
||||
{
|
||||
} else if (_eOutput == VBA::Window::OutputCairo && m_poOutputCairoRadioButton->get_active()) {
|
||||
m_poConfig->vSetKey("output", VBA::Window::OutputCairo);
|
||||
m_poWindow->vApplyConfigScreenArea();
|
||||
}
|
||||
|
@ -136,8 +127,7 @@ void DisplayConfigDialog::vOnOutputChanged(VBA::Window::EVideoOutput _eOutput)
|
|||
void DisplayConfigDialog::vOnScaleChanged()
|
||||
{
|
||||
int iScale = m_poDefaultScaleComboBox->get_active_row_number() + 1;
|
||||
if (iScale > 0)
|
||||
{
|
||||
if (iScale > 0) {
|
||||
m_poConfig->vSetKey("scale", iScale);
|
||||
m_poWindow->vUpdateScreen();
|
||||
}
|
||||
|
|
|
@ -27,10 +27,8 @@
|
|||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class DisplayConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class DisplayConfigDialog : public Gtk::Dialog {
|
||||
public:
|
||||
DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
|
|
|
@ -48,16 +48,13 @@ void SmartIB32 (u8 *, u32, int, int);
|
|||
void MotionBlurIB(u8*, u32, int, int);
|
||||
void MotionBlurIB32(u8*, u32, int, int);
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
struct {
|
||||
char m_csName[30];
|
||||
int m_iEnlargeFactor;
|
||||
Filter m_apvFunc[2];
|
||||
}
|
||||
static const astFilters[] =
|
||||
{
|
||||
} static const astFilters[] = {
|
||||
{ N_("None"), 1, { 0, 0 } },
|
||||
{ N_("2xSaI"), 2, { _2xSaI, _2xSaI32 } },
|
||||
{ N_("Super 2xSaI"), 2, { Super2xSaI, Super2xSaI32 } },
|
||||
|
@ -76,9 +73,7 @@ static const astFilters[] =
|
|||
struct {
|
||||
char m_csName[30];
|
||||
FilterIB m_apvFunc[2];
|
||||
}
|
||||
static const astFiltersIB[] =
|
||||
{
|
||||
} static const astFiltersIB[] = {
|
||||
{ N_("None"), { 0, 0 } },
|
||||
{ N_("Smart interframe blending"), { SmartIB, SmartIB32 } },
|
||||
{ N_("Interframe motion blur"), { MotionBlurIB, MotionBlurIB32 } }
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
|
||||
int Init_2xSaI(u32);
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
typedef void (*Filter)(u8*, u32, u8*, u8*, u32, int, int);
|
||||
typedef void (*FilterIB)(u8*, u32, int, int);
|
||||
|
||||
|
@ -55,7 +54,8 @@ enum EFilterIB {
|
|||
LastFilterIB = FilterIBMotionBlur
|
||||
};
|
||||
|
||||
enum EFilterDepth { FilterDepth16, FilterDepth32 };
|
||||
enum EFilterDepth { FilterDepth16,
|
||||
FilterDepth32 };
|
||||
|
||||
Filter pvGetFilter(EFilter _eFilter, EFilterDepth _eDepth);
|
||||
const char* pcsGetFilterName(const EFilter _eFilter);
|
||||
|
|
|
@ -21,11 +21,10 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
GameBoyAdvanceCheatListDialog::GameBoyAdvanceCheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
CheatListDialog(_pstDialog, refBuilder)
|
||||
GameBoyAdvanceCheatListDialog::GameBoyAdvanceCheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: CheatListDialog(_pstDialog, refBuilder)
|
||||
{
|
||||
vUpdateList();
|
||||
}
|
||||
|
@ -34,19 +33,16 @@ void GameBoyAdvanceCheatListDialog::vAddCheat(Glib::ustring sDesc, ECheatType ty
|
|||
{
|
||||
int previous = cheatsNumber;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
// Generic Code
|
||||
case CheatGeneric:
|
||||
{
|
||||
case CheatGeneric: {
|
||||
std::vector<Glib::ustring> tokens;
|
||||
|
||||
vTokenize(buffer->get_text(), tokens);
|
||||
|
||||
for (std::vector<Glib::ustring>::iterator it = tokens.begin();
|
||||
it != tokens.end();
|
||||
it++)
|
||||
{
|
||||
it++) {
|
||||
Glib::ustring sToken = it->uppercase();
|
||||
|
||||
cheatsAddCheatCode(sToken.c_str(), sDesc.c_str());
|
||||
|
@ -56,8 +52,7 @@ void GameBoyAdvanceCheatListDialog::vAddCheat(Glib::ustring sDesc, ECheatType ty
|
|||
}
|
||||
// Gameshark Advance & CodeBreaker Advance
|
||||
case CheatGSA:
|
||||
case CheatCBA:
|
||||
{
|
||||
case CheatCBA: {
|
||||
std::vector<Glib::ustring> tokens;
|
||||
|
||||
Glib::ustring sToken;
|
||||
|
@ -68,35 +63,27 @@ void GameBoyAdvanceCheatListDialog::vAddCheat(Glib::ustring sDesc, ECheatType ty
|
|||
|
||||
for (std::vector<Glib::ustring>::iterator it = tokens.begin();
|
||||
it != tokens.end();
|
||||
it++)
|
||||
{
|
||||
it++) {
|
||||
|
||||
sToken = it->uppercase();
|
||||
const char* cToken = sToken.c_str();
|
||||
|
||||
if (sToken.size() == 16)
|
||||
cheatsAddGSACode(cToken, sDesc.c_str(), false);
|
||||
else if (sToken.size() == 12)
|
||||
{
|
||||
else if (sToken.size() == 12) {
|
||||
sCode = sToken.substr(0, 8);
|
||||
sCode += " ";
|
||||
sCode += sToken.substr(9, 4);
|
||||
cheatsAddCBACode(sCode.c_str(), sDesc.c_str());
|
||||
}
|
||||
else
|
||||
if (sPart.empty())
|
||||
} else if (sPart.empty())
|
||||
sPart = sToken;
|
||||
else
|
||||
{
|
||||
if (sToken.size() == 4)
|
||||
{
|
||||
else {
|
||||
if (sToken.size() == 4) {
|
||||
sCode = sPart;
|
||||
sCode += " ";
|
||||
sCode += cToken;
|
||||
cheatsAddCBACode(sCode.c_str(), sDesc.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sCode = sPart + sToken;
|
||||
cheatsAddGSACode(sCode.c_str(), sDesc.c_str(), true);
|
||||
}
|
||||
|
@ -122,15 +109,18 @@ void GameBoyAdvanceCheatListDialog::vCheatListSave(const char *file)
|
|||
cheatsSaveCheatList(file);
|
||||
}
|
||||
|
||||
void GameBoyAdvanceCheatListDialog::vRemoveCheat(int index) {
|
||||
void GameBoyAdvanceCheatListDialog::vRemoveCheat(int index)
|
||||
{
|
||||
cheatsDelete(index, false);
|
||||
}
|
||||
|
||||
void GameBoyAdvanceCheatListDialog::vRemoveAllCheats() {
|
||||
void GameBoyAdvanceCheatListDialog::vRemoveAllCheats()
|
||||
{
|
||||
cheatsDeleteAll(false);
|
||||
}
|
||||
|
||||
void GameBoyAdvanceCheatListDialog::vToggleCheat(int index, bool enable) {
|
||||
void GameBoyAdvanceCheatListDialog::vToggleCheat(int index, bool enable)
|
||||
{
|
||||
if (enable)
|
||||
cheatsEnable(index);
|
||||
else
|
||||
|
@ -139,8 +129,7 @@ void GameBoyAdvanceCheatListDialog::vToggleCheat(int index, bool enable) {
|
|||
|
||||
void GameBoyAdvanceCheatListDialog::vUpdateList(int previous)
|
||||
{
|
||||
for (int i = previous; i < cheatsNumber; i++)
|
||||
{
|
||||
for (int i = previous; i < cheatsNumber; i++) {
|
||||
// Add row for each newly added cheat
|
||||
Gtk::TreeModel::Row row = *(m_poCheatListStore->append());
|
||||
|
||||
|
|
|
@ -25,10 +25,8 @@
|
|||
#include "../gba/Globals.h"
|
||||
#include "cheatlist.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class GameBoyAdvanceCheatListDialog : public CheatListDialog
|
||||
{
|
||||
namespace VBA {
|
||||
class GameBoyAdvanceCheatListDialog : public CheatListDialog {
|
||||
public:
|
||||
GameBoyAdvanceCheatListDialog(GtkDialog* _pstDialog,
|
||||
const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
|
|
@ -20,12 +20,11 @@
|
|||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
GameBoyAdvanceConfigDialog::GameBoyAdvanceConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
GameBoyAdvanceConfigDialog::GameBoyAdvanceConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
, m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("SaveTypeComboBox", m_poSaveTypeComboBox);
|
||||
refBuilder->get_widget("FlashSizeComboBox", m_poFlashSizeComboBox);
|
||||
|
@ -49,12 +48,9 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
|
|||
m_poSaveTypeComboBox->set_active(eDefaultSaveType);
|
||||
|
||||
int iDefaultFlashSize = m_poConfig->oGetKey<int>("flash_size");
|
||||
if (iDefaultFlashSize == 128)
|
||||
{
|
||||
if (iDefaultFlashSize == 128) {
|
||||
m_poFlashSizeComboBox->set_active(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
m_poFlashSizeComboBox->set_active(0);
|
||||
}
|
||||
|
||||
|
@ -65,8 +61,7 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
|
|||
std::string sBios = m_poConfig->oGetKey<std::string>("bios_file");
|
||||
m_poBiosFileChooserButton->set_filename(sBios);
|
||||
|
||||
const char * acsPattern[] =
|
||||
{
|
||||
const char* acsPattern[] = {
|
||||
"*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]",
|
||||
"*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]"
|
||||
};
|
||||
|
@ -78,8 +73,7 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
|
|||
|
||||
Gtk::FileFilter oBiosFilter;
|
||||
oBiosFilter.set_name(_("Gameboy Advance BIOS"));
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) {
|
||||
oBiosFilter.add_pattern(acsPattern[i]);
|
||||
}
|
||||
#else
|
||||
|
@ -89,8 +83,7 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
|
|||
|
||||
const Glib::RefPtr<Gtk::FileFilter> oBiosFilter = Gtk::FileFilter::create();
|
||||
oBiosFilter->set_name(_("Gameboy Advance BIOS"));
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) {
|
||||
oBiosFilter->add_pattern(acsPattern[i]);
|
||||
}
|
||||
#endif
|
||||
|
@ -113,12 +106,9 @@ void GameBoyAdvanceConfigDialog::vOnSaveTypeChanged()
|
|||
void GameBoyAdvanceConfigDialog::vOnFlashSizeChanged()
|
||||
{
|
||||
int iFlashSize = m_poFlashSizeComboBox->get_active_row_number();
|
||||
if (iFlashSize == 0)
|
||||
{
|
||||
if (iFlashSize == 0) {
|
||||
m_poConfig->vSetKey("flash_size", 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
m_poConfig->vSetKey("flash_size", 128);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class GameBoyAdvanceConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class GameBoyAdvanceConfigDialog : public Gtk::Dialog {
|
||||
public:
|
||||
GameBoyAdvanceConfigDialog(GtkDialog* _pstDialog,
|
||||
const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
|
|
@ -21,11 +21,10 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
GameBoyCheatListDialog::GameBoyCheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
CheatListDialog(_pstDialog, refBuilder)
|
||||
GameBoyCheatListDialog::GameBoyCheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: CheatListDialog(_pstDialog, refBuilder)
|
||||
{
|
||||
vUpdateList();
|
||||
}
|
||||
|
@ -34,19 +33,16 @@ void GameBoyCheatListDialog::vAddCheat(Glib::ustring sDesc, ECheatType type, Gli
|
|||
{
|
||||
int previous = gbCheatNumber;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
// GameShark
|
||||
case CheatGS:
|
||||
{
|
||||
case CheatGS: {
|
||||
std::vector<Glib::ustring> tokens;
|
||||
|
||||
vTokenize(buffer->get_text(), tokens);
|
||||
|
||||
for (std::vector<Glib::ustring>::iterator it = tokens.begin();
|
||||
it != tokens.end();
|
||||
it++)
|
||||
{
|
||||
it++) {
|
||||
Glib::ustring sToken = it->uppercase();
|
||||
|
||||
gbAddGsCheat(sToken.c_str(), sDesc.c_str());
|
||||
|
@ -55,16 +51,14 @@ void GameBoyCheatListDialog::vAddCheat(Glib::ustring sDesc, ECheatType type, Gli
|
|||
break;
|
||||
}
|
||||
// GameGenie
|
||||
case CheatGG:
|
||||
{
|
||||
case CheatGG: {
|
||||
std::vector<Glib::ustring> tokens;
|
||||
|
||||
vTokenize(buffer->get_text(), tokens);
|
||||
|
||||
for (std::vector<Glib::ustring>::iterator it = tokens.begin();
|
||||
it != tokens.end();
|
||||
it++)
|
||||
{
|
||||
it++) {
|
||||
Glib::ustring sToken = it->uppercase();
|
||||
|
||||
gbAddGgCheat(sToken.c_str(), sDesc.c_str());
|
||||
|
@ -99,7 +93,8 @@ void GameBoyCheatListDialog::vRemoveAllCheats()
|
|||
gbCheatRemoveAll();
|
||||
}
|
||||
|
||||
void GameBoyCheatListDialog::vToggleCheat(int index, bool enable) {
|
||||
void GameBoyCheatListDialog::vToggleCheat(int index, bool enable)
|
||||
{
|
||||
if (enable)
|
||||
gbCheatEnable(index);
|
||||
else
|
||||
|
@ -108,8 +103,7 @@ void GameBoyCheatListDialog::vToggleCheat(int index, bool enable) {
|
|||
|
||||
void GameBoyCheatListDialog::vUpdateList(int previous)
|
||||
{
|
||||
for (int i = previous; i < gbCheatNumber; i++)
|
||||
{
|
||||
for (int i = previous; i < gbCheatNumber; i++) {
|
||||
// Add row for each newly added cheat
|
||||
Gtk::TreeModel::Row row = *(m_poCheatListStore->append());
|
||||
|
||||
|
|
|
@ -22,10 +22,8 @@
|
|||
#include "../gb/gbCheats.h"
|
||||
#include "cheatlist.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class GameBoyCheatListDialog : public CheatListDialog
|
||||
{
|
||||
namespace VBA {
|
||||
class GameBoyCheatListDialog : public CheatListDialog {
|
||||
public:
|
||||
GameBoyCheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
|
|
|
@ -18,17 +18,15 @@
|
|||
|
||||
#include "gameboyconfig.h"
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
static const VBA::Window::EEmulatorType aEmulatorType[] =
|
||||
{
|
||||
static const VBA::Window::EEmulatorType aEmulatorType[] = {
|
||||
VBA::Window::EmulatorAuto,
|
||||
VBA::Window::EmulatorCGB,
|
||||
VBA::Window::EmulatorSGB,
|
||||
|
@ -37,9 +35,9 @@ static const VBA::Window::EEmulatorType aEmulatorType[] =
|
|||
VBA::Window::EmulatorSGB2
|
||||
};
|
||||
|
||||
GameBoyConfigDialog::GameBoyConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
GameBoyConfigDialog::GameBoyConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
, m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("SystemComboBox", m_poSystemComboBox);
|
||||
refBuilder->get_widget("BorderCheckButton", m_poBorderCheckButton);
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class GameBoyConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class GameBoyConfigDialog : public Gtk::Dialog {
|
||||
public:
|
||||
GameBoyConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
|
|
|
@ -18,18 +18,17 @@
|
|||
|
||||
#include "generalconfig.h"
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
PreferencesDialog::PreferencesDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
PreferencesDialog::PreferencesDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
, m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("PauseWhenInactiveCheckButton", m_poPauseWhenInactiveCheckButton);
|
||||
refBuilder->get_widget("FrameSkipAutomaticCheckButton", m_poFrameSkipAutomaticCheckButton);
|
||||
|
@ -40,7 +39,6 @@ PreferencesDialog::PreferencesDialog(GtkDialog* _pstDialog, const Glib::RefPtr<G
|
|||
m_poFrameSkipAutomaticCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnFrameskipChanged));
|
||||
m_poFrameSkipLevelSpinButton->signal_changed().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnFrameskipChanged));
|
||||
m_poSpeedIndicatorComboBox->signal_changed().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnSpeedIndicatorChanged));
|
||||
|
||||
}
|
||||
|
||||
void PreferencesDialog::vSetConfig(Config::Section* _poConfig, VBA::Window* _poWindow)
|
||||
|
@ -78,12 +76,9 @@ void PreferencesDialog::vOnFrameskipChanged()
|
|||
{
|
||||
bool bAutoFrameskip = m_poFrameSkipAutomaticCheckButton->get_active();
|
||||
|
||||
if (bAutoFrameskip)
|
||||
{
|
||||
if (bAutoFrameskip) {
|
||||
m_poConfig->vSetKey("frameskip", "auto");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int iFrameskip = m_poFrameSkipLevelSpinButton->get_value();
|
||||
m_poConfig->vSetKey("frameskip", iFrameskip);
|
||||
}
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class PreferencesDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class PreferencesDialog : public Gtk::Dialog {
|
||||
public:
|
||||
PreferencesDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
|
|
|
@ -23,11 +23,9 @@
|
|||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] =
|
||||
{
|
||||
const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] = {
|
||||
{ KEY_UP, N_("Up :") },
|
||||
{ KEY_DOWN, N_("Down :") },
|
||||
{ KEY_LEFT, N_("Left :") },
|
||||
|
@ -44,16 +42,16 @@ const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] =
|
|||
{ KEY_BUTTON_AUTO_B, N_("Autofire B :") }
|
||||
};
|
||||
|
||||
JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
|
||||
Gtk::Dialog(_("Joypad config"), true),
|
||||
m_oTitleHBox(false, 5),
|
||||
m_oTitleLabel(_("Joypad :"), Gtk::ALIGN_END),
|
||||
m_oDefaultJoypad(_("Default joypad")),
|
||||
m_oTable(G_N_ELEMENTS(m_astKeys), 2, false),
|
||||
m_iCurrentEntry(-1),
|
||||
m_bUpdating(false),
|
||||
m_ePad(PAD_MAIN),
|
||||
m_poConfig(_poConfig)
|
||||
JoypadConfigDialog::JoypadConfigDialog(Config::Section* _poConfig)
|
||||
: Gtk::Dialog(_("Joypad config"), true)
|
||||
, m_oTitleHBox(false, 5)
|
||||
, m_oTitleLabel(_("Joypad :"), Gtk::ALIGN_END)
|
||||
, m_oDefaultJoypad(_("Default joypad"))
|
||||
, m_oTable(G_N_ELEMENTS(m_astKeys), 2, false)
|
||||
, m_iCurrentEntry(-1)
|
||||
, m_bUpdating(false)
|
||||
, m_ePad(PAD_MAIN)
|
||||
, m_poConfig(_poConfig)
|
||||
{
|
||||
// Joypad selection
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
|
@ -72,8 +70,7 @@ JoypadConfigDialog::JoypadConfigDialog(Config::Section * _poConfig) :
|
|||
m_oTitleHBox.pack_start(m_oTitleCombo);
|
||||
|
||||
// Joypad buttons
|
||||
for (guint i = 0; i < G_N_ELEMENTS(m_astKeys); i++)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(m_astKeys); i++) {
|
||||
Gtk::Label* poLabel = Gtk::manage(new Gtk::Label(gettext(m_astKeys[i].m_csKeyName), Gtk::ALIGN_END));
|
||||
Gtk::Entry* poEntry = Gtk::manage(new Gtk::Entry());
|
||||
m_oTable.attach(*poLabel, 0, 1, i, i + 1);
|
||||
|
@ -121,60 +118,55 @@ void JoypadConfigDialog::vUpdateEntries()
|
|||
m_bUpdating = true;
|
||||
m_oDefaultJoypad.set_active(inputGetDefaultJoypad() == m_ePad);
|
||||
|
||||
for (guint i = 0; i < m_oEntries.size(); i++)
|
||||
{
|
||||
for (guint i = 0; i < m_oEntries.size(); i++) {
|
||||
std::string csName;
|
||||
|
||||
guint uiKeyval = inputGetKeymap(m_ePad, m_astKeys[i].m_eKeyFlag);
|
||||
int dev = uiKeyval >> 16;
|
||||
if (dev == 0)
|
||||
{
|
||||
if (dev == 0) {
|
||||
csName = gdk_keyval_name(uiKeyval);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int what = uiKeyval & 0xffff;
|
||||
std::stringstream os;
|
||||
os << _("Joy ") << dev;
|
||||
|
||||
if(what >= 128)
|
||||
{
|
||||
if (what >= 128) {
|
||||
// joystick button
|
||||
int button = what - 128;
|
||||
os << _(" Button ") << button;
|
||||
}
|
||||
else if (what < 0x20)
|
||||
{
|
||||
} else if (what < 0x20) {
|
||||
// joystick axis
|
||||
int dir = what & 1;
|
||||
what >>= 1;
|
||||
os << _(" Axis ") << what << (dir ? '-' : '+');
|
||||
}
|
||||
else if (what < 0x30)
|
||||
{
|
||||
} else if (what < 0x30) {
|
||||
// joystick hat
|
||||
int dir = (what & 3);
|
||||
what = (what & 15);
|
||||
what >>= 2;
|
||||
os << _(" Hat ") << what << " ";
|
||||
switch (dir)
|
||||
{
|
||||
case 0: os << _("Up"); break;
|
||||
case 1: os << _("Down"); break;
|
||||
case 2: os << _("Right"); break;
|
||||
case 3: os << _("Left"); break;
|
||||
switch (dir) {
|
||||
case 0:
|
||||
os << _("Up");
|
||||
break;
|
||||
case 1:
|
||||
os << _("Down");
|
||||
break;
|
||||
case 2:
|
||||
os << _("Right");
|
||||
break;
|
||||
case 3:
|
||||
os << _("Left");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
csName = os.str();
|
||||
}
|
||||
|
||||
if (csName.empty())
|
||||
{
|
||||
if (csName.empty()) {
|
||||
m_oEntries[i]->set_text(_("<Undefined>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
m_oEntries[i]->set_text(csName);
|
||||
}
|
||||
}
|
||||
|
@ -199,8 +191,7 @@ bool JoypadConfigDialog::bOnEntryFocusOut(GdkEventFocus * _pstEvent)
|
|||
|
||||
bool JoypadConfigDialog::on_key_press_event(GdkEventKey* _pstEvent)
|
||||
{
|
||||
if (m_iCurrentEntry < 0)
|
||||
{
|
||||
if (m_iCurrentEntry < 0) {
|
||||
return Gtk::Window::on_key_press_event(_pstEvent);
|
||||
}
|
||||
|
||||
|
@ -224,22 +215,19 @@ void JoypadConfigDialog::on_response(int response_id)
|
|||
|
||||
void JoypadConfigDialog::vOnInputEvent(const SDL_Event& event)
|
||||
{
|
||||
if (m_iCurrentEntry < 0)
|
||||
{
|
||||
if (m_iCurrentEntry < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int code = inputGetEventCode(event);
|
||||
if (!code) return;
|
||||
if (!code)
|
||||
return;
|
||||
inputSetKeymap(m_ePad, m_astKeys[m_iCurrentEntry].m_eKeyFlag, code);
|
||||
vUpdateEntries();
|
||||
|
||||
if (m_iCurrentEntry + 1 < (gint)m_oEntries.size())
|
||||
{
|
||||
if (m_iCurrentEntry + 1 < (gint)m_oEntries.size()) {
|
||||
m_oEntries[m_iCurrentEntry + 1]->grab_focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
m_poOkButton->grab_focus();
|
||||
}
|
||||
}
|
||||
|
@ -247,17 +235,15 @@ void JoypadConfigDialog::vOnInputEvent(const SDL_Event &event)
|
|||
bool JoypadConfigDialog::bOnConfigIdle()
|
||||
{
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_JOYAXISMOTION:
|
||||
if (abs(event.jaxis.value) < 16384) continue;
|
||||
if (abs(event.jaxis.value) < 16384)
|
||||
continue;
|
||||
if (event.jaxis.which != m_oPreviousEvent.jaxis.which
|
||||
|| event.jaxis.axis != m_oPreviousEvent.jaxis.axis
|
||||
|| (event.jaxis.value > 0 && m_oPreviousEvent.jaxis.value < 0)
|
||||
|| (event.jaxis.value < 0 && m_oPreviousEvent.jaxis.value > 0))
|
||||
{
|
||||
|| (event.jaxis.value < 0 && m_oPreviousEvent.jaxis.value > 0)) {
|
||||
vOnInputEvent(event);
|
||||
m_oPreviousEvent = event;
|
||||
}
|
||||
|
@ -268,8 +254,7 @@ bool JoypadConfigDialog::bOnConfigIdle()
|
|||
vEmptyEventQueue();
|
||||
break;
|
||||
case SDL_JOYHATMOTION:
|
||||
if (event.jhat.value)
|
||||
{
|
||||
if (event.jhat.value) {
|
||||
vOnInputEvent(event);
|
||||
vEmptyEventQueue();
|
||||
}
|
||||
|
@ -284,27 +269,21 @@ void JoypadConfigDialog::vEmptyEventQueue()
|
|||
{
|
||||
// Empty the SDL event queue
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event));
|
||||
while (SDL_PollEvent(&event))
|
||||
;
|
||||
}
|
||||
|
||||
void JoypadConfigDialog::vOnJoypadSelect()
|
||||
{
|
||||
std::string oText = m_oTitleCombo.get_active_text();
|
||||
|
||||
if (oText == "1")
|
||||
{
|
||||
if (oText == "1") {
|
||||
m_ePad = PAD_1;
|
||||
}
|
||||
else if (oText == "2")
|
||||
{
|
||||
} else if (oText == "2") {
|
||||
m_ePad = PAD_2;
|
||||
}
|
||||
else if (oText == "3")
|
||||
{
|
||||
} else if (oText == "3") {
|
||||
m_ePad = PAD_3;
|
||||
}
|
||||
else if (oText == "4")
|
||||
{
|
||||
} else if (oText == "4") {
|
||||
m_ePad = PAD_4;
|
||||
}
|
||||
|
||||
|
@ -316,14 +295,12 @@ void JoypadConfigDialog::vOnJoypadSelect()
|
|||
|
||||
void JoypadConfigDialog::vOnDefaultJoypadSelect()
|
||||
{
|
||||
if (m_bUpdating) return;
|
||||
if (m_bUpdating)
|
||||
return;
|
||||
|
||||
if (m_oDefaultJoypad.get_active())
|
||||
{
|
||||
if (m_oDefaultJoypad.get_active()) {
|
||||
inputSetDefaultJoypad(m_ePad);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
inputSetDefaultJoypad(PAD_MAIN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,8 @@
|
|||
#include "../sdl/inputSDL.h"
|
||||
#include "configfile.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class JoypadConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class JoypadConfigDialog : public Gtk::Dialog {
|
||||
public:
|
||||
JoypadConfigDialog(Config::Section* _poConfig);
|
||||
virtual ~JoypadConfigDialog();
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include <gtkmm/main.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <gtkmm/main.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <gtkmm/window.h>
|
||||
|
||||
#if defined(USE_OPENGL) && !GTK_CHECK_VERSION(3, 0, 0)
|
||||
#include <gtkmm/gl/init.h>
|
||||
|
@ -28,8 +28,8 @@
|
|||
// this will be ifdefed soon
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "window.h"
|
||||
#include "intl.h"
|
||||
#include "window.h"
|
||||
|
||||
int systemDebug = 0;
|
||||
|
||||
|
@ -70,12 +70,9 @@ int main(int argc, char * argv[])
|
|||
|
||||
oContext.set_main_group(oGroup);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
oContext.parse(argc, argv);
|
||||
}
|
||||
catch (const Glib::Error& e)
|
||||
{
|
||||
} catch (const Glib::Error& e) {
|
||||
Gtk::MessageDialog oDialog(e.what(),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
|
@ -84,8 +81,7 @@ int main(int argc, char * argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (bShowVersion)
|
||||
{
|
||||
if (bShowVersion) {
|
||||
g_print(_("VisualBoyAdvance version %s [GTK+]\n"), VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -95,14 +91,11 @@ int main(int argc, char * argv[])
|
|||
std::string sGtkBuilderFile = VBA::Window::sGetUiFilePath("vbam.ui");
|
||||
|
||||
Glib::RefPtr<Gtk::Builder> poXml;
|
||||
try
|
||||
{
|
||||
try {
|
||||
poXml = Gtk::Builder::create();
|
||||
poXml->add_from_file(sGtkBuilderFile, "accelgroup1");
|
||||
poXml->add_from_file(sGtkBuilderFile, "MainWindow");
|
||||
}
|
||||
catch (const Gtk::BuilderError & e)
|
||||
{
|
||||
} catch (const Gtk::BuilderError& e) {
|
||||
Gtk::MessageDialog oDialog(e.what(),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
|
@ -114,12 +107,10 @@ int main(int argc, char * argv[])
|
|||
VBA::Window* poWindow = NULL;
|
||||
poXml->get_widget_derived<VBA::Window>("MainWindow", poWindow);
|
||||
|
||||
if (listRemaining.size() == 1)
|
||||
{
|
||||
if (listRemaining.size() == 1) {
|
||||
// Display the window before loading the file
|
||||
poWindow->show();
|
||||
while (Gtk::Main::events_pending())
|
||||
{
|
||||
while (Gtk::Main::events_pending()) {
|
||||
Gtk::Main::iteration();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
template<typename T> T min( T x, T y ) { return x < y ? x : y; }
|
||||
template<typename T> T max( T x, T y ) { return x > y ? x : y; }
|
||||
template <typename T>
|
||||
T min(T x, T y) { return x < y ? x : y; }
|
||||
template <typename T>
|
||||
T max(T x, T y) { return x > y ? x : y; }
|
||||
|
||||
ScreenAreaCairo::ScreenAreaCairo(int _iWidth, int _iHeight, int _iScale) :
|
||||
ScreenArea(_iWidth, _iHeight, _iScale)
|
||||
ScreenAreaCairo::ScreenAreaCairo(int _iWidth, int _iHeight, int _iScale)
|
||||
: ScreenArea(_iWidth, _iHeight, _iScale)
|
||||
{
|
||||
vUpdateSize();
|
||||
}
|
||||
|
@ -100,8 +101,7 @@ bool ScreenAreaCairo::on_draw(const Cairo::RefPtr<Cairo::Context> &poContext)
|
|||
|
||||
void ScreenAreaCairo::vDrawBlackScreen()
|
||||
{
|
||||
if (m_puiPixels && get_realized())
|
||||
{
|
||||
if (m_puiPixels && get_realized()) {
|
||||
memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32));
|
||||
queue_draw_area(0, 0, get_width(), get_height());
|
||||
}
|
||||
|
|
|
@ -22,10 +22,8 @@
|
|||
|
||||
#include "screenarea.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class ScreenAreaCairo : public ScreenArea
|
||||
{
|
||||
namespace VBA {
|
||||
class ScreenAreaCairo : public ScreenArea {
|
||||
public:
|
||||
ScreenAreaCairo(int _iWidth, int _iHeight, int _iScale = 1);
|
||||
void vDrawPixels(u8* _puiData);
|
||||
|
|
|
@ -21,23 +21,22 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
template<typename T> T min( T x, T y ) { return x < y ? x : y; }
|
||||
template<typename T> T max( T x, T y ) { return x > y ? x : y; }
|
||||
template <typename T>
|
||||
T min(T x, T y) { return x < y ? x : y; }
|
||||
template <typename T>
|
||||
T max(T x, T y) { return x > y ? x : y; }
|
||||
|
||||
ScreenAreaGl::ScreenAreaGl(int _iWidth, int _iHeight, int _iScale) :
|
||||
ScreenArea(_iWidth, _iHeight, _iScale),
|
||||
m_uiScreenTexture(0),
|
||||
m_iTextureSize(0)
|
||||
ScreenAreaGl::ScreenAreaGl(int _iWidth, int _iHeight, int _iScale)
|
||||
: ScreenArea(_iWidth, _iHeight, _iScale)
|
||||
, m_uiScreenTexture(0)
|
||||
, m_iTextureSize(0)
|
||||
{
|
||||
Glib::RefPtr<Gdk::GL::Config> glconfig;
|
||||
|
||||
glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB |
|
||||
Gdk::GL::MODE_DOUBLE);
|
||||
if (!glconfig)
|
||||
{
|
||||
glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB | Gdk::GL::MODE_DOUBLE);
|
||||
if (!glconfig) {
|
||||
fprintf(stderr, _("*** OpenGL : Cannot open display.\n"));
|
||||
throw std::exception();
|
||||
}
|
||||
|
@ -52,8 +51,10 @@ void ScreenAreaGl::vUpdateTexture()
|
|||
// Calculate the new texture size as a the smallest working power of two
|
||||
// TODO: Support the ARB_texture_rectangle extension
|
||||
int iExpX = 0, iExpY = 0;
|
||||
for (int i = m_iScaledWidth; i; i >>= 1, ++iExpX);
|
||||
for (int i = m_iScaledHeight; i; i >>= 1, ++iExpY);
|
||||
for (int i = m_iScaledWidth; i; i >>= 1, ++iExpX)
|
||||
;
|
||||
for (int i = m_iScaledHeight; i; i >>= 1, ++iExpY)
|
||||
;
|
||||
int iNewTextureSize = 1 << max(iExpX, iExpY);
|
||||
|
||||
// Notify the system if the texture size changed
|
||||
|
@ -109,8 +110,7 @@ void ScreenAreaGl::vDrawPixels(u8 * _puiData)
|
|||
|
||||
void ScreenAreaGl::vDrawBlackScreen()
|
||||
{
|
||||
if (m_puiPixels && get_realized())
|
||||
{
|
||||
if (m_puiPixels && get_realized()) {
|
||||
memset(m_puiPixels, 0, m_iHeight * (m_iWidth + 1) * sizeof(u32));
|
||||
queue_draw_area(0, 0, get_width(), get_height());
|
||||
}
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
#include "screenarea.h"
|
||||
#include <gtkmm/gl/widget.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class ScreenAreaGl : public ScreenArea, public Gtk::GL::Widget<ScreenAreaGl>
|
||||
{
|
||||
namespace VBA {
|
||||
class ScreenAreaGl : public ScreenArea, public Gtk::GL::Widget<ScreenAreaGl> {
|
||||
public:
|
||||
ScreenAreaGl(int _iWidth, int _iHeight, int _iScale = 1);
|
||||
void vDrawPixels(u8* _puiData);
|
||||
|
|
|
@ -21,19 +21,18 @@
|
|||
#include <cstring>
|
||||
#include <glibmm/main.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
|
||||
m_iFilterScale(1),
|
||||
m_vFilter2x(NULL),
|
||||
m_vFilterIB(NULL),
|
||||
m_puiPixels(NULL),
|
||||
m_puiDelta(NULL),
|
||||
m_iScaledWidth(_iWidth),
|
||||
m_iScaledHeight(_iHeight),
|
||||
m_bEnableRender(true),
|
||||
m_bShowCursor(true)
|
||||
ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale)
|
||||
: m_iFilterScale(1)
|
||||
, m_vFilter2x(NULL)
|
||||
, m_vFilterIB(NULL)
|
||||
, m_puiPixels(NULL)
|
||||
, m_puiDelta(NULL)
|
||||
, m_iScaledWidth(_iWidth)
|
||||
, m_iScaledHeight(_iHeight)
|
||||
, m_bEnableRender(true)
|
||||
, m_bShowCursor(true)
|
||||
{
|
||||
g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1);
|
||||
|
||||
|
@ -58,19 +57,16 @@ ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
|
|||
|
||||
ScreenArea::~ScreenArea()
|
||||
{
|
||||
if (m_puiPixels)
|
||||
{
|
||||
if (m_puiPixels) {
|
||||
delete[] m_puiPixels;
|
||||
}
|
||||
|
||||
if (m_puiDelta)
|
||||
{
|
||||
if (m_puiDelta) {
|
||||
delete[] m_puiDelta;
|
||||
}
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
if (m_poEmptyCursor != NULL)
|
||||
{
|
||||
if (m_poEmptyCursor != NULL) {
|
||||
delete m_poEmptyCursor;
|
||||
}
|
||||
#else
|
||||
|
@ -82,8 +78,7 @@ void ScreenArea::vSetSize(int _iWidth, int _iHeight)
|
|||
{
|
||||
g_return_if_fail(_iWidth >= 1 && _iHeight >= 1);
|
||||
|
||||
if (_iWidth != m_iWidth || _iHeight != m_iHeight)
|
||||
{
|
||||
if (_iWidth != m_iWidth || _iHeight != m_iHeight) {
|
||||
m_iWidth = _iWidth;
|
||||
m_iHeight = _iHeight;
|
||||
vUpdateSize();
|
||||
|
@ -94,8 +89,7 @@ void ScreenArea::vSetScale(int _iScale)
|
|||
{
|
||||
g_return_if_fail(_iScale >= 1);
|
||||
|
||||
if (_iScale == 1)
|
||||
{
|
||||
if (_iScale == 1) {
|
||||
vSetFilter(FilterNone);
|
||||
}
|
||||
|
||||
|
@ -108,8 +102,7 @@ void ScreenArea::vSetFilter(EFilter _eFilter)
|
|||
m_vFilter2x = pvGetFilter(_eFilter, FilterDepth32);
|
||||
|
||||
m_iFilterScale = 1;
|
||||
if (m_vFilter2x != NULL)
|
||||
{
|
||||
if (m_vFilter2x != NULL) {
|
||||
m_iFilterScale = 2;
|
||||
}
|
||||
|
||||
|
@ -152,8 +145,7 @@ void ScreenArea::vShowCursor()
|
|||
|
||||
bool ScreenArea::on_motion_notify_event(GdkEventMotion* _pstEvent)
|
||||
{
|
||||
if (! m_bShowCursor)
|
||||
{
|
||||
if (!m_bShowCursor) {
|
||||
vShowCursor();
|
||||
}
|
||||
vStartCursorTimeout();
|
||||
|
@ -169,8 +161,7 @@ bool ScreenArea::on_enter_notify_event(GdkEventCrossing * _pstEvent)
|
|||
bool ScreenArea::on_leave_notify_event(GdkEventCrossing* _pstEvent)
|
||||
{
|
||||
vStopCursorTimeout();
|
||||
if (! m_bShowCursor)
|
||||
{
|
||||
if (!m_bShowCursor) {
|
||||
vShowCursor();
|
||||
}
|
||||
return false;
|
||||
|
@ -187,16 +178,14 @@ void ScreenArea::vDrawPixels(u8 * _puiData)
|
|||
const int iSrcPitch = (m_iWidth + 1) * sizeof(u32);
|
||||
const int iScaledPitch = (m_iScaledWidth + 1) * sizeof(u32);
|
||||
|
||||
if (m_vFilterIB != NULL)
|
||||
{
|
||||
if (m_vFilterIB != NULL) {
|
||||
m_vFilterIB(_puiData + iSrcPitch,
|
||||
iSrcPitch,
|
||||
m_iWidth,
|
||||
m_iHeight);
|
||||
}
|
||||
|
||||
if (m_vFilter2x != NULL)
|
||||
{
|
||||
if (m_vFilter2x != NULL) {
|
||||
m_vFilter2x(_puiData + iSrcPitch,
|
||||
iSrcPitch,
|
||||
m_puiDelta,
|
||||
|
@ -204,22 +193,18 @@ void ScreenArea::vDrawPixels(u8 * _puiData)
|
|||
iScaledPitch,
|
||||
m_iWidth,
|
||||
m_iHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
memcpy(m_puiPixels, _puiData + iSrcPitch, m_iHeight * iSrcPitch);
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenArea::vUpdateSize()
|
||||
{
|
||||
if (m_puiPixels)
|
||||
{
|
||||
if (m_puiPixels) {
|
||||
delete[] m_puiPixels;
|
||||
}
|
||||
|
||||
if (m_puiDelta)
|
||||
{
|
||||
if (m_puiDelta) {
|
||||
delete[] m_puiDelta;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
#include "filters.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class ScreenArea : public Gtk::DrawingArea
|
||||
{
|
||||
namespace VBA {
|
||||
class ScreenArea : public Gtk::DrawingArea {
|
||||
public:
|
||||
ScreenArea(int _iWidth, int _iHeight, int _iScale = 1);
|
||||
virtual ~ScreenArea();
|
||||
|
|
|
@ -18,18 +18,17 @@
|
|||
|
||||
#include "soundconfig.h"
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
SoundConfigDialog::SoundConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
SoundConfigDialog::SoundConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
|
||||
: Gtk::Dialog(_pstDialog)
|
||||
, m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("VolumeComboBox", m_poVolumeComboBox);
|
||||
refBuilder->get_widget("RateComboBox", m_poRateComboBox);
|
||||
|
@ -58,8 +57,7 @@ void SoundConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * _p
|
|||
m_poVolumeComboBox->set_active(3);
|
||||
|
||||
long iSoundSampleRate = m_poConfig->oGetKey<long>("sample_rate");
|
||||
switch (iSoundSampleRate)
|
||||
{
|
||||
switch (iSoundSampleRate) {
|
||||
case 11025:
|
||||
m_poRateComboBox->set_active(0);
|
||||
break;
|
||||
|
@ -79,8 +77,7 @@ void SoundConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * _p
|
|||
void SoundConfigDialog::vOnVolumeChanged()
|
||||
{
|
||||
int iVolume = m_poVolumeComboBox->get_active_row_number();
|
||||
switch (iVolume)
|
||||
{
|
||||
switch (iVolume) {
|
||||
case 0: // Mute
|
||||
m_poConfig->vSetKey("mute", true);
|
||||
m_poConfig->vSetKey("volume", 1.0f);
|
||||
|
@ -111,8 +108,7 @@ void SoundConfigDialog::vOnVolumeChanged()
|
|||
void SoundConfigDialog::vOnRateChanged()
|
||||
{
|
||||
int iRate = m_poRateComboBox->get_active_row_number();
|
||||
switch (iRate)
|
||||
{
|
||||
switch (iRate) {
|
||||
case 0: // 11 KHz
|
||||
m_poConfig->vSetKey("sample_rate", 11025);
|
||||
break;
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class SoundConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
namespace VBA {
|
||||
class SoundConfigDialog : public Gtk::Dialog {
|
||||
public:
|
||||
SoundConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "../sdl/inputSDL.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../common/SoundSDL.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../sdl/inputSDL.h"
|
||||
|
||||
#include "window.h"
|
||||
#include "intl.h"
|
||||
#include "window.h"
|
||||
|
||||
// Required vars, used by the emulator core
|
||||
//
|
||||
|
@ -49,14 +49,16 @@ void systemMessage(int _iId, const char * _csFormat, ...)
|
|||
va_list args;
|
||||
va_start(args, _csFormat);
|
||||
|
||||
GUI()->vPopupErrorV(_(_csFormat), args);
|
||||
GUI()
|
||||
->vPopupErrorV(_(_csFormat), args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void systemDrawScreen()
|
||||
{
|
||||
GUI()->vDrawScreen();
|
||||
GUI()
|
||||
->vDrawScreen();
|
||||
}
|
||||
|
||||
bool systemReadJoypads()
|
||||
|
@ -71,12 +73,14 @@ u32 systemReadJoypad(int joy)
|
|||
|
||||
void systemShowSpeed(int _iSpeed)
|
||||
{
|
||||
GUI()->vShowSpeed(_iSpeed);
|
||||
GUI()
|
||||
->vShowSpeed(_iSpeed);
|
||||
}
|
||||
|
||||
void system10Frames(int _iRate)
|
||||
{
|
||||
GUI()->vComputeFrameskip(_iRate);
|
||||
GUI()
|
||||
->vComputeFrameskip(_iRate);
|
||||
}
|
||||
|
||||
void systemFrame()
|
||||
|
@ -85,12 +89,14 @@ void systemFrame()
|
|||
|
||||
void systemSetTitle(const char* _csTitle)
|
||||
{
|
||||
GUI()->set_title(_csTitle);
|
||||
GUI()
|
||||
->set_title(_csTitle);
|
||||
}
|
||||
|
||||
void systemScreenCapture(int _iNum)
|
||||
{
|
||||
GUI()->vCaptureScreen(_iNum);
|
||||
GUI()
|
||||
->vCaptureScreen(_iNum);
|
||||
}
|
||||
|
||||
u32 systemGetClock()
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include "tools.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
std::string sCutSuffix(const std::string& _rsString,
|
||||
const std::string& _rsSep)
|
||||
|
@ -37,24 +36,18 @@ bool bHasSuffix(const Glib::ustring & _rsString,
|
|||
const Glib::ustring& _rsSuffix,
|
||||
bool _bCaseSensitive)
|
||||
{
|
||||
if (_rsSuffix.size() > _rsString.size())
|
||||
{
|
||||
if (_rsSuffix.size() > _rsString.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Glib::ustring sEnd = _rsString.substr(_rsString.size() - _rsSuffix.size());
|
||||
|
||||
if (_bCaseSensitive)
|
||||
{
|
||||
if (_rsSuffix == sEnd)
|
||||
{
|
||||
if (_bCaseSensitive) {
|
||||
if (_rsSuffix == sEnd) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_rsSuffix.lowercase() == sEnd.lowercase())
|
||||
{
|
||||
} else {
|
||||
if (_rsSuffix.lowercase() == sEnd.lowercase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -71,8 +64,7 @@ void vTokenize(Glib::ustring source, std::vector<Glib::ustring>& tokens)
|
|||
// Find first "non-delimiter".
|
||||
Glib::ustring::size_type pos = source.find_first_of(delimiters, lastPos);
|
||||
|
||||
while (Glib::ustring::npos != pos || std:: string::npos != lastPos)
|
||||
{
|
||||
while (Glib::ustring::npos != pos || std::string::npos != lastPos) {
|
||||
// Found a token, add it to the vector.
|
||||
tokens.push_back(source.substr(lastPos, pos - lastPos));
|
||||
// Skip delimiters. Note the "not_of"
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
std::string sCutSuffix(const std::string& _rsString, const std::string& _rsSep = ".");
|
||||
|
||||
Glib::ustring sCutSuffix(const Glib::ustring& _rsString, const Glib::ustring& _rsSep = ".");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,10 +34,8 @@
|
|||
#include "filters.h"
|
||||
#include "screenarea.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
class Window : public Gtk::Window
|
||||
{
|
||||
namespace VBA {
|
||||
class Window : public Gtk::Window {
|
||||
friend class Gtk::Builder;
|
||||
|
||||
public:
|
||||
|
@ -49,9 +47,12 @@ class Window : public Gtk::Window
|
|||
}
|
||||
static std::string sGetUiFilePath(const std::string& _sFileName);
|
||||
|
||||
enum ECartridge { CartridgeNone, CartridgeGB, CartridgeGBA };
|
||||
enum ECartridge { CartridgeNone,
|
||||
CartridgeGB,
|
||||
CartridgeGBA };
|
||||
|
||||
enum EVideoOutput { OutputCairo, OutputOpenGL };
|
||||
enum EVideoOutput { OutputCairo,
|
||||
OutputOpenGL };
|
||||
|
||||
enum EEmulatorType {
|
||||
EmulatorAuto,
|
||||
|
@ -62,7 +63,12 @@ class Window : public Gtk::Window
|
|||
EmulatorSGB2
|
||||
};
|
||||
|
||||
enum ESaveType { SaveAuto, SaveEEPROM, SaveSRAM, SaveFlash, SaveEEPROMSensor, SaveNone };
|
||||
enum ESaveType { SaveAuto,
|
||||
SaveEEPROM,
|
||||
SaveSRAM,
|
||||
SaveFlash,
|
||||
SaveEEPROMSensor,
|
||||
SaveNone };
|
||||
|
||||
// GB/GBA screen sizes
|
||||
const int m_iGBScreenWidth;
|
||||
|
@ -104,11 +110,16 @@ class Window : public Gtk::Window
|
|||
protected:
|
||||
Window(GtkWindow* _pstWindow, const Glib::RefPtr<Gtk::Builder>& _poXml);
|
||||
|
||||
enum EShowSpeed { ShowNone, ShowPercentage, ShowDetailed };
|
||||
enum EShowSpeed { ShowNone,
|
||||
ShowPercentage,
|
||||
ShowDetailed };
|
||||
|
||||
enum ESoundStatus { SoundOff, SoundMute, SoundOn };
|
||||
enum ESoundStatus { SoundOff,
|
||||
SoundMute,
|
||||
SoundOn };
|
||||
|
||||
enum EColorFormat { ColorFormatRGB, ColorFormatBGR };
|
||||
enum EColorFormat { ColorFormatRGB,
|
||||
ColorFormatBGR };
|
||||
|
||||
virtual void vOnMenuEnter();
|
||||
virtual void vOnMenuExit();
|
||||
|
|
|
@ -20,45 +20,43 @@
|
|||
|
||||
#include <glibmm/convert.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/main.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <gtkmm/aboutdialog.h>
|
||||
#include <gtkmm/builder.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "../Util.h"
|
||||
#include "../common/ConfigManager.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../gb/gb.h"
|
||||
#include "../gb/gbGlobals.h"
|
||||
#include "../Util.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../sdl/inputSDL.h"
|
||||
|
||||
#include "tools.h"
|
||||
#include "intl.h"
|
||||
#include "joypadconfig.h"
|
||||
#include "directoriesconfig.h"
|
||||
#include "displayconfig.h"
|
||||
#include "soundconfig.h"
|
||||
#include "gameboyconfig.h"
|
||||
#include "gameboyadvanceconfig.h"
|
||||
#include "generalconfig.h"
|
||||
#include "gameboyadvancecheatlist.h"
|
||||
#include "gameboyadvanceconfig.h"
|
||||
#include "gameboycheatlist.h"
|
||||
#include "gameboyconfig.h"
|
||||
#include "generalconfig.h"
|
||||
#include "intl.h"
|
||||
#include "joypadconfig.h"
|
||||
#include "soundconfig.h"
|
||||
#include "tools.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace VBA {
|
||||
|
||||
void Window::vOnMenuEnter()
|
||||
{
|
||||
if (emulating && ! m_bPaused)
|
||||
{
|
||||
if (emulating && !m_bPaused) {
|
||||
vStopEmu();
|
||||
soundPause();
|
||||
}
|
||||
|
@ -66,8 +64,7 @@ void Window::vOnMenuEnter()
|
|||
|
||||
void Window::vOnMenuExit()
|
||||
{
|
||||
if (emulating && ! m_bPaused)
|
||||
{
|
||||
if (emulating && !m_bPaused) {
|
||||
vStartEmu();
|
||||
soundResume();
|
||||
}
|
||||
|
@ -75,10 +72,8 @@ void Window::vOnMenuExit()
|
|||
|
||||
void Window::vOnFileOpen()
|
||||
{
|
||||
while (m_poFileOpenDialog->run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
if (bLoadROM(m_poFileOpenDialog->get_filename()))
|
||||
{
|
||||
while (m_poFileOpenDialog->run() == Gtk::RESPONSE_OK) {
|
||||
if (bLoadROM(m_poFileOpenDialog->get_filename())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -93,12 +88,9 @@ void Window::vOnFileLoad()
|
|||
oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
|
||||
|
||||
if (sSaveDir == "")
|
||||
{
|
||||
if (sSaveDir == "") {
|
||||
oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
oDialog.set_current_folder(sSaveDir);
|
||||
oDialog.add_shortcut_folder(sSaveDir);
|
||||
}
|
||||
|
@ -115,10 +107,8 @@ void Window::vOnFileLoad()
|
|||
|
||||
oDialog.add_filter(oSaveFilter);
|
||||
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
if (m_stEmulator.emuReadState(oDialog.get_filename().c_str()))
|
||||
{
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK) {
|
||||
if (m_stEmulator.emuReadState(oDialog.get_filename().c_str())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -133,12 +123,9 @@ void Window::vOnFileSave()
|
|||
oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
|
||||
|
||||
if (sSaveDir == "")
|
||||
{
|
||||
if (sSaveDir == "") {
|
||||
oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
oDialog.set_current_folder(sSaveDir);
|
||||
oDialog.add_shortcut_folder(sSaveDir);
|
||||
}
|
||||
|
@ -156,29 +143,24 @@ void Window::vOnFileSave()
|
|||
|
||||
oDialog.add_filter(oSaveFilter);
|
||||
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK) {
|
||||
Glib::ustring sFile = oDialog.get_filename();
|
||||
if (! bHasSuffix(sFile, ".sgm", false))
|
||||
{
|
||||
if (!bHasSuffix(sFile, ".sgm", false)) {
|
||||
sFile += ".sgm";
|
||||
}
|
||||
|
||||
if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS))
|
||||
{
|
||||
if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS)) {
|
||||
Gtk::MessageDialog oConfirmDialog(*this,
|
||||
_("File already exists. Overwrite it?"),
|
||||
false,
|
||||
Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_YES_NO);
|
||||
if (oConfirmDialog.run() != Gtk::RESPONSE_YES)
|
||||
{
|
||||
if (oConfirmDialog.run() != Gtk::RESPONSE_YES) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_stEmulator.emuWriteState(sFile.c_str()))
|
||||
{
|
||||
if (m_stEmulator.emuWriteState(sFile.c_str())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -189,18 +171,15 @@ void Window::vOnLoadGameMostRecent()
|
|||
int iMostRecent = -1;
|
||||
time_t uiTimeMax = 0;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (!m_astGameSlot[i].m_bEmpty
|
||||
&& (iMostRecent < 0 || m_astGameSlot[i].m_uiTime > uiTimeMax))
|
||||
{
|
||||
&& (iMostRecent < 0 || m_astGameSlot[i].m_uiTime > uiTimeMax)) {
|
||||
iMostRecent = i;
|
||||
uiTimeMax = m_astGameSlot[i].m_uiTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (iMostRecent >= 0)
|
||||
{
|
||||
if (iMostRecent >= 0) {
|
||||
vOnLoadGame(iMostRecent + 1);
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +192,7 @@ void Window::vOnLoadGameAutoToggled(Gtk::CheckMenuItem * _poCMI)
|
|||
void Window::vOnLoadGame(int _iSlot)
|
||||
{
|
||||
int i = _iSlot - 1;
|
||||
if (! m_astGameSlot[i].m_bEmpty)
|
||||
{
|
||||
if (!m_astGameSlot[i].m_bEmpty) {
|
||||
m_stEmulator.emuReadState(m_astGameSlot[i].m_sFile.c_str());
|
||||
m_poFilePauseItem->set_active(false);
|
||||
}
|
||||
|
@ -225,22 +203,17 @@ void Window::vOnSaveGameOldest()
|
|||
int iOldest = -1;
|
||||
time_t uiTimeMin = 0;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (!m_astGameSlot[i].m_bEmpty
|
||||
&& (iOldest < 0 || m_astGameSlot[i].m_uiTime < uiTimeMin))
|
||||
{
|
||||
&& (iOldest < 0 || m_astGameSlot[i].m_uiTime < uiTimeMin)) {
|
||||
iOldest = i;
|
||||
uiTimeMin = m_astGameSlot[i].m_uiTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (iOldest >= 0)
|
||||
{
|
||||
if (iOldest >= 0) {
|
||||
vOnSaveGame(iOldest + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
vOnSaveGame(1);
|
||||
}
|
||||
}
|
||||
|
@ -255,15 +228,11 @@ void Window::vOnSaveGame(int _iSlot)
|
|||
void Window::vOnFilePauseToggled(Gtk::CheckMenuItem* _poCMI)
|
||||
{
|
||||
m_bPaused = _poCMI->get_active();
|
||||
if (emulating)
|
||||
{
|
||||
if (m_bPaused)
|
||||
{
|
||||
if (emulating) {
|
||||
if (m_bPaused) {
|
||||
vStopEmu();
|
||||
soundPause();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
vStartEmu();
|
||||
soundResume();
|
||||
}
|
||||
|
@ -272,8 +241,7 @@ void Window::vOnFilePauseToggled(Gtk::CheckMenuItem * _poCMI)
|
|||
|
||||
void Window::vOnFileReset()
|
||||
{
|
||||
if (emulating)
|
||||
{
|
||||
if (emulating) {
|
||||
m_stEmulator.emuReset();
|
||||
m_poFilePauseItem->set_active(false);
|
||||
}
|
||||
|
@ -283,8 +251,7 @@ void Window::vOnRecentFile()
|
|||
{
|
||||
Glib::ustring sURI = m_poRecentChooserMenu->get_current_uri();
|
||||
|
||||
if (!sURI.empty())
|
||||
{
|
||||
if (!sURI.empty()) {
|
||||
std::string sFileName = Glib::filename_from_uri(sURI);
|
||||
bLoadROM(sFileName);
|
||||
}
|
||||
|
@ -299,12 +266,9 @@ void Window::vOnFileScreenCapture()
|
|||
oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
|
||||
|
||||
if (sCaptureDir == "")
|
||||
{
|
||||
if (sCaptureDir == "") {
|
||||
oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
oDialog.set_current_folder(sCaptureDir);
|
||||
oDialog.add_shortcut_folder(sCaptureDir);
|
||||
}
|
||||
|
@ -322,31 +286,26 @@ void Window::vOnFileScreenCapture()
|
|||
|
||||
oDialog.add_filter(oPngFilter);
|
||||
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK) {
|
||||
Glib::ustring sFile = oDialog.get_filename();
|
||||
Glib::ustring sExt = ".png";
|
||||
|
||||
if (! bHasSuffix(sFile, sExt, false))
|
||||
{
|
||||
if (!bHasSuffix(sFile, sExt, false)) {
|
||||
sFile += sExt;
|
||||
}
|
||||
|
||||
if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS))
|
||||
{
|
||||
if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS)) {
|
||||
Gtk::MessageDialog oConfirmDialog(*this,
|
||||
_("File already exists. Overwrite it?"),
|
||||
false,
|
||||
Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_YES_NO);
|
||||
if (oConfirmDialog.run() != Gtk::RESPONSE_YES)
|
||||
{
|
||||
if (oConfirmDialog.run() != Gtk::RESPONSE_YES) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_stEmulator.emuWritePNG(sFile.c_str()))
|
||||
{
|
||||
if (m_stEmulator.emuWritePNG(sFile.c_str())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -354,8 +313,7 @@ void Window::vOnFileScreenCapture()
|
|||
|
||||
void Window::vOnFileClose()
|
||||
{
|
||||
if (m_eCartridge != CartridgeNone)
|
||||
{
|
||||
if (m_eCartridge != CartridgeNone) {
|
||||
soundPause();
|
||||
vStopEmu();
|
||||
vSetDefaultTitle();
|
||||
|
@ -377,8 +335,7 @@ void Window::vOnFileClose()
|
|||
|
||||
for (std::list<Gtk::Widget*>::iterator it = m_listSensitiveWhenPlaying.begin();
|
||||
it != m_listSensitiveWhenPlaying.end();
|
||||
it++)
|
||||
{
|
||||
it++) {
|
||||
(*it)->set_sensitive(false);
|
||||
}
|
||||
|
||||
|
@ -480,8 +437,7 @@ void Window::vOnGeneralConfigure()
|
|||
|
||||
void Window::vOnCheatList()
|
||||
{
|
||||
if (m_eCartridge == CartridgeGBA)
|
||||
{
|
||||
if (m_eCartridge == CartridgeGBA) {
|
||||
std::string sUiFile = sGetUiFilePath("cheatlist.ui");
|
||||
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file(sUiFile);
|
||||
|
||||
|
@ -491,9 +447,7 @@ void Window::vOnCheatList()
|
|||
poDialog->vSetWindow(this);
|
||||
poDialog->run();
|
||||
poDialog->hide();
|
||||
}
|
||||
else if (m_eCartridge == CartridgeGB)
|
||||
{
|
||||
} else if (m_eCartridge == CartridgeGB) {
|
||||
std::string sUiFile = sGetUiFilePath("cheatlist.ui");
|
||||
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file(sUiFile);
|
||||
|
||||
|
@ -510,8 +464,7 @@ void Window::vOnCheatDisableToggled(Gtk::CheckMenuItem * _poCMI)
|
|||
{
|
||||
if (m_eCartridge == CartridgeGB) {
|
||||
cheatsEnabled = !cheatsEnabled;
|
||||
}
|
||||
else if (m_eCartridge == CartridgeGBA) {
|
||||
} else if (m_eCartridge == CartridgeGBA) {
|
||||
cheatsEnabled = !cheatsEnabled;
|
||||
}
|
||||
|
||||
|
@ -587,7 +540,8 @@ bool Window::bOnEmuRewind()
|
|||
}
|
||||
}
|
||||
|
||||
bool Window::bOnEmuSaveStateRewind() {
|
||||
bool Window::bOnEmuSaveStateRewind()
|
||||
{
|
||||
// check if we're disabled
|
||||
char* psavestate;
|
||||
if (m_state_count_max == 0u) {
|
||||
|
@ -627,8 +581,7 @@ bool Window::bOnEmuIdle()
|
|||
|
||||
bool Window::on_focus_in_event(GdkEventFocus* _pstEvent)
|
||||
{
|
||||
if (emulating && !m_bPaused)
|
||||
{
|
||||
if (emulating && !m_bPaused) {
|
||||
vStartEmu();
|
||||
soundResume();
|
||||
}
|
||||
|
@ -639,8 +592,7 @@ bool Window::on_focus_out_event(GdkEventFocus * _pstEvent)
|
|||
{
|
||||
if (emulating
|
||||
&& !m_bPaused
|
||||
&& m_poCoreConfig->oGetKey<bool>("pause_when_inactive"))
|
||||
{
|
||||
&& m_poCoreConfig->oGetKey<bool>("pause_when_inactive")) {
|
||||
vStopEmu();
|
||||
soundPause();
|
||||
}
|
||||
|
@ -650,8 +602,7 @@ bool Window::on_focus_out_event(GdkEventFocus * _pstEvent)
|
|||
bool Window::on_key_press_event(GdkEventKey* _pstEvent)
|
||||
{
|
||||
// The menu accelerators are disabled when it is hidden
|
||||
if (_pstEvent->keyval == GDK_KEY_F11 && !m_poMenuBar->is_visible())
|
||||
{
|
||||
if (_pstEvent->keyval == GDK_KEY_F11 && !m_poMenuBar->is_visible()) {
|
||||
vToggleFullscreen();
|
||||
return true;
|
||||
}
|
||||
|
@ -659,7 +610,8 @@ bool Window::on_key_press_event(GdkEventKey * _pstEvent)
|
|||
// Rewind key CTRL+B
|
||||
if (m_state_count_max > 0u && (_pstEvent->state & GDK_CONTROL_MASK) && _pstEvent->keyval == GDK_KEY_b) {
|
||||
// disable saves first and then connect new handler
|
||||
if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect();
|
||||
if (m_oEmuRewindSig.connected())
|
||||
m_oEmuRewindSig.disconnect();
|
||||
m_state_count_max = 0u;
|
||||
//return this->bOnEmuRewind();
|
||||
m_oEmuRewindSig = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Window::bOnEmuRewind),
|
||||
|
@ -685,7 +637,8 @@ bool Window::on_key_release_event(GdkEventKey * _pstEvent)
|
|||
// Rewind key CTRL+B
|
||||
if (_pstEvent->keyval == GDK_KEY_b /*&& !(_pstEvent->state & GDK_CONTROL_MASK)*/) {
|
||||
// connect save handler back
|
||||
if (m_oEmuRewindSig.connected()) m_oEmuRewindSig.disconnect();
|
||||
if (m_oEmuRewindSig.connected())
|
||||
m_oEmuRewindSig.disconnect();
|
||||
m_state_count_max = m_poCoreConfig->oGetKey<unsigned short>("rewind_count_max");
|
||||
m_oEmuRewindSig = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Window::bOnEmuSaveStateRewind), m_rewind_interval);
|
||||
return true;
|
||||
|
@ -701,14 +654,12 @@ bool Window::on_key_release_event(GdkEventKey * _pstEvent)
|
|||
event.key.keysym.sym = (SDL_Keycode)_pstEvent->keyval;
|
||||
inputProcessSDLEvent(event);
|
||||
|
||||
|
||||
return Gtk::Window::on_key_release_event(_pstEvent);
|
||||
}
|
||||
|
||||
bool Window::on_window_state_event(GdkEventWindowState* _pstEvent)
|
||||
{
|
||||
if (_pstEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
||||
{
|
||||
if (_pstEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
|
||||
m_bFullscreen = _pstEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "libretro.h"
|
||||
#include "SoundRetro.h"
|
||||
#include "libretro.h"
|
||||
unsigned g_audio_frames;
|
||||
extern retro_audio_sample_batch_t audio_batch_cb;
|
||||
|
||||
|
@ -33,7 +33,6 @@ void SoundRetro::write(u16 * finalWave, int length)
|
|||
g_audio_frames += frames;
|
||||
}
|
||||
|
||||
|
||||
bool SoundRetro::init(long sampleRate)
|
||||
{
|
||||
g_audio_frames = 0;
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
|
||||
#include "../common/SoundDriver.h"
|
||||
|
||||
class SoundRetro : public SoundDriver
|
||||
{
|
||||
class SoundRetro : public SoundDriver {
|
||||
public:
|
||||
SoundRetro();
|
||||
virtual ~SoundRetro();
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "System.h"
|
||||
#include "NLS.h"
|
||||
#include "System.h"
|
||||
#include "Util.h"
|
||||
#include "common/Port.h"
|
||||
#include "gba/Flash.h"
|
||||
#include "gba/GBA.h"
|
||||
#include "gba/Globals.h"
|
||||
#include "gba/RTC.h"
|
||||
#include "common/Port.h"
|
||||
|
||||
#include "gba/gbafilter.h"
|
||||
#include "gb/gbGlobals.h"
|
||||
#include "gba/gbafilter.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <strings.h>
|
||||
|
@ -60,10 +60,7 @@ bool utilIsGBAImage(const char * file)
|
|||
const char* p = strrchr(file, '.');
|
||||
|
||||
if (p != NULL) {
|
||||
if((_stricmp(p, ".agb") == 0) ||
|
||||
(_stricmp(p, ".gba") == 0) ||
|
||||
(_stricmp(p, ".bin") == 0) ||
|
||||
(_stricmp(p, ".elf") == 0))
|
||||
if ((_stricmp(p, ".agb") == 0) || (_stricmp(p, ".gba") == 0) || (_stricmp(p, ".bin") == 0) || (_stricmp(p, ".elf") == 0))
|
||||
return true;
|
||||
if (_stricmp(p, ".mb") == 0) {
|
||||
cpuIsMultiBoot = true;
|
||||
|
@ -81,11 +78,7 @@ bool utilIsGBImage(const char * file)
|
|||
const char* p = strrchr(file, '.');
|
||||
|
||||
if (p != NULL) {
|
||||
if((_stricmp(p, ".dmg") == 0) ||
|
||||
(_stricmp(p, ".gb") == 0) ||
|
||||
(_stricmp(p, ".gbc") == 0) ||
|
||||
(_stricmp(p, ".cgb") == 0) ||
|
||||
(_stricmp(p, ".sgb") == 0))
|
||||
if ((_stricmp(p, ".dmg") == 0) || (_stricmp(p, ".gb") == 0) || (_stricmp(p, ".gbc") == 0) || (_stricmp(p, ".cgb") == 0) || (_stricmp(p, ".sgb") == 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -134,12 +127,10 @@ uint8_t *utilLoad(const char *file, bool (*accept)(const char *), uint8_t *data,
|
|||
rewind(fp);
|
||||
|
||||
uint8_t* image = data;
|
||||
if(image == NULL)
|
||||
{
|
||||
if (image == NULL) {
|
||||
//allocate buffer memory if none was passed to the function
|
||||
image = (uint8_t*)malloc(utilGetSize(size));
|
||||
if(image == NULL)
|
||||
{
|
||||
if (image == NULL) {
|
||||
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
||||
"data");
|
||||
return NULL;
|
||||
|
@ -203,27 +194,21 @@ void utilGBAFindSave(const uint8_t *data, const int size)
|
|||
void utilUpdateSystemColorMaps(bool lcd)
|
||||
{
|
||||
switch (systemColorDepth) {
|
||||
case 16:
|
||||
{
|
||||
case 16: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd) gbafilter_pal(systemColorMap16, 0x10000);
|
||||
}
|
||||
break;
|
||||
if (lcd)
|
||||
gbafilter_pal(systemColorMap16, 0x10000);
|
||||
} break;
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
case 32: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd) gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
}
|
||||
break;
|
||||
if (lcd)
|
||||
gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,8 +239,7 @@ void utilWriteMem(uint8_t *& data, const void *in_data, unsigned size)
|
|||
|
||||
void utilWriteDataMem(uint8_t*& data, variable_desc* desc)
|
||||
{
|
||||
while (desc->address)
|
||||
{
|
||||
while (desc->address) {
|
||||
utilWriteMem(data, desc->address, desc->size);
|
||||
desc++;
|
||||
}
|
||||
|
@ -277,8 +261,7 @@ void utilReadMem(void *buf, const uint8_t *& data, unsigned size)
|
|||
|
||||
void utilReadDataMem(const uint8_t*& data, variable_desc* desc)
|
||||
{
|
||||
while (desc->address)
|
||||
{
|
||||
while (desc->address) {
|
||||
utilReadMem(desc->address, data, desc->size);
|
||||
desc++;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
enum save_type { EEPROM_512B, EEPROM_8K, FLASH_64K, FLASH_128K, SAVE_UNKNOWN };
|
||||
enum save_type { EEPROM_512B,
|
||||
EEPROM_8K,
|
||||
FLASH_64K,
|
||||
FLASH_128K,
|
||||
SAVE_UNKNOWN };
|
||||
|
||||
static const char* save_type_to_string(enum save_type type)
|
||||
{
|
||||
|
@ -54,8 +58,7 @@ static enum save_type detect_save_type(const uint8_t *data, unsigned size)
|
|||
if (scan_section(data, 0x20000))
|
||||
return FLASH_128K;
|
||||
|
||||
if (scan_section(data + 0x20000, 512) &&
|
||||
!scan_section(data + 0x20000 + 512, 0x20000 - 512))
|
||||
if (scan_section(data + 0x20000, 512) && !scan_section(data + 0x20000 + 512, 0x20000 - 512))
|
||||
return EEPROM_512B;
|
||||
if (scan_section(data + 0x20000, 0x2000))
|
||||
return EEPROM_8K;
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libretro.h"
|
||||
#include "SoundRetro.h"
|
||||
#include "libretro.h"
|
||||
|
||||
#include "../Util.h"
|
||||
#include "../System.h"
|
||||
#include "../Util.h"
|
||||
#include "../apu/Blip_Buffer.h"
|
||||
#include "../apu/Gb_Apu.h"
|
||||
#include "../apu/Gb_Oscs.h"
|
||||
#include "../common/Port.h"
|
||||
#include "../common/Types.h"
|
||||
#include "../gba/RTC.h"
|
||||
#include "../gba/GBAGfx.h"
|
||||
#include "../gba/bios.h"
|
||||
#include "../gba/Flash.h"
|
||||
#include "../gba/EEprom.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../apu/Blip_Buffer.h"
|
||||
#include "../apu/Gb_Oscs.h"
|
||||
#include "../apu/Gb_Apu.h"
|
||||
#include "../gba/Globals.h"
|
||||
#include "../gba/Cheats.h"
|
||||
#include "../gba/EEprom.h"
|
||||
#include "../gba/Flash.h"
|
||||
#include "../gba/GBAGfx.h"
|
||||
#include "../gba/Globals.h"
|
||||
#include "../gba/RTC.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../gba/bios.h"
|
||||
|
||||
#define RETRO_DEVICE_GBA RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0)
|
||||
#define RETRO_DEVICE_GBA_ALT1 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1)
|
||||
|
@ -93,36 +93,25 @@ static bool scan_area(const uint8_t *data, unsigned size)
|
|||
|
||||
static void adjust_save_ram()
|
||||
{
|
||||
if (scan_area(libretro_save_buf, 512) &&
|
||||
!scan_area(libretro_save_buf + 512, sizeof(libretro_save_buf) - 512))
|
||||
{
|
||||
if (scan_area(libretro_save_buf, 512) && !scan_area(libretro_save_buf + 512, sizeof(libretro_save_buf) - 512)) {
|
||||
libretro_save_size = 512;
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, "Detecting EEprom 8kbit\n");
|
||||
}
|
||||
else if (scan_area(libretro_save_buf, 0x2000) &&
|
||||
!scan_area(libretro_save_buf + 0x2000, sizeof(libretro_save_buf) - 0x2000))
|
||||
{
|
||||
} else if (scan_area(libretro_save_buf, 0x2000) && !scan_area(libretro_save_buf + 0x2000, sizeof(libretro_save_buf) - 0x2000)) {
|
||||
libretro_save_size = 0x2000;
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, "Detecting EEprom 64kbit\n");
|
||||
}
|
||||
|
||||
else if (scan_area(libretro_save_buf, 0x10000) &&
|
||||
!scan_area(libretro_save_buf + 0x10000, sizeof(libretro_save_buf) - 0x10000))
|
||||
{
|
||||
else if (scan_area(libretro_save_buf, 0x10000) && !scan_area(libretro_save_buf + 0x10000, sizeof(libretro_save_buf) - 0x10000)) {
|
||||
libretro_save_size = 0x10000;
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, "Detecting Flash 512kbit\n");
|
||||
}
|
||||
else if (scan_area(libretro_save_buf, 0x20000) &&
|
||||
!scan_area(libretro_save_buf + 0x20000, sizeof(libretro_save_buf) - 0x20000))
|
||||
{
|
||||
} else if (scan_area(libretro_save_buf, 0x20000) && !scan_area(libretro_save_buf + 0x20000, sizeof(libretro_save_buf) - 0x20000)) {
|
||||
libretro_save_size = 0x20000;
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, "Detecting Flash 1Mbit\n");
|
||||
}
|
||||
else if (log_cb)
|
||||
} else if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, "Did not detect any particular SRAM type.\n");
|
||||
|
||||
if (libretro_save_size == 512 || libretro_save_size == 0x2000)
|
||||
|
@ -131,7 +120,6 @@ static void adjust_save_ram()
|
|||
flashSaveMemory = libretro_save_buf;
|
||||
}
|
||||
|
||||
|
||||
unsigned retro_api_version(void)
|
||||
{
|
||||
return RETRO_API_VERSION;
|
||||
|
@ -143,7 +131,8 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
|
|||
}
|
||||
|
||||
void retro_set_audio_sample(retro_audio_sample_t cb)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
|
||||
{
|
||||
|
@ -163,8 +152,7 @@ void retro_set_input_state(retro_input_state_t cb)
|
|||
void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "Controller %d'\n", device);
|
||||
switch(device)
|
||||
{
|
||||
switch (device) {
|
||||
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
case RETRO_DEVICE_GBA:
|
||||
|
@ -189,7 +177,6 @@ void retro_set_environment(retro_environment_t cb)
|
|||
|
||||
struct retro_variable variables[] = {
|
||||
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
|
@ -201,8 +188,6 @@ void retro_set_environment(retro_environment_t cb)
|
|||
|
||||
static const struct retro_controller_info ports[] = { { port_1, 4 }, { 0, 0 } };
|
||||
|
||||
|
||||
|
||||
cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
|
||||
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
|
||||
}
|
||||
|
@ -383,18 +368,15 @@ static void load_image_preferences (void)
|
|||
bool found = false;
|
||||
int found_no = 0;
|
||||
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
if(!strcmp(gbaover[i].romid, buffer))
|
||||
{
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (!strcmp(gbaover[i].romid, buffer)) {
|
||||
found = true;
|
||||
found_no = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found)
|
||||
{
|
||||
if (found) {
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_INFO, "Found ROM in vba-over list.\n");
|
||||
|
||||
|
@ -410,8 +392,7 @@ static void load_image_preferences (void)
|
|||
mirroringEnable = gbaover[found_no].mirroringEnabled;
|
||||
}
|
||||
|
||||
if (log_cb)
|
||||
{
|
||||
if (log_cb) {
|
||||
log_cb(RETRO_LOG_INFO, "RTC = %d.\n", enableRtc);
|
||||
log_cb(RETRO_LOG_INFO, "flashSize = %d.\n", flashSize);
|
||||
log_cb(RETRO_LOG_INFO, "cpuSaveType = %d.\n", cpuSaveType);
|
||||
|
@ -437,7 +418,6 @@ static void gba_init(void)
|
|||
systemBlueShift = 3;
|
||||
#endif
|
||||
|
||||
|
||||
utilUpdateSystemColorMaps(false);
|
||||
|
||||
if (cpuSaveType == 0)
|
||||
|
@ -525,7 +505,6 @@ static unsigned has_frame;
|
|||
|
||||
static void update_variables(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#ifdef FINAL_VERSION
|
||||
|
@ -542,7 +521,6 @@ void retro_run(void)
|
|||
|
||||
poll_cb();
|
||||
|
||||
|
||||
has_frame = 0;
|
||||
|
||||
do {
|
||||
|
@ -639,28 +617,57 @@ bool retro_load_game(const struct retro_game_info *game)
|
|||
|
||||
struct retro_memory_descriptor desc[9];
|
||||
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[2].start=0x0E000000; desc[2].select=0xFF000000; desc[2].len=libretro_save_size; desc[2].ptr=flashSaveMemory;//SRAM
|
||||
desc[3].start=0x08000000; desc[3].select=0xFC000000; desc[3].len=0x2000000; desc[3].ptr=rom;//ROM, parts 1 and 2
|
||||
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[2].start = 0x0E000000;
|
||||
desc[2].select = 0xFF000000;
|
||||
desc[2].len = libretro_save_size;
|
||||
desc[2].ptr = flashSaveMemory; //SRAM
|
||||
desc[3].start = 0x08000000;
|
||||
desc[3].select = 0xFC000000;
|
||||
desc[3].len = 0x2000000;
|
||||
desc[3].ptr = rom; //ROM, parts 1 and 2
|
||||
desc[3].flags = RETRO_MEMDESC_CONST; //we need two mappings since its size is not a power of 2
|
||||
desc[4].start=0x0C000000; desc[4].select=0xFE000000; desc[4].len=0x2000000; desc[4].ptr=rom;//ROM part 3
|
||||
desc[4].start = 0x0C000000;
|
||||
desc[4].select = 0xFE000000;
|
||||
desc[4].len = 0x2000000;
|
||||
desc[4].ptr = rom; //ROM part 3
|
||||
desc[4].flags = RETRO_MEMDESC_CONST;
|
||||
desc[5].start=0x00000000; desc[5].select=0xFF000000; desc[5].len=0x4000; desc[5].ptr=bios;//BIOS
|
||||
desc[5].start = 0x00000000;
|
||||
desc[5].select = 0xFF000000;
|
||||
desc[5].len = 0x4000;
|
||||
desc[5].ptr = bios; //BIOS
|
||||
desc[5].flags = RETRO_MEMDESC_CONST;
|
||||
desc[6].start=0x06000000; desc[6].select=0xFF000000; desc[6].len=0x18000; desc[6].ptr=vram;//VRAM
|
||||
desc[7].start=0x07000000; desc[7].select=0xFF000000; desc[7].len=0x400; desc[7].ptr=paletteRAM;//palettes
|
||||
desc[8].start=0x05000000; desc[8].select=0xFF000000; desc[8].len=0x400; desc[8].ptr=oam;//OAM
|
||||
desc[6].start = 0x06000000;
|
||||
desc[6].select = 0xFF000000;
|
||||
desc[6].len = 0x18000;
|
||||
desc[6].ptr = vram; //VRAM
|
||||
desc[7].start = 0x07000000;
|
||||
desc[7].select = 0xFF000000;
|
||||
desc[7].len = 0x400;
|
||||
desc[7].ptr = paletteRAM; //palettes
|
||||
desc[8].start = 0x05000000;
|
||||
desc[8].select = 0xFF000000;
|
||||
desc[8].len = 0x400;
|
||||
desc[8].ptr = oam; //OAM
|
||||
struct retro_memory_map retromap = { desc, sizeof(desc) / sizeof(*desc) };
|
||||
if (ret) environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &retromap);
|
||||
if (ret)
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &retromap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool retro_load_game_special(
|
||||
unsigned game_type,
|
||||
const struct retro_game_info *info, size_t num_info
|
||||
)
|
||||
{ return false; }
|
||||
const struct retro_game_info* info, size_t num_info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
extern unsigned g_audio_frames;
|
||||
static unsigned g_video_frames;
|
||||
|
@ -725,7 +732,6 @@ void systemMessage(int, const char* fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
int systemGetSensorX(void)
|
||||
{
|
||||
return 0;
|
||||
|
@ -748,8 +754,7 @@ u32 systemReadJoypad(int which)
|
|||
|
||||
u32 J = 0;
|
||||
|
||||
for (unsigned i = 0; i < 10; i++)
|
||||
{
|
||||
for (unsigned i = 0; i < 10; i++) {
|
||||
if (controller_layout[0] == 1)
|
||||
J |= input_cb(which, RETRO_DEVICE_JOYPAD, 0, binds1[i]) << i;
|
||||
else if (controller_layout[0] == 2)
|
||||
|
|
|
@ -61,20 +61,27 @@ static const unsigned long crc_table[256] = {
|
|||
};
|
||||
|
||||
#define DO1_CRC32(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
|
||||
#define DO2_CRC32(buf) DO1_CRC32(buf); DO1_CRC32(buf);
|
||||
#define DO4_CRC32(buf) DO2_CRC32(buf); DO2_CRC32(buf);
|
||||
#define DO8_CRC32(buf) DO4_CRC32(buf); DO4_CRC32(buf);
|
||||
#define DO2_CRC32(buf) \
|
||||
DO1_CRC32(buf); \
|
||||
DO1_CRC32(buf);
|
||||
#define DO4_CRC32(buf) \
|
||||
DO2_CRC32(buf); \
|
||||
DO2_CRC32(buf);
|
||||
#define DO8_CRC32(buf) \
|
||||
DO4_CRC32(buf); \
|
||||
DO4_CRC32(buf);
|
||||
|
||||
unsigned long crc32(unsigned long crc, const unsigned char* buf, unsigned int len)
|
||||
{
|
||||
if (buf == 0) return 0L;
|
||||
if (buf == 0)
|
||||
return 0L;
|
||||
crc = crc ^ 0xffffffffL;
|
||||
while (len >= 8)
|
||||
{
|
||||
while (len >= 8) {
|
||||
DO8_CRC32(buf);
|
||||
len -= 8;
|
||||
}
|
||||
if (len) do {
|
||||
if (len)
|
||||
do {
|
||||
DO1_CRC32(buf);
|
||||
} while (--len);
|
||||
return crc ^ 0xffffffffL;
|
||||
|
@ -85,4 +92,3 @@ unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int le
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
247
src/sdl/SDL.cpp
247
src/sdl/SDL.cpp
|
@ -22,19 +22,19 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <cmath>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/glu.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
@ -44,24 +44,24 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "../common/Patch.h"
|
||||
#include "../Util.h"
|
||||
#include "../common/ConfigManager.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/agbprint.h"
|
||||
#include "../gba/Flash.h"
|
||||
#include "../common/Patch.h"
|
||||
#include "../gb/gb.h"
|
||||
#include "../gb/gbCheats.h"
|
||||
#include "../gb/gbGlobals.h"
|
||||
#include "../gb/gbSound.h"
|
||||
#include "../gba/Cheats.h"
|
||||
#include "../gba/Flash.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/RTC.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../gb/gb.h"
|
||||
#include "../gb/gbGlobals.h"
|
||||
#include "../gb/gbCheats.h"
|
||||
#include "../gb/gbSound.h"
|
||||
#include "../Util.h"
|
||||
#include "../gba/agbprint.h"
|
||||
|
||||
#include "filters.h"
|
||||
#include "text.h"
|
||||
#include "inputSDL.h"
|
||||
#include "../common/SoundSDL.h"
|
||||
#include "filters.h"
|
||||
#include "inputSDL.h"
|
||||
#include "text.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
|
@ -82,8 +82,8 @@
|
|||
#endif // ! __GNUC__
|
||||
|
||||
#if WITH_LIRC
|
||||
#include <sys/poll.h>
|
||||
#include <lirc/lirc_client.h>
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
extern void remoteInit();
|
||||
|
@ -174,8 +174,17 @@ extern int autoFireMaxCount;
|
|||
#define REWIND_SIZE 400000
|
||||
|
||||
enum VIDEO_SIZE {
|
||||
VIDEO_1X, VIDEO_2X, VIDEO_3X, VIDEO_4X, VIDEO_5X, VIDEO_6X,
|
||||
VIDEO_320x240, VIDEO_640x480, VIDEO_800x600, VIDEO_1024x768, VIDEO_1280x1024,
|
||||
VIDEO_1X,
|
||||
VIDEO_2X,
|
||||
VIDEO_3X,
|
||||
VIDEO_4X,
|
||||
VIDEO_5X,
|
||||
VIDEO_6X,
|
||||
VIDEO_320x240,
|
||||
VIDEO_640x480,
|
||||
VIDEO_800x600,
|
||||
VIDEO_1024x768,
|
||||
VIDEO_1280x1024,
|
||||
VIDEO_OTHER
|
||||
};
|
||||
|
||||
|
@ -205,8 +214,10 @@ static void sdlChangeVolume(float d)
|
|||
float oldVolume = soundGetVolume();
|
||||
float newVolume = oldVolume + d;
|
||||
|
||||
if (newVolume < 0.0) newVolume = 0.0;
|
||||
if (newVolume > SOUND_MAX_VOLUME) newVolume = SOUND_MAX_VOLUME;
|
||||
if (newVolume < 0.0)
|
||||
newVolume = 0.0;
|
||||
if (newVolume > SOUND_MAX_VOLUME)
|
||||
newVolume = SOUND_MAX_VOLUME;
|
||||
|
||||
if (fabs(newVolume - oldVolume) > 0.001) {
|
||||
char tmp[32];
|
||||
|
@ -265,7 +276,6 @@ void StopLirc(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __MSC__
|
||||
#define stat _stat
|
||||
#define S_IFDIR _S_IFDIR
|
||||
|
@ -273,8 +283,7 @@ void StopLirc(void)
|
|||
|
||||
void sdlCheckDirectory(const char* dir)
|
||||
{
|
||||
if (!dir || !dir[0])
|
||||
{
|
||||
if (!dir || !dir[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -284,8 +293,7 @@ void sdlCheckDirectory(const char *dir)
|
|||
|
||||
char* p = (char*)dir + len - 1;
|
||||
|
||||
if(*p == '/' ||
|
||||
*p == '\\')
|
||||
if (*p == '/' || *p == '\\')
|
||||
*p = 0;
|
||||
|
||||
if (stat(dir, &buf) == 0) {
|
||||
|
@ -306,8 +314,7 @@ char *sdlGetFilename(char *name)
|
|||
char* p = name + len - 1;
|
||||
|
||||
while (true) {
|
||||
if(*p == '/' ||
|
||||
*p == '\\') {
|
||||
if (*p == '/' || *p == '\\') {
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
|
@ -368,8 +375,7 @@ FILE *sdlFindFile(const char *name)
|
|||
return f;
|
||||
}
|
||||
|
||||
if (!strchr(home, '/') &&
|
||||
!strchr(home, '\\')) {
|
||||
if (!strchr(home, '/') && !strchr(home, '\\')) {
|
||||
char* path = getenv("PATH");
|
||||
|
||||
if (path != NULL) {
|
||||
|
@ -662,13 +668,10 @@ void sdlWriteState(int num)
|
|||
emulator.emuWriteState(stateName);
|
||||
|
||||
// now we reuse the stateName buffer - 2048 bytes fit in a lot
|
||||
if (num == SLOT_POS_LOAD_BACKUP)
|
||||
{
|
||||
if (num == SLOT_POS_LOAD_BACKUP) {
|
||||
sprintf(stateName, "Current state backed up to %d", num + 1);
|
||||
systemScreenMessage(stateName);
|
||||
}
|
||||
else if (num>=0)
|
||||
{
|
||||
} else if (num >= 0) {
|
||||
sprintf(stateName, "Wrote state %d", num + 1);
|
||||
systemScreenMessage(stateName);
|
||||
}
|
||||
|
@ -684,16 +687,11 @@ void sdlReadState(int num)
|
|||
if (emulator.emuReadState)
|
||||
emulator.emuReadState(stateName);
|
||||
|
||||
if (num == SLOT_POS_LOAD_BACKUP)
|
||||
{
|
||||
if (num == SLOT_POS_LOAD_BACKUP) {
|
||||
sprintf(stateName, "Last load UNDONE");
|
||||
} else
|
||||
if (num == SLOT_POS_SAVE_BACKUP)
|
||||
{
|
||||
} else if (num == SLOT_POS_SAVE_BACKUP) {
|
||||
sprintf(stateName, "Last save UNDONE");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sprintf(stateName, "Loaded state %d", num + 1);
|
||||
}
|
||||
systemScreenMessage(stateName);
|
||||
|
@ -780,14 +778,16 @@ void sdlReadBattery()
|
|||
systemScreenMessage("Loaded battery");
|
||||
}
|
||||
|
||||
void sdlReadDesktopVideoMode() {
|
||||
void sdlReadDesktopVideoMode()
|
||||
{
|
||||
SDL_DisplayMode dm;
|
||||
SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(window), &dm);
|
||||
desktopWidth = dm.w;
|
||||
desktopHeight = dm.h;
|
||||
}
|
||||
|
||||
static void sdlResizeVideo() {
|
||||
static void sdlResizeVideo()
|
||||
{
|
||||
filter_enlarge = getFilterEnlargeFactor(filter);
|
||||
|
||||
destWidth = filter_enlarge * sizeX;
|
||||
|
@ -799,8 +799,10 @@ static void sdlResizeVideo() {
|
|||
sdlOpenGLVideoResize();
|
||||
}
|
||||
|
||||
if (surface) SDL_FreeSurface(surface);
|
||||
if (texture) SDL_DestroyTexture(texture);
|
||||
if (surface)
|
||||
SDL_FreeSurface(surface);
|
||||
if (texture)
|
||||
SDL_DestroyTexture(texture);
|
||||
|
||||
if (!openGL) {
|
||||
surface = SDL_CreateRGBSurface(0, destWidth, destHeight, 32,
|
||||
|
@ -818,7 +820,8 @@ static void sdlResizeVideo() {
|
|||
}
|
||||
}
|
||||
|
||||
void sdlInitVideo() {
|
||||
void sdlInitVideo()
|
||||
{
|
||||
int flags;
|
||||
int screenWidth;
|
||||
int screenHeight;
|
||||
|
@ -837,8 +840,10 @@ void sdlInitVideo() {
|
|||
screenWidth = destWidth;
|
||||
screenHeight = destHeight;
|
||||
|
||||
if (window) SDL_DestroyWindow(window);
|
||||
if (renderer) SDL_DestroyRenderer(renderer);
|
||||
if (window)
|
||||
SDL_DestroyWindow(window);
|
||||
if (renderer)
|
||||
SDL_DestroyRenderer(renderer);
|
||||
window = SDL_CreateWindow("VBA-M", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
screenWidth, screenHeight, flags);
|
||||
if (!openGL) {
|
||||
|
@ -971,7 +976,6 @@ void sdlInitVideo() {
|
|||
#define MOD_NOALT (KMOD_CTRL | KMOD_SHIFT | KMOD_META)
|
||||
#define MOD_NOSHIFT (KMOD_CTRL | KMOD_ALT | KMOD_META)
|
||||
|
||||
|
||||
/*
|
||||
* 04.02.2008 (xKiv): factored out from sdlPollEvents
|
||||
*
|
||||
|
@ -979,13 +983,11 @@ void sdlInitVideo() {
|
|||
void change_rewind(int howmuch)
|
||||
{
|
||||
if (emulating && emulator.emuReadMemState && rewindMemory
|
||||
&& rewindCount
|
||||
) {
|
||||
&& rewindCount) {
|
||||
rewindPos = (rewindPos + rewindCount + howmuch) % rewindCount;
|
||||
emulator.emuReadMemState(
|
||||
&rewindMemory[REWIND_SIZE * rewindPos],
|
||||
REWIND_SIZE
|
||||
);
|
||||
REWIND_SIZE);
|
||||
rewindCounter = 0;
|
||||
{
|
||||
char rewindMsgBuffer[50];
|
||||
|
@ -1015,23 +1017,19 @@ static void sdlHandleSavestateKey(int num, int shifted)
|
|||
// 1: save
|
||||
int backuping = 1; // controls whether we are doing savestate backups
|
||||
|
||||
if ( sdlSaveKeysSwitch == 2 )
|
||||
{
|
||||
if (sdlSaveKeysSwitch == 2) {
|
||||
// ignore "shifted"
|
||||
switch (num)
|
||||
{
|
||||
switch (num) {
|
||||
// nb.: saveSlotPosition is base 0, but to the user, we show base 1 indexes (F## numbers)!
|
||||
case 4:
|
||||
if (saveSlotPosition > 0)
|
||||
{
|
||||
if (saveSlotPosition > 0) {
|
||||
saveSlotPosition--;
|
||||
fprintf(stdout, "Changed savestate slot to %d.\n", saveSlotPosition + 1);
|
||||
} else
|
||||
fprintf(stderr, "Can't decrease slotnumber below 1.\n");
|
||||
return; // handled
|
||||
case 5:
|
||||
if (saveSlotPosition < 7)
|
||||
{
|
||||
if (saveSlotPosition < 7) {
|
||||
saveSlotPosition++;
|
||||
fprintf(stdout, "Changed savestate slot to %d.\n", saveSlotPosition + 1);
|
||||
} else
|
||||
|
@ -1053,41 +1051,38 @@ static void sdlHandleSavestateKey(int num, int shifted)
|
|||
{
|
||||
if (shifted)
|
||||
action = 1; // save
|
||||
else action = 0; // load
|
||||
else
|
||||
action = 0; // load
|
||||
saveSlotPosition = num;
|
||||
}
|
||||
if (sdlSaveKeysSwitch == 1) /* "xKiv" VBA: shifted is load */
|
||||
{
|
||||
if (!shifted)
|
||||
action = 1; // save
|
||||
else action = 0; // load
|
||||
else
|
||||
action = 0; // load
|
||||
saveSlotPosition = num;
|
||||
}
|
||||
|
||||
if (action < 0 || action > 1)
|
||||
{
|
||||
if (action < 0 || action > 1) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"sdlHandleSavestateKey(%d,%d), mode %d: unexpected action %d.\n",
|
||||
num,
|
||||
shifted,
|
||||
sdlSaveKeysSwitch,
|
||||
action
|
||||
);
|
||||
action);
|
||||
}
|
||||
|
||||
if (action)
|
||||
{ /* save */
|
||||
if (backuping)
|
||||
{
|
||||
if (action) { /* save */
|
||||
if (backuping) {
|
||||
sdlWriteState(-1); // save to a special slot
|
||||
sdlWriteBackupStateExchange(-1, saveSlotPosition, SLOT_POS_SAVE_BACKUP); // F10
|
||||
} else {
|
||||
sdlWriteState(saveSlotPosition);
|
||||
}
|
||||
} else { /* load */
|
||||
if (backuping)
|
||||
{
|
||||
if (backuping) {
|
||||
/* first back up where we are now */
|
||||
sdlWriteState(SLOT_POS_LOAD_BACKUP); // F9
|
||||
}
|
||||
|
@ -1185,8 +1180,7 @@ void sdlPollEvents()
|
|||
case SDL_KEYUP:
|
||||
switch (event.key.keysym.sym) {
|
||||
case SDLK_r:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (emulating) {
|
||||
emulator.emuReset();
|
||||
|
||||
|
@ -1195,37 +1189,30 @@ void sdlPollEvents()
|
|||
}
|
||||
break;
|
||||
case SDLK_b:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL))
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL))
|
||||
change_rewind(-1);
|
||||
break;
|
||||
case SDLK_v:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL))
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL))
|
||||
change_rewind(+1);
|
||||
break;
|
||||
case SDLK_h:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL))
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL))
|
||||
change_rewind(0);
|
||||
break;
|
||||
case SDLK_j:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL))
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL))
|
||||
change_rewind((rewindTopPos - rewindPos) * ((rewindTopPos > rewindPos) ? +1 : -1));
|
||||
break;
|
||||
case SDLK_e:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
cheatsEnabled = !cheatsEnabled;
|
||||
systemConsoleMessage(cheatsEnabled ? "Cheats on" : "Cheats off");
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_s:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)
|
||||
) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (sdlSoundToggledOff) { // was off
|
||||
// restore saved state
|
||||
soundSetEnable(sdlSoundToggledOff);
|
||||
|
@ -1288,8 +1275,7 @@ void sdlPollEvents()
|
|||
break;
|
||||
|
||||
case SDLK_p:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
paused = !paused;
|
||||
if (paused)
|
||||
soundPause();
|
||||
|
@ -1304,12 +1290,10 @@ void sdlPollEvents()
|
|||
emulating = 0;
|
||||
break;
|
||||
case SDLK_f:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
fullScreen = !fullScreen;
|
||||
SDL_SetWindowFullscreen(window, fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||
if (openGL)
|
||||
{
|
||||
if (openGL) {
|
||||
if (fullScreen)
|
||||
sdlOpenGLScaleWithAspect(desktopWidth, desktopHeight);
|
||||
else
|
||||
|
@ -1319,11 +1303,9 @@ void sdlPollEvents()
|
|||
}
|
||||
break;
|
||||
case SDLK_g:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
filterFunction = 0;
|
||||
while (!filterFunction)
|
||||
{
|
||||
while (!filterFunction) {
|
||||
filter = (Filter)((filter + 1) % kInvalidFilter);
|
||||
filterFunction = initFilter(filter, systemColorDepth, sizeX);
|
||||
}
|
||||
|
@ -1353,8 +1335,7 @@ void sdlPollEvents()
|
|||
case SDLK_F6:
|
||||
case SDLK_F7:
|
||||
case SDLK_F8:
|
||||
if(!(event.key.keysym.mod & MOD_NOSHIFT) &&
|
||||
(event.key.keysym.mod & KMOD_SHIFT)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOSHIFT) && (event.key.keysym.mod & KMOD_SHIFT)) {
|
||||
sdlHandleSavestateKey(event.key.keysym.sym - SDLK_F1, 1); // with SHIFT
|
||||
} else if (!(event.key.keysym.mod & MOD_KEYS)) {
|
||||
sdlHandleSavestateKey(event.key.keysym.sym - SDLK_F1, 0); // without SHIFT
|
||||
|
@ -1379,15 +1360,12 @@ void sdlPollEvents()
|
|||
case SDLK_2:
|
||||
case SDLK_3:
|
||||
case SDLK_4:
|
||||
if(!(event.key.keysym.mod & MOD_NOALT) &&
|
||||
(event.key.keysym.mod & KMOD_ALT)) {
|
||||
const char *disableMessages[4] =
|
||||
{ "autofire A disabled",
|
||||
if (!(event.key.keysym.mod & MOD_NOALT) && (event.key.keysym.mod & KMOD_ALT)) {
|
||||
const char* disableMessages[4] = { "autofire A disabled",
|
||||
"autofire B disabled",
|
||||
"autofire R disabled",
|
||||
"autofire L disabled" };
|
||||
const char *enableMessages[4] =
|
||||
{ "autofire A",
|
||||
const char* enableMessages[4] = { "autofire A",
|
||||
"autofire B",
|
||||
"autofire R",
|
||||
"autofire L" };
|
||||
|
@ -1407,8 +1385,7 @@ void sdlPollEvents()
|
|||
} else {
|
||||
systemScreenMessage(disableMessages[event.key.keysym.sym - SDLK_1]);
|
||||
}
|
||||
} else if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
} else if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
int mask = 0x0100 << (event.key.keysym.sym - SDLK_1);
|
||||
layerSettings ^= mask;
|
||||
layerEnable = DISPCNT & layerSettings;
|
||||
|
@ -1419,16 +1396,14 @@ void sdlPollEvents()
|
|||
case SDLK_6:
|
||||
case SDLK_7:
|
||||
case SDLK_8:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
int mask = 0x0100 << (event.key.keysym.sym - SDLK_1);
|
||||
layerSettings ^= mask;
|
||||
layerEnable = DISPCNT & layerSettings;
|
||||
}
|
||||
break;
|
||||
case SDLK_n:
|
||||
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
|
||||
(event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (paused)
|
||||
paused = false;
|
||||
pauseNextFrame = true;
|
||||
|
@ -1476,7 +1451,8 @@ void lircCheckInput(void)
|
|||
soundPause();
|
||||
else
|
||||
soundResume();
|
||||
if(paused) wasPaused = true;
|
||||
if (paused)
|
||||
wasPaused = true;
|
||||
systemConsoleMessage(paused ? "Pause on" : "Pause off");
|
||||
systemScreenMessage(paused ? "Pause on" : "Pause off");
|
||||
} else if (strcmp(CmdLIRC, "RESET") == 0) {
|
||||
|
@ -1630,13 +1606,11 @@ void handleRewinds()
|
|||
long resize;
|
||||
if (
|
||||
emulator.emuWriteMemState
|
||||
&&
|
||||
emulator.emuWriteMemState(
|
||||
&& emulator.emuWriteMemState(
|
||||
&rewindMemory[curSavePos * REWIND_SIZE],
|
||||
REWIND_SIZE, /* available*/
|
||||
resize /* actual size */
|
||||
)
|
||||
) {
|
||||
)) {
|
||||
char rewMsgBuf[100];
|
||||
sprintf(rewMsgBuf, "Remembered rewind %1d (of %1d), serial %d.", curSavePos + 1, rewindCount, rewindSerial);
|
||||
rewMsgBuf[99] = 0;
|
||||
|
@ -1747,7 +1721,6 @@ int main(int argc, char **argv)
|
|||
sdlSaveKeysSwitch = (ReadPrefHex("saveKeysSwitch"));
|
||||
sdlOpenglScale = (ReadPrefHex("openGLscale"));
|
||||
|
||||
|
||||
if (optPrintUsage) {
|
||||
usage(argv[0]);
|
||||
exit(-1);
|
||||
|
@ -1770,8 +1743,7 @@ int main(int argc, char **argv)
|
|||
if (p)
|
||||
*p = 0;
|
||||
|
||||
if (autoPatch && patchNum == 0)
|
||||
{
|
||||
if (autoPatch && patchNum == 0) {
|
||||
char* tmp;
|
||||
// no patch given yet - look for ROMBASENAME.ips
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 1);
|
||||
|
@ -1902,8 +1874,7 @@ int main(int argc, char **argv)
|
|||
sizeX = 240;
|
||||
sizeY = 160;
|
||||
systemFrameSkip = frameSkip;
|
||||
}
|
||||
else if (cartridgeType == IMAGE_GB) {
|
||||
} else if (cartridgeType == IMAGE_GB) {
|
||||
if (gbBorderOn) {
|
||||
sizeX = 256;
|
||||
sizeY = 224;
|
||||
|
@ -1936,8 +1907,7 @@ int main(int argc, char **argv)
|
|||
if (systemColorDepth == 15)
|
||||
systemColorDepth = 16;
|
||||
|
||||
if(systemColorDepth != 16 && systemColorDepth != 24 &&
|
||||
systemColorDepth != 32) {
|
||||
if (systemColorDepth != 16 && systemColorDepth != 24 && systemColorDepth != 32) {
|
||||
fprintf(stderr, "Unsupported color depth '%d'.\nOnly 16, 24 and 32 bit color depths are supported\n", systemColorDepth);
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -1981,7 +1951,6 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
while (emulating) {
|
||||
if (!paused && active) {
|
||||
if (debugger && emulator.emuHasDebugger)
|
||||
|
@ -2013,8 +1982,7 @@ int main(int argc, char **argv)
|
|||
remoteCleanUp();
|
||||
soundShutdown();
|
||||
|
||||
if (openGL)
|
||||
{
|
||||
if (openGL) {
|
||||
SDL_GL_DeleteContext(glcontext);
|
||||
}
|
||||
|
||||
|
@ -2063,8 +2031,7 @@ void drawScreenMessage(u8 *screen, int pitch, int x, int y, unsigned int duratio
|
|||
if (cartridgeType == 1 && gbBorderOn) {
|
||||
gbSgbRenderBorder();
|
||||
}
|
||||
if(((systemGetClock() - screenMessageTime) < duration) &&
|
||||
!disableStatusMessages) {
|
||||
if (((systemGetClock() - screenMessageTime) < duration) && !disableStatusMessages) {
|
||||
drawText(screen, pitch, x, y,
|
||||
screenMessageBuffer, false);
|
||||
} else {
|
||||
|
@ -2106,12 +2073,10 @@ void systemDrawScreen()
|
|||
filterFunction(pix + srcPitch, srcPitch, delta, screen,
|
||||
destPitch, sizeX, sizeY);
|
||||
|
||||
if (openGL)
|
||||
{
|
||||
if (openGL) {
|
||||
int bytes = (systemColorDepth >> 3);
|
||||
for (int i = 0; i < destWidth; i++)
|
||||
for (int j = 0; j < destHeight; j++)
|
||||
{
|
||||
for (int j = 0; j < destHeight; j++) {
|
||||
u8 k;
|
||||
k = filterPix[i * bytes + j * destPitch + 3];
|
||||
filterPix[i * bytes + j * destPitch + 3] = filterPix[i * bytes + j * destPitch + 1];
|
||||
|
@ -2153,7 +2118,6 @@ void systemDrawScreen()
|
|||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void systemSetTitle(const char* title)
|
||||
|
@ -2296,8 +2260,7 @@ void systemConsoleMessage(const char *msg)
|
|||
now_time_broken.tm_mday,
|
||||
now_time_broken.tm_mon + 1,
|
||||
now_time_broken.tm_year + 1900,
|
||||
msg
|
||||
);
|
||||
msg);
|
||||
}
|
||||
|
||||
void systemScreenMessage(const char* msg)
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
// Parts adapted from VBA-H (VBA for Hackers) by LabMaster
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../common/Port.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../gba/armdis.h"
|
||||
#include "../gba/elf.h"
|
||||
#include "../common/Port.h"
|
||||
#include "exprNode.h"
|
||||
|
||||
extern bool debugger;
|
||||
|
@ -225,9 +225,7 @@ static void debuggerPrefetch()
|
|||
static void debuggerApplyBreakpoint(u32 address, int num, int size)
|
||||
{
|
||||
if (size)
|
||||
debuggerWriteMemory(address, (u32)(0xe1200070 |
|
||||
(num & 0xf) |
|
||||
((num<<4)&0xf0)));
|
||||
debuggerWriteMemory(address, (u32)(0xe1200070 | (num & 0xf) | ((num << 4) & 0xf0)));
|
||||
else
|
||||
debuggerWriteHalfWord(address,
|
||||
(u16)(0xbe00 | num));
|
||||
|
@ -293,8 +291,7 @@ static void debuggerPrintBaseType(Type *t, u32 value, u32 location,
|
|||
if (t->size == 8) {
|
||||
u64 value = 0;
|
||||
if (type == LOCATION_memory) {
|
||||
value = debuggerReadMemory(location) |
|
||||
((u64)debuggerReadMemory(location+4)<<32);
|
||||
value = debuggerReadMemory(location) | ((u64)debuggerReadMemory(location + 4) << 32);
|
||||
} else if (type == LOCATION_register) {
|
||||
value = reg[location].I | ((u64)reg[location + 1].I << 32);
|
||||
}
|
||||
|
@ -858,14 +855,11 @@ static void debuggerContinue(int n, char **args)
|
|||
/*extern*/ void debuggerSignal(int sig, int number)
|
||||
{
|
||||
switch (sig) {
|
||||
case 4:
|
||||
{
|
||||
case 4: {
|
||||
printf("Illegal instruction at %08x\n", armNextPC);
|
||||
debugger = true;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
} break;
|
||||
case 5: {
|
||||
bool cond = debuggerCondEvaluate(number & 255);
|
||||
if (cond) {
|
||||
printf("Breakpoint %d reached\n", number);
|
||||
|
@ -890,8 +884,7 @@ static void debuggerContinue(int n, char **args)
|
|||
printf("File %s, function %s, line %d\n", file, f->name,
|
||||
line);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
printf("Unknown signal %d\n", sig);
|
||||
break;
|
||||
|
@ -919,17 +912,13 @@ static void debuggerBreakDelete(int n, char **args)
|
|||
n++;
|
||||
if (n < debuggerNumOfBreakpoints) {
|
||||
for (int i = n; i < debuggerNumOfBreakpoints; i++) {
|
||||
debuggerBreakpointList[i-1].address =
|
||||
debuggerBreakpointList[i].address;
|
||||
debuggerBreakpointList[i-1].value =
|
||||
debuggerBreakpointList[i].value;
|
||||
debuggerBreakpointList[i-1].size =
|
||||
debuggerBreakpointList[i].size;
|
||||
debuggerBreakpointList[i - 1].address = debuggerBreakpointList[i].address;
|
||||
debuggerBreakpointList[i - 1].value = debuggerBreakpointList[i].value;
|
||||
debuggerBreakpointList[i - 1].size = debuggerBreakpointList[i].size;
|
||||
}
|
||||
}
|
||||
debuggerNumOfBreakpoints--;
|
||||
}
|
||||
else
|
||||
} else
|
||||
printf("No breakpoints are set\n");
|
||||
} else
|
||||
debuggerUsage("bd");
|
||||
|
@ -1010,8 +999,7 @@ static void debuggerBreak(int n, char **args)
|
|||
if (type == 2)
|
||||
size = 1;
|
||||
debuggerBreakpointList[i].address = address;
|
||||
debuggerBreakpointList[i].value = type == 0x02 ?
|
||||
debuggerReadMemory(address) : debuggerReadHalfWord(address);
|
||||
debuggerBreakpointList[i].value = type == 0x02 ? debuggerReadMemory(address) : debuggerReadHalfWord(address);
|
||||
debuggerBreakpointList[i].size = size;
|
||||
// debuggerApplyBreakpoint(address, i, size);
|
||||
debuggerNumOfBreakpoints++;
|
||||
|
@ -1066,19 +1054,14 @@ static void debuggerBreakWriteClear(int n, char **args)
|
|||
int n = 0;
|
||||
sscanf(args[2], "%d", &n);
|
||||
|
||||
if (! ((address >= 0x02000000 && address < 0x02040000) ||
|
||||
(address >= 0x03000000 && address < 0x03008000) ||
|
||||
(address >= 0x05000000 && address < 0x05000400) ||
|
||||
(address >= 0x06000000 && address < 0x06018000) ||
|
||||
(address >= 0x07000000 && address < 0x07000400))) {
|
||||
if (!((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || (address >= 0x07000000 && address < 0x07000400))) {
|
||||
printf("Invalid address: %08x\n", address);
|
||||
return;
|
||||
}
|
||||
|
||||
u32 final = address + n;
|
||||
switch (address >> 24) {
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
address &= 0x3ffff;
|
||||
final &= 0x3ffff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1086,10 +1069,8 @@ static void debuggerBreakWriteClear(int n, char **args)
|
|||
freezeWorkRAM[i] = 0;
|
||||
printf("Cleared break on write from %08x to %08x\n",
|
||||
0x2000000 + address, 0x2000000 + final);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
} break;
|
||||
case 3: {
|
||||
address &= 0x7fff;
|
||||
final &= 0x7fff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1097,10 +1078,8 @@ static void debuggerBreakWriteClear(int n, char **args)
|
|||
freezeInternalRAM[i] = 0;
|
||||
printf("Cleared break on write from %08x to %08x\n",
|
||||
0x3000000 + address, 0x3000000 + final);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
} break;
|
||||
case 5: {
|
||||
address &= 0x3ff;
|
||||
final &= 0x3ff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1108,10 +1087,8 @@ static void debuggerBreakWriteClear(int n, char **args)
|
|||
freezePRAM[i] = 0;
|
||||
printf("Cleared break on write from %08x to %08x\n",
|
||||
0x5000000 + address, 0x5000000 + final);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
} break;
|
||||
case 6: {
|
||||
if (address > 0x6010000) {
|
||||
address &= 0x17fff;
|
||||
final &= 0x17fff;
|
||||
|
@ -1125,10 +1102,8 @@ static void debuggerBreakWriteClear(int n, char **args)
|
|||
freezeVRAM[i] = 0;
|
||||
printf("Cleared break on write from %08x to %08x\n",
|
||||
0x06000000 + address, 0x06000000 + final);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
} break;
|
||||
case 7: {
|
||||
address &= 0x3ff;
|
||||
final &= 0x3ff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1136,8 +1111,7 @@ static void debuggerBreakWriteClear(int n, char **args)
|
|||
freezeOAM[i] = 0;
|
||||
printf("Cleared break on write from %08x to %08x\n",
|
||||
0x7000000 + address, 0x7000000 + final);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
} else if (n == 1) {
|
||||
int i;
|
||||
|
@ -1174,11 +1148,7 @@ static void debuggerBreakWrite(int n, char **args)
|
|||
int n = 0;
|
||||
sscanf(args[2], "%d", &n);
|
||||
|
||||
if (! ((address >= 0x02000000 && address < 0x02040000) ||
|
||||
(address >= 0x03000000 && address < 0x03008000) ||
|
||||
(address >= 0x05000000 && address < 0x05000400) ||
|
||||
(address >= 0x06000000 && address < 0x06018000) ||
|
||||
(address >= 0x07000000 && address < 0x07000400))) {
|
||||
if (!((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || (address >= 0x07000000 && address < 0x07000400))) {
|
||||
printf("Invalid address: %08x\n", address);
|
||||
return;
|
||||
}
|
||||
|
@ -1240,19 +1210,14 @@ static void debuggerBreakChangeClear(int n, char **args)
|
|||
int n = 0;
|
||||
sscanf(args[2], "%d", &n);
|
||||
|
||||
if (! ((address >= 0x02000000 && address < 0x02040000) ||
|
||||
(address >= 0x03000000 && address < 0x03008000) ||
|
||||
(address >= 0x05000000 && address < 0x05000400) ||
|
||||
(address >= 0x06000000 && address < 0x06018000) ||
|
||||
(address >= 0x07000000 && address < 0x07000400))) {
|
||||
if (!((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || (address >= 0x07000000 && address < 0x07000400))) {
|
||||
printf("Invalid address: %08x\n", address);
|
||||
return;
|
||||
}
|
||||
|
||||
u32 final = address + n;
|
||||
switch (address >> 24) {
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
address &= 0x3ffff;
|
||||
final &= 0x3ffff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1260,10 +1225,8 @@ static void debuggerBreakChangeClear(int n, char **args)
|
|||
freezeWorkRAM[i] = 0;
|
||||
printf("Cleared break on change from %08x to %08x\n",
|
||||
0x2000000 + address, 0x2000000 + final);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
} break;
|
||||
case 3: {
|
||||
address &= 0x7fff;
|
||||
final &= 0x7fff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1271,10 +1234,8 @@ static void debuggerBreakChangeClear(int n, char **args)
|
|||
freezeInternalRAM[i] = 0;
|
||||
printf("Cleared break on change from %08x to %08x\n",
|
||||
0x3000000 + address, 0x3000000 + final);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
} break;
|
||||
case 5: {
|
||||
address &= 0x3ff;
|
||||
final &= 0x3ff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1282,10 +1243,8 @@ static void debuggerBreakChangeClear(int n, char **args)
|
|||
freezePRAM[i] = 0;
|
||||
printf("Cleared break on change from %08x to %08x\n",
|
||||
0x5000000 + address, 0x5000000 + final);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
} break;
|
||||
case 6: {
|
||||
if (address > 0x6010000) {
|
||||
address &= 0x17fff;
|
||||
final &= 0x17fff;
|
||||
|
@ -1298,10 +1257,8 @@ static void debuggerBreakChangeClear(int n, char **args)
|
|||
freezeVRAM[i] = 0;
|
||||
printf("Cleared break on change from %08x to %08x\n",
|
||||
0x3000000 + address, 0x3000000 + final);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
} break;
|
||||
case 7: {
|
||||
address &= 0x3ff;
|
||||
final &= 0x3ff;
|
||||
for (u32 i = address; i < final; i++)
|
||||
|
@ -1309,8 +1266,7 @@ static void debuggerBreakChangeClear(int n, char **args)
|
|||
freezeOAM[i] = 0;
|
||||
printf("Cleared break on change from %08x to %08x\n",
|
||||
0x7000000 + address, 0x7000000 + final);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
} else if (n == 1) {
|
||||
int i;
|
||||
|
@ -1347,11 +1303,7 @@ static void debuggerBreakChange(int n, char **args)
|
|||
int n = 0;
|
||||
sscanf(args[2], "%d", &n);
|
||||
|
||||
if (! ((address >= 0x02000000 && address < 0x02040000) ||
|
||||
(address >= 0x03000000 && address < 0x03008000) ||
|
||||
(address >= 0x05000000 && address < 0x05000400) ||
|
||||
(address >= 0x06000000 && address < 0x06018000) ||
|
||||
(address >= 0x07000000 && address < 0x07000400))) {
|
||||
if (!((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || (address >= 0x07000000 && address < 0x07000400))) {
|
||||
printf("Invalid address: %08x\n", address);
|
||||
return;
|
||||
}
|
||||
|
@ -1543,25 +1495,20 @@ static void debuggerFileDisassembleThumb(int n, char **args)
|
|||
|
||||
void debuggerFindText(int n, char** args)
|
||||
{
|
||||
if ((n == 4) || (n == 3))
|
||||
{
|
||||
if ((n == 4) || (n == 3)) {
|
||||
SearchResults = 0;
|
||||
sscanf(args[1], "%x", &SearchStart);
|
||||
|
||||
if (n == 4)
|
||||
{
|
||||
if (n == 4) {
|
||||
sscanf(args[2], "%u", &SearchMaxMatches);
|
||||
strncpy((char*)SearchData, args[3], 64);
|
||||
SearchLength = strlen(args[3]);
|
||||
}
|
||||
else if (n == 3)
|
||||
{
|
||||
} else if (n == 3) {
|
||||
strncpy((char*)SearchData, args[2], 64);
|
||||
SearchLength = strlen(args[2]);
|
||||
};
|
||||
|
||||
if (SearchLength > 64)
|
||||
{
|
||||
if (SearchLength > 64) {
|
||||
printf("Entered string (length: %d) is longer than 64 bytes and was cut.\n", SearchLength);
|
||||
SearchLength = 64;
|
||||
};
|
||||
|
@ -1574,20 +1521,16 @@ void debuggerFindText(int n, char **args)
|
|||
|
||||
void debuggerFindHex(int n, char** args)
|
||||
{
|
||||
if ((n == 4) || (n == 3))
|
||||
{
|
||||
if ((n == 4) || (n == 3)) {
|
||||
SearchResults = 0;
|
||||
sscanf(args[1], "%x", &SearchStart);
|
||||
|
||||
char SearchHex[128];
|
||||
if (n == 4)
|
||||
{
|
||||
if (n == 4) {
|
||||
sscanf(args[2], "%u", &SearchMaxMatches);
|
||||
strncpy(SearchHex, args[3], 128);
|
||||
SearchLength = strlen(args[3]);
|
||||
}
|
||||
else if (n == 3)
|
||||
{
|
||||
} else if (n == 3) {
|
||||
strncpy(SearchHex, args[2], 128);
|
||||
SearchLength = strlen(args[2]);
|
||||
};
|
||||
|
@ -1597,14 +1540,12 @@ void debuggerFindHex(int n, char **args)
|
|||
|
||||
SearchLength /= 2;
|
||||
|
||||
if (SearchLength > 64)
|
||||
{
|
||||
if (SearchLength > 64) {
|
||||
printf("Entered string (length: %d) is longer than 64 bytes and was cut.\n", SearchLength);
|
||||
SearchLength = 64;
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < SearchLength; i++)
|
||||
{
|
||||
for (unsigned int i = 0; i < SearchLength; i++) {
|
||||
unsigned int cbuf = 0;
|
||||
sscanf(&SearchHex[i << 1], "%02x", &cbuf);
|
||||
SearchData[i] = cbuf;
|
||||
|
@ -1618,10 +1559,8 @@ void debuggerFindHex(int n, char **args)
|
|||
|
||||
void debuggerFindResume(int n, char** args)
|
||||
{
|
||||
if ((n == 1) || (n == 2))
|
||||
{
|
||||
if (SearchLength == 0)
|
||||
{
|
||||
if ((n == 1) || (n == 2)) {
|
||||
if (SearchLength == 0) {
|
||||
printf("Error: No search in progress. Start a search with ft or fh.\n");
|
||||
debuggerUsage("fr");
|
||||
return;
|
||||
|
@ -1640,43 +1579,86 @@ void debuggerDoSearch()
|
|||
{
|
||||
unsigned int count = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
unsigned int final = SearchStart + SearchLength - 1;
|
||||
u8* end;
|
||||
u8* start;
|
||||
|
||||
switch (SearchStart >> 24)
|
||||
{
|
||||
switch (SearchStart >> 24) {
|
||||
case 0:
|
||||
if (final > 0x00003FFF) { SearchStart = 0x02000000; continue; }
|
||||
else { start = bios + (SearchStart & 0x3FFF); end = bios + 0x3FFF; break; };
|
||||
if (final > 0x00003FFF) {
|
||||
SearchStart = 0x02000000;
|
||||
continue;
|
||||
} else {
|
||||
start = bios + (SearchStart & 0x3FFF);
|
||||
end = bios + 0x3FFF;
|
||||
break;
|
||||
};
|
||||
case 2:
|
||||
if (final > 0x0203FFFF) { SearchStart = 0x03000000; continue; }
|
||||
else { start = workRAM + (SearchStart & 0x3FFFF); end = workRAM + 0x3FFFF; break; };
|
||||
if (final > 0x0203FFFF) {
|
||||
SearchStart = 0x03000000;
|
||||
continue;
|
||||
} else {
|
||||
start = workRAM + (SearchStart & 0x3FFFF);
|
||||
end = workRAM + 0x3FFFF;
|
||||
break;
|
||||
};
|
||||
case 3:
|
||||
if (final > 0x03007FFF) { SearchStart = 0x04000000; continue; }
|
||||
else { start = internalRAM + (SearchStart & 0x7FFF); end = internalRAM + 0x7FFF; break; };
|
||||
if (final > 0x03007FFF) {
|
||||
SearchStart = 0x04000000;
|
||||
continue;
|
||||
} else {
|
||||
start = internalRAM + (SearchStart & 0x7FFF);
|
||||
end = internalRAM + 0x7FFF;
|
||||
break;
|
||||
};
|
||||
case 4:
|
||||
if (final > 0x040003FF) { SearchStart = 0x05000000; continue; }
|
||||
else { start = ioMem + (SearchStart & 0x3FF); end = ioMem + 0x3FF; break; };
|
||||
if (final > 0x040003FF) {
|
||||
SearchStart = 0x05000000;
|
||||
continue;
|
||||
} else {
|
||||
start = ioMem + (SearchStart & 0x3FF);
|
||||
end = ioMem + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 5:
|
||||
if (final > 0x050003FF) { SearchStart = 0x06000000; continue; }
|
||||
else { start = paletteRAM + (SearchStart & 0x3FF); end = paletteRAM + 0x3FF; break; };
|
||||
if (final > 0x050003FF) {
|
||||
SearchStart = 0x06000000;
|
||||
continue;
|
||||
} else {
|
||||
start = paletteRAM + (SearchStart & 0x3FF);
|
||||
end = paletteRAM + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 6:
|
||||
if (final > 0x0601FFFF) { SearchStart = 0x07000000; continue; }
|
||||
else { start = vram + (SearchStart & 0x1FFFF); end = vram + 0x1FFFF; break; };
|
||||
if (final > 0x0601FFFF) {
|
||||
SearchStart = 0x07000000;
|
||||
continue;
|
||||
} else {
|
||||
start = vram + (SearchStart & 0x1FFFF);
|
||||
end = vram + 0x1FFFF;
|
||||
break;
|
||||
};
|
||||
case 7:
|
||||
if (final > 0x070003FF) { SearchStart = 0x08000000; continue; }
|
||||
else { start = oam + (SearchStart & 0x3FF); end = oam + 0x3FF; break; };
|
||||
if (final > 0x070003FF) {
|
||||
SearchStart = 0x08000000;
|
||||
continue;
|
||||
} else {
|
||||
start = oam + (SearchStart & 0x3FF);
|
||||
end = oam + 0x3FF;
|
||||
break;
|
||||
};
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
if (final <= 0x09FFFFFF)
|
||||
{ start = rom + (SearchStart & 0x01FFFFFF); end = rom + 0x01FFFFFF; break; };
|
||||
if (final <= 0x09FFFFFF) {
|
||||
start = rom + (SearchStart & 0x01FFFFFF);
|
||||
end = rom + 0x01FFFFFF;
|
||||
break;
|
||||
};
|
||||
default:
|
||||
printf("Search completed.\n");
|
||||
SearchLength = 0;
|
||||
|
@ -1685,8 +1667,7 @@ void debuggerDoSearch()
|
|||
|
||||
end -= SearchLength - 1;
|
||||
u8 firstbyte = SearchData[0];
|
||||
while (start <= end)
|
||||
{
|
||||
while (start <= end) {
|
||||
while ((start <= end) && (*start != firstbyte))
|
||||
start++;
|
||||
|
||||
|
@ -1697,12 +1678,10 @@ void debuggerDoSearch()
|
|||
while ((start[p] == SearchData[p]) && (p < SearchLength))
|
||||
p++;
|
||||
|
||||
if (p == SearchLength)
|
||||
{
|
||||
if (p == SearchLength) {
|
||||
printf("Search result (%d): %08x\n", count + SearchResults, AddressToGBA(start));
|
||||
count++;
|
||||
if (count == SearchMaxMatches)
|
||||
{
|
||||
if (count == SearchMaxMatches) {
|
||||
SearchStart = AddressToGBA(start + p);
|
||||
SearchResults += count;
|
||||
return;
|
||||
|
@ -1769,8 +1748,7 @@ static void debuggerRegisters(int, char **)
|
|||
char buffer[10];
|
||||
|
||||
#ifdef BKPT_SUPPORT
|
||||
if (debugger_last)
|
||||
{
|
||||
if (debugger_last) {
|
||||
printf("R00=%08x R04=%08x R08=%08x R12=%08x\n",
|
||||
oldreg[0], oldreg[4], oldreg[8], oldreg[12]);
|
||||
printf("R01=%08x R05=%08x R09=%08x R13=%08x\n",
|
||||
|
@ -1905,7 +1883,8 @@ static void debuggerIo(int n, char **args)
|
|||
debuggerIoTimer();
|
||||
else if (!strcmp(args[1], "misc"))
|
||||
debuggerIoMisc();
|
||||
else printf("Unrecognized option %s\n", args[1]);
|
||||
else
|
||||
printf("Unrecognized option %s\n", args[1]);
|
||||
}
|
||||
|
||||
static void debuggerEditByte(int n, char** args)
|
||||
|
@ -1970,7 +1949,6 @@ static void debuggerEdit(int n, char **args)
|
|||
debuggerUsage("ew");
|
||||
}
|
||||
|
||||
|
||||
#define ASCII(c) (c)<32 ? '.' : (c)> 127 ? '.' : (c)
|
||||
|
||||
static void debuggerMemoryByte(int n, char** args)
|
||||
|
@ -2106,8 +2084,7 @@ static void debuggerWriteState(int n, char **args)
|
|||
sdlWriteState(num - 1);
|
||||
else
|
||||
printf("Savestate number must be in the 1-10 range");
|
||||
}
|
||||
else
|
||||
} else
|
||||
debuggerUsage("save");
|
||||
}
|
||||
|
||||
|
@ -2121,8 +2098,7 @@ static void debuggerReadState(int n, char **args)
|
|||
sdlReadState(num - 1);
|
||||
else
|
||||
printf("Savestate number must be in the 1-10 range");
|
||||
}
|
||||
else
|
||||
} else
|
||||
debuggerUsage("load");
|
||||
}
|
||||
|
||||
|
@ -2204,7 +2180,6 @@ static void debuggerCondBreakThumb(int n, char **args)
|
|||
debuggerCondValidate(n, args, 2);
|
||||
} else
|
||||
debuggerUsage("cbt");
|
||||
|
||||
}
|
||||
|
||||
static void debuggerCondBreakArm(int n, char** args)
|
||||
|
@ -2571,8 +2546,7 @@ char* strqtok (char* string, const char* ctrl)
|
|||
|
||||
char deli[32];
|
||||
memset(deli, 0, 32 * sizeof(char));
|
||||
while (*ctrl)
|
||||
{
|
||||
while (*ctrl) {
|
||||
deli[*ctrl >> 3] |= (1 << (*ctrl & 7));
|
||||
ctrl++;
|
||||
};
|
||||
|
@ -2583,8 +2557,7 @@ char* strqtok (char* string, const char* ctrl)
|
|||
while ((deli[*str >> 3] & (1 << (*str & 7))) && *str)
|
||||
str++;
|
||||
|
||||
if (*str == '"')
|
||||
{
|
||||
if (*str == '"') {
|
||||
string = ++str;
|
||||
|
||||
// only break if another quote or end of string is found
|
||||
|
@ -2598,13 +2571,11 @@ char* strqtok (char* string, const char* ctrl)
|
|||
str++;
|
||||
};
|
||||
|
||||
if (string == str)
|
||||
{
|
||||
if (string == str) {
|
||||
nexttoken = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
if (*str)
|
||||
{
|
||||
if (*str) {
|
||||
*str = 0;
|
||||
nexttoken = str + 1;
|
||||
} else
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
|
@ -166,17 +166,14 @@ extern FILE *yyin, *yyout;
|
|||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
do \
|
||||
{ \
|
||||
do { \
|
||||
/* Undo effects of setting up yytext. */ \
|
||||
int yyless_macro_arg = (n); \
|
||||
YY_LESS_LINENO(yyless_macro_arg); \
|
||||
*yy_cp = (yy_hold_char); \
|
||||
YY_RESTORE_YY_MORE_OFFSET \
|
||||
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
|
||||
YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
|
||||
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
|
||||
} \
|
||||
while ( 0 )
|
||||
} while (0)
|
||||
|
||||
#define unput(c) yyunput(c, (yytext_ptr))
|
||||
|
||||
|
@ -187,8 +184,7 @@ typedef size_t yy_size_t;
|
|||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
struct yy_buffer_state {
|
||||
FILE* yy_input_file;
|
||||
|
||||
char* yy_ch_buf; /* input buffer */
|
||||
|
@ -246,7 +242,6 @@ struct yy_buffer_state
|
|||
* just pointing yyin at a new input file.
|
||||
*/
|
||||
#define YY_BUFFER_EOF_PENDING 2
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
|
@ -313,8 +308,7 @@ void yyfree (void * );
|
|||
{ \
|
||||
if (!YY_CURRENT_BUFFER) { \
|
||||
yyensure_buffer_stack(); \
|
||||
YY_CURRENT_BUFFER_LVALUE = \
|
||||
yy_create_buffer(yyin,YY_BUF_SIZE ); \
|
||||
YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
|
||||
} \
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
|
||||
}
|
||||
|
@ -323,8 +317,7 @@ void yyfree (void * );
|
|||
{ \
|
||||
if (!YY_CURRENT_BUFFER) { \
|
||||
yyensure_buffer_stack(); \
|
||||
YY_CURRENT_BUFFER_LVALUE = \
|
||||
yy_create_buffer(yyin,YY_BUF_SIZE ); \
|
||||
YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
|
||||
} \
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
|
||||
}
|
||||
|
@ -368,20 +361,16 @@ static void yy_fatal_error (yyconst char msg[] );
|
|||
#define YY_END_OF_BUFFER 11
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
{
|
||||
struct yy_trans_info {
|
||||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[24] =
|
||||
{ 0,
|
||||
static yyconst flex_int16_t yy_accept[24] = { 0,
|
||||
0, 0, 11, 9, 8, 8, 6, 7, 9, 4,
|
||||
3, 2, 2, 8, 5, 3, 2, 2, 2, 2,
|
||||
2, 1, 0
|
||||
} ;
|
||||
2, 1, 0 };
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
{ 0,
|
||||
static yyconst flex_int32_t yy_ec[256] = { 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -409,46 +398,35 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
1, 1, 1, 1, 1 };
|
||||
|
||||
static yyconst flex_int32_t yy_meta[17] =
|
||||
{ 0,
|
||||
static yyconst flex_int32_t yy_meta[17] = { 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 2, 1, 2,
|
||||
2, 2, 2, 2, 2, 2
|
||||
} ;
|
||||
2, 2, 2, 2, 2, 2 };
|
||||
|
||||
static yyconst flex_int16_t yy_base[25] =
|
||||
{ 0,
|
||||
static yyconst flex_int16_t yy_base[25] = { 0,
|
||||
0, 0, 32, 33, 15, 17, 33, 33, 22, 33,
|
||||
22, 0, 16, 19, 33, 20, 0, 11, 15, 11,
|
||||
12, 0, 33, 21
|
||||
} ;
|
||||
12, 0, 33, 21 };
|
||||
|
||||
static yyconst flex_int16_t yy_def[25] =
|
||||
{ 0,
|
||||
static yyconst flex_int16_t yy_def[25] = { 0,
|
||||
23, 1, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||
23, 24, 24, 23, 23, 23, 24, 24, 24, 24,
|
||||
24, 24, 0, 23
|
||||
} ;
|
||||
24, 24, 0, 23 };
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[50] =
|
||||
{ 0,
|
||||
static yyconst flex_int16_t yy_nxt[50] = { 0,
|
||||
4, 5, 6, 7, 8, 9, 10, 11, 4, 12,
|
||||
12, 12, 12, 12, 13, 12, 14, 14, 14, 14,
|
||||
14, 14, 17, 22, 21, 20, 19, 16, 18, 16,
|
||||
15, 23, 3, 23, 23, 23, 23, 23, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 23
|
||||
} ;
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 23 };
|
||||
|
||||
static yyconst flex_int16_t yy_chk[50] =
|
||||
{ 0,
|
||||
static yyconst flex_int16_t yy_chk[50] = { 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 5, 5, 6, 6,
|
||||
14, 14, 24, 21, 20, 19, 18, 16, 13, 11,
|
||||
9, 3, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 23
|
||||
} ;
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 23 };
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
static char* yy_last_accepting_cpos;
|
||||
|
@ -570,7 +548,11 @@ static int input (void );
|
|||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
|
||||
#define ECHO \
|
||||
do { \
|
||||
if (fwrite(yytext, yyleng, 1, yyout)) { \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
|
@ -578,34 +560,27 @@ static int input (void );
|
|||
*/
|
||||
#ifndef YY_INPUT
|
||||
#define YY_INPUT(buf, result, max_size) \
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) { \
|
||||
int c = '*'; \
|
||||
size_t n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
||||
for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
|
||||
buf[n] = (char)c; \
|
||||
if (c == '\n') \
|
||||
buf[n++] = (char)c; \
|
||||
if (c == EOF && ferror(yyin)) \
|
||||
YY_FATAL_ERROR("input in flex scanner failed"); \
|
||||
result = n; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
} else { \
|
||||
errno = 0; \
|
||||
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
|
||||
{ \
|
||||
if( errno != EINTR) \
|
||||
{ \
|
||||
while ((result = fread(buf, 1, max_size, yyin)) == 0 && ferror(yyin)) { \
|
||||
if (errno != EINTR) { \
|
||||
YY_FATAL_ERROR("input in flex scanner failed"); \
|
||||
break; \
|
||||
} \
|
||||
errno = 0; \
|
||||
clearerr(yyin); \
|
||||
} \
|
||||
}\
|
||||
\
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -665,11 +640,9 @@ YY_DECL
|
|||
|
||||
#line 33 "expr.l"
|
||||
|
||||
|
||||
#line 670 "expr-lex.cpp"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
if (!(yy_init)) {
|
||||
(yy_init) = 1;
|
||||
|
||||
#ifdef YY_USER_INIT
|
||||
|
@ -687,8 +660,7 @@ YY_DECL
|
|||
|
||||
if (!YY_CURRENT_BUFFER) {
|
||||
yyensure_buffer_stack();
|
||||
YY_CURRENT_BUFFER_LVALUE =
|
||||
yy_create_buffer(yyin,YY_BUF_SIZE );
|
||||
YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
|
||||
}
|
||||
|
||||
yy_load_buffer_state();
|
||||
|
@ -708,29 +680,24 @@ YY_DECL
|
|||
|
||||
yy_current_state = (yy_start);
|
||||
yy_match:
|
||||
do
|
||||
{
|
||||
do {
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
if (yy_accept[yy_current_state]) {
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
(yy_last_accepting_cpos) = yy_cp;
|
||||
}
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
|
||||
yy_current_state = (int)yy_def[yy_current_state];
|
||||
if (yy_current_state >= 24)
|
||||
yy_c = yy_meta[(unsigned int)yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 33 );
|
||||
} while (yy_base[yy_current_state] != 33);
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
if ( yy_act == 0 )
|
||||
{ /* have to back up */
|
||||
if (yy_act == 0) { /* have to back up */
|
||||
yy_cp = (yy_last_accepting_cpos);
|
||||
yy_current_state = (yy_last_accepting_state);
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
|
@ -740,8 +707,7 @@ yy_find_action:
|
|||
|
||||
do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
switch ( yy_act )
|
||||
{ /* beginning of action switch */
|
||||
switch (yy_act) { /* beginning of action switch */
|
||||
case 0: /* must back up */
|
||||
/* undo the effects of YY_DO_BEFORE_ACTION */
|
||||
*yy_cp = (yy_hold_char);
|
||||
|
@ -818,8 +784,7 @@ ECHO;
|
|||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
case YY_END_OF_BUFFER: {
|
||||
/* Amount of text matched not including the EOB char. */
|
||||
int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1;
|
||||
|
||||
|
@ -827,8 +792,7 @@ case YY_STATE_EOF(INITIAL):
|
|||
*yy_cp = (yy_hold_char);
|
||||
YY_RESTORE_YY_MORE_OFFSET
|
||||
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
|
||||
{
|
||||
if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
|
||||
/* We're scanning a new file or input source. It's
|
||||
* possible that this happened because the user
|
||||
* just pointed yyin at a new source and called
|
||||
|
@ -850,8 +814,7 @@ case YY_STATE_EOF(INITIAL):
|
|||
* end-of-buffer state). Contrast this with the test
|
||||
* in input().
|
||||
*/
|
||||
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
|
||||
{ /* This was really a NUL. */
|
||||
if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) { /* This was really a NUL. */
|
||||
yy_state_type yy_next_state;
|
||||
|
||||
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
|
||||
|
@ -871,29 +834,25 @@ case YY_STATE_EOF(INITIAL):
|
|||
|
||||
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
|
||||
|
||||
if ( yy_next_state )
|
||||
{
|
||||
if (yy_next_state) {
|
||||
/* Consume the NUL. */
|
||||
yy_cp = ++(yy_c_buf_p);
|
||||
yy_current_state = yy_next_state;
|
||||
goto yy_match;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
yy_cp = (yy_c_buf_p);
|
||||
goto yy_find_action;
|
||||
}
|
||||
}
|
||||
|
||||
else switch ( yy_get_next_buffer( ) )
|
||||
{
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
else
|
||||
switch (yy_get_next_buffer()) {
|
||||
case EOB_ACT_END_OF_FILE: {
|
||||
(yy_did_buffer_switch_on_eof) = 0;
|
||||
|
||||
if ( yywrap( ) )
|
||||
{
|
||||
if (yywrap()) {
|
||||
/* Note: because we've taken care in
|
||||
* yy_get_next_buffer() to have set up
|
||||
* yytext, we can now set up
|
||||
|
@ -909,8 +868,7 @@ case YY_STATE_EOF(INITIAL):
|
|||
goto do_action;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (!(yy_did_buffer_switch_on_eof))
|
||||
YY_NEW_FILE;
|
||||
}
|
||||
|
@ -918,8 +876,7 @@ case YY_STATE_EOF(INITIAL):
|
|||
}
|
||||
|
||||
case EOB_ACT_CONTINUE_SCAN:
|
||||
(yy_c_buf_p) =
|
||||
(yytext_ptr) + yy_amount_of_matched_text;
|
||||
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
|
||||
|
||||
yy_current_state = yy_get_previous_state();
|
||||
|
||||
|
@ -928,8 +885,7 @@ case YY_STATE_EOF(INITIAL):
|
|||
goto yy_match;
|
||||
|
||||
case EOB_ACT_LAST_MATCH:
|
||||
(yy_c_buf_p) =
|
||||
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
|
||||
(yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
|
||||
|
||||
yy_current_state = yy_get_previous_state();
|
||||
|
||||
|
@ -965,18 +921,15 @@ static int yy_get_next_buffer (void)
|
|||
YY_FATAL_ERROR(
|
||||
"fatal flex scanner internal error--end of buffer missed");
|
||||
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
|
||||
{ /* Don't try to fill the buffer, so this is an EOF. */
|
||||
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
|
||||
{
|
||||
if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */
|
||||
if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1) {
|
||||
/* We matched a single character, the EOB, so
|
||||
* treat this as a final EOF.
|
||||
*/
|
||||
return EOB_ACT_END_OF_FILE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* We matched some text prior to the EOB, first
|
||||
* process it.
|
||||
*/
|
||||
|
@ -998,22 +951,17 @@ static int yy_get_next_buffer (void)
|
|||
*/
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
|
||||
|
||||
else
|
||||
{
|
||||
int num_to_read =
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
else {
|
||||
int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
|
||||
while ( num_to_read <= 0 )
|
||||
{ /* Not enough room in the buffer - grow it. */
|
||||
while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */
|
||||
|
||||
/* just a shorter name for the current buffer */
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
|
||||
|
||||
int yy_c_buf_p_offset =
|
||||
(int) ((yy_c_buf_p) - b->yy_ch_buf);
|
||||
int yy_c_buf_p_offset = (int)((yy_c_buf_p)-b->yy_ch_buf);
|
||||
|
||||
if ( b->yy_is_our_buffer )
|
||||
{
|
||||
if (b->yy_is_our_buffer) {
|
||||
int new_size = b->yy_buf_size * 2;
|
||||
|
||||
if (new_size <= 0)
|
||||
|
@ -1024,8 +972,7 @@ static int yy_get_next_buffer (void)
|
|||
b->yy_ch_buf = (char*)
|
||||
/* Include room in for 2 EOB chars. */
|
||||
yyrealloc((void*)b->yy_ch_buf, b->yy_buf_size + 2);
|
||||
}
|
||||
else
|
||||
} else
|
||||
/* Can't grow it, we don't own it. */
|
||||
b->yy_ch_buf = 0;
|
||||
|
||||
|
@ -1035,9 +982,7 @@ static int yy_get_next_buffer (void)
|
|||
|
||||
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
|
||||
|
||||
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
|
||||
number_to_move - 1;
|
||||
|
||||
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
}
|
||||
|
||||
if (num_to_read > YY_READ_BUF_SIZE)
|
||||
|
@ -1050,19 +995,15 @@ static int yy_get_next_buffer (void)
|
|||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
|
||||
}
|
||||
|
||||
if ( (yy_n_chars) == 0 )
|
||||
{
|
||||
if ( number_to_move == YY_MORE_ADJ )
|
||||
{
|
||||
if ((yy_n_chars) == 0) {
|
||||
if (number_to_move == YY_MORE_ADJ) {
|
||||
ret_val = EOB_ACT_END_OF_FILE;
|
||||
yyrestart(yyin);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
ret_val = EOB_ACT_LAST_MATCH;
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
|
||||
YY_BUFFER_EOF_PENDING;
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1095,16 +1036,13 @@ static int yy_get_next_buffer (void)
|
|||
|
||||
yy_current_state = (yy_start);
|
||||
|
||||
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
|
||||
{
|
||||
for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
|
||||
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
if (yy_accept[yy_current_state]) {
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
(yy_last_accepting_cpos) = yy_cp;
|
||||
}
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
|
||||
yy_current_state = (int)yy_def[yy_current_state];
|
||||
if (yy_current_state >= 24)
|
||||
yy_c = yy_meta[(unsigned int)yy_c];
|
||||
|
@ -1126,13 +1064,11 @@ static int yy_get_next_buffer (void)
|
|||
register char* yy_cp = (yy_c_buf_p);
|
||||
|
||||
register YY_CHAR yy_c = 1;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
if (yy_accept[yy_current_state]) {
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
(yy_last_accepting_cpos) = yy_cp;
|
||||
}
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
|
||||
yy_current_state = (int)yy_def[yy_current_state];
|
||||
if (yy_current_state >= 24)
|
||||
yy_c = yy_meta[(unsigned int)yy_c];
|
||||
|
@ -1155,8 +1091,7 @@ static int yy_get_next_buffer (void)
|
|||
|
||||
*(yy_c_buf_p) = (yy_hold_char);
|
||||
|
||||
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
|
||||
{
|
||||
if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
|
||||
/* yy_c_buf_p now points to the character we want to return.
|
||||
* If this occurs *before* the EOB characters, then it's a
|
||||
* valid NUL; if not, then we've hit the end of the buffer.
|
||||
|
@ -1165,13 +1100,11 @@ static int yy_get_next_buffer (void)
|
|||
/* This was really a NUL. */
|
||||
*(yy_c_buf_p) = '\0';
|
||||
|
||||
else
|
||||
{ /* need more input */
|
||||
else { /* need more input */
|
||||
int offset = (yy_c_buf_p) - (yytext_ptr);
|
||||
++(yy_c_buf_p);
|
||||
|
||||
switch ( yy_get_next_buffer( ) )
|
||||
{
|
||||
switch (yy_get_next_buffer()) {
|
||||
case EOB_ACT_LAST_MATCH:
|
||||
/* This happens because yy_g_n_b()
|
||||
* sees that we've accumulated a
|
||||
|
@ -1188,8 +1121,7 @@ static int yy_get_next_buffer (void)
|
|||
|
||||
/*FALLTHROUGH*/
|
||||
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
case EOB_ACT_END_OF_FILE: {
|
||||
if (yywrap())
|
||||
return EOF;
|
||||
|
||||
|
@ -1227,8 +1159,7 @@ static int yy_get_next_buffer (void)
|
|||
|
||||
if (!YY_CURRENT_BUFFER) {
|
||||
yyensure_buffer_stack();
|
||||
YY_CURRENT_BUFFER_LVALUE =
|
||||
yy_create_buffer(yyin,YY_BUF_SIZE );
|
||||
YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
|
||||
}
|
||||
|
||||
yy_init_buffer(YY_CURRENT_BUFFER, input_file);
|
||||
|
@ -1251,8 +1182,7 @@ static int yy_get_next_buffer (void)
|
|||
if (YY_CURRENT_BUFFER == new_buffer)
|
||||
return;
|
||||
|
||||
if ( YY_CURRENT_BUFFER )
|
||||
{
|
||||
if (YY_CURRENT_BUFFER) {
|
||||
/* Flush out information for old buffer. */
|
||||
*(yy_c_buf_p) = (yy_hold_char);
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
|
||||
|
@ -1400,8 +1330,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
|
|||
yyensure_buffer_stack();
|
||||
|
||||
/* This block is copied from yy_switch_to_buffer. */
|
||||
if ( YY_CURRENT_BUFFER )
|
||||
{
|
||||
if (YY_CURRENT_BUFFER) {
|
||||
/* Flush out information for old buffer. */
|
||||
*(yy_c_buf_p) = (yy_hold_char);
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
|
||||
|
@ -1452,9 +1381,7 @@ static void yyensure_buffer_stack (void)
|
|||
* immediate realloc on the next call.
|
||||
*/
|
||||
num_to_alloc = 1;
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
|
||||
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
);
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
if (!(yy_buffer_stack))
|
||||
YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
|
||||
|
||||
|
@ -1471,10 +1398,8 @@ static void yyensure_buffer_stack (void)
|
|||
int grow_size = 8 /* arbitrary grow size */;
|
||||
|
||||
num_to_alloc = (yy_buffer_stack_max) + grow_size;
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
|
||||
((yy_buffer_stack),
|
||||
num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
);
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc((yy_buffer_stack),
|
||||
num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
if (!(yy_buffer_stack))
|
||||
YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
|
||||
|
||||
|
@ -1494,9 +1419,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
|
|||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
if ( size < 2 ||
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR)
|
||||
/* They forgot to leave room for the EOB's. */
|
||||
return 0;
|
||||
|
||||
|
@ -1584,8 +1507,7 @@ static void yy_fatal_error (yyconst char* msg )
|
|||
|
||||
#undef yyless
|
||||
#define yyless(n) \
|
||||
do \
|
||||
{ \
|
||||
do { \
|
||||
/* Undo effects of setting up yytext. */ \
|
||||
int yyless_macro_arg = (n); \
|
||||
YY_LESS_LINENO(yyless_macro_arg); \
|
||||
|
@ -1594,8 +1516,7 @@ static void yy_fatal_error (yyconst char* msg )
|
|||
(yy_hold_char) = *(yy_c_buf_p); \
|
||||
*(yy_c_buf_p) = '\0'; \
|
||||
yyleng = yyless_macro_arg; \
|
||||
} \
|
||||
while ( 0 )
|
||||
} while (0)
|
||||
|
||||
/* Accessor methods (get/set functions) to struct members. */
|
||||
|
||||
|
@ -1777,11 +1698,8 @@ void yyfree (void * ptr )
|
|||
|
||||
#line 67 "expr.l"
|
||||
|
||||
|
||||
|
||||
void exprCleanBuffer()
|
||||
{
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
yy_init = 1;
|
||||
}
|
||||
|
||||
|
|
332
src/sdl/expr.cpp
332
src/sdl/expr.cpp
|
@ -58,8 +58,6 @@
|
|||
/* Using locations. */
|
||||
#define YYLSP_NEEDED 0
|
||||
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
#define YYTOKENTYPE
|
||||
|
@ -84,15 +82,12 @@
|
|||
#define TOKEN_SIZEOF 263
|
||||
#define TOKEN_NUMBER 264
|
||||
|
||||
|
||||
|
||||
|
||||
/* Copy the first part of user declarations. */
|
||||
#line 1 "expr.ypp"
|
||||
|
||||
namespace std {
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
}
|
||||
|
@ -107,13 +102,11 @@ extern int yyerror(const char *);
|
|||
extern int yylex();
|
||||
extern char* yytext;
|
||||
|
||||
|
||||
//#define YYERROR_VERBOSE 1
|
||||
//#define YYDEBUG 1
|
||||
|
||||
Node* result = NULL;
|
||||
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
#define YYDEBUG 0
|
||||
|
@ -139,11 +132,8 @@ typedef int YYSTYPE;
|
|||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Copy the second part of user declarations. */
|
||||
|
||||
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 149 "expr.tab.cpp"
|
||||
|
||||
|
@ -223,8 +213,7 @@ static int
|
|||
YYID(int i)
|
||||
#else
|
||||
static int
|
||||
YYID (i)
|
||||
int i;
|
||||
YYID(i) int i;
|
||||
#endif
|
||||
{
|
||||
return i;
|
||||
|
@ -261,7 +250,10 @@ YYID (i)
|
|||
|
||||
#ifdef YYSTACK_ALLOC
|
||||
/* Pacify GCC's `empty if-body' warning. */
|
||||
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
|
||||
#define YYSTACK_FREE(Ptr) \
|
||||
do { /* empty */ \
|
||||
; \
|
||||
} while (YYID(0))
|
||||
#ifndef YYSTACK_ALLOC_MAXIMUM
|
||||
/* The OS might guarantee only one guard page at the bottom of the stack,
|
||||
and a page size can be as small as 4096 bytes. So we cannot safely
|
||||
|
@ -300,14 +292,12 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
|||
#endif
|
||||
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
|
||||
|
||||
|
||||
#if (!defined yyoverflow \
|
||||
&& (!defined __cplusplus \
|
||||
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
||||
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
{
|
||||
union yyalloc {
|
||||
yytype_int16 yyss;
|
||||
YYSTYPE yyvs;
|
||||
};
|
||||
|
@ -329,13 +319,11 @@ union yyalloc
|
|||
__builtin_memcpy(To, From, (Count) * sizeof(*(From)))
|
||||
#else
|
||||
#define YYCOPY(To, From, Count) \
|
||||
do \
|
||||
{ \
|
||||
do { \
|
||||
YYSIZE_T yyi; \
|
||||
for (yyi = 0; yyi < (Count); yyi++) \
|
||||
(To)[yyi] = (From)[yyi]; \
|
||||
} \
|
||||
while (YYID (0))
|
||||
} while (YYID(0))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -345,15 +333,13 @@ union yyalloc
|
|||
stack. Advance YYPTR to a properly aligned location for the next
|
||||
stack. */
|
||||
#define YYSTACK_RELOCATE(Stack) \
|
||||
do \
|
||||
{ \
|
||||
do { \
|
||||
YYSIZE_T yynewbytes; \
|
||||
YYCOPY(&yyptr->Stack, Stack, yysize); \
|
||||
Stack = &yyptr->Stack; \
|
||||
yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||
yyptr += yynewbytes / sizeof(*yyptr); \
|
||||
} \
|
||||
while (YYID (0))
|
||||
} while (YYID(0))
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -379,8 +365,7 @@ union yyalloc
|
|||
((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const yytype_uint8 yytranslate[] =
|
||||
{
|
||||
static const yytype_uint8 yytranslate[] = {
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
|
@ -413,15 +398,13 @@ static const yytype_uint8 yytranslate[] =
|
|||
#if YYDEBUG
|
||||
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||
YYRHS. */
|
||||
static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
static const yytype_uint8 yyprhs[] = {
|
||||
0, 0, 3, 5, 7, 11, 15, 19, 24, 26,
|
||||
29, 32, 37, 39
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
static const yytype_int8 yyrhs[] = {
|
||||
15, 0, -1, 16, -1, 17, -1, 11, 16, 12,
|
||||
-1, 16, 4, 19, -1, 16, 6, 19, -1, 16,
|
||||
10, 18, 13, -1, 19, -1, 5, 16, -1, 7,
|
||||
|
@ -430,8 +413,7 @@ static const yytype_int8 yyrhs[] =
|
|||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
static const yytype_uint8 yyrline[] = {
|
||||
0, 32, 32, 36, 37, 38, 39, 40, 43, 44,
|
||||
45, 46, 50, 54
|
||||
};
|
||||
|
@ -440,8 +422,7 @@ static const yytype_uint8 yyrline[] =
|
|||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
static const char* const yytname[] = {
|
||||
"$end", "error", "$undefined", "TOKEN_IDENTIFIER", "TOKEN_DOT",
|
||||
"TOKEN_STAR", "TOKEN_ARROW", "TOKEN_ADDR", "TOKEN_SIZEOF",
|
||||
"TOKEN_NUMBER", "'['", "'('", "')'", "']'", "$accept", "final",
|
||||
|
@ -452,23 +433,20 @@ static const char *const yytname[] =
|
|||
#ifdef YYPRINT
|
||||
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
|
||||
token YYLEX-NUM. */
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
static const yytype_uint16 yytoknum[] = {
|
||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||
91, 40, 41, 93
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
static const yytype_uint8 yyr1[] = {
|
||||
0, 14, 15, 16, 16, 16, 16, 16, 17, 17,
|
||||
17, 17, 18, 19
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
static const yytype_uint8 yyr2[] = {
|
||||
0, 2, 1, 1, 3, 3, 3, 4, 1, 2,
|
||||
2, 4, 1, 1
|
||||
};
|
||||
|
@ -476,32 +454,28 @@ static const yytype_uint8 yyr2[] =
|
|||
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
||||
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
|
||||
means the default is an error. */
|
||||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
static const yytype_uint8 yydefact[] = {
|
||||
0, 13, 0, 0, 0, 0, 0, 2, 3, 8,
|
||||
9, 10, 0, 0, 1, 0, 0, 0, 0, 4,
|
||||
5, 6, 12, 0, 11, 7
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
static const yytype_int8 yydefgoto[] = {
|
||||
-1, 6, 7, 8, 23, 9
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -10
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
static const yytype_int8 yypact[] = {
|
||||
1, -10, 1, 1, -9, 1, 5, 17, -10, -10,
|
||||
17, 17, 1, 7, -10, 4, 4, 6, 10, -10,
|
||||
-10, -10, -10, 13, -10, -10
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
static const yytype_int8 yypgoto[] = {
|
||||
-10, -10, -2, -10, -10, 9
|
||||
};
|
||||
|
||||
|
@ -510,15 +484,13 @@ static const yytype_int8 yypgoto[] =
|
|||
number is the opposite. If zero, do what YYDEFACT says.
|
||||
If YYTABLE_NINF, syntax error. */
|
||||
#define YYTABLE_NINF -1
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
static const yytype_uint8 yytable[] = {
|
||||
10, 11, 12, 13, 1, 14, 2, 1, 3, 4,
|
||||
18, 15, 5, 16, 15, 22, 16, 17, 0, 19,
|
||||
17, 15, 24, 16, 20, 21, 25, 17
|
||||
};
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
static const yytype_int8 yycheck[] = {
|
||||
2, 3, 11, 5, 3, 0, 5, 3, 7, 8,
|
||||
12, 4, 11, 6, 4, 9, 6, 10, -1, 12,
|
||||
10, 4, 12, 6, 15, 16, 13, 10
|
||||
|
@ -526,8 +498,7 @@ static const yytype_int8 yycheck[] =
|
|||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
static const yytype_uint8 yystos[] = {
|
||||
0, 3, 5, 7, 8, 11, 15, 16, 17, 19,
|
||||
16, 16, 11, 16, 0, 4, 6, 10, 16, 12,
|
||||
19, 19, 9, 18, 12, 13
|
||||
|
@ -542,7 +513,6 @@ static const yytype_uint8 yystos[] =
|
|||
#define YYABORT goto yyabortlab
|
||||
#define YYERROR goto yyerrorlab
|
||||
|
||||
|
||||
/* Like YYERROR except do call yyerror. This remains here temporarily
|
||||
to ease the transition to the new meaning of YYERROR, for GCC.
|
||||
Once GCC version 2 has supplanted version 1, this can go. */
|
||||
|
@ -553,26 +523,21 @@ static const yytype_uint8 yystos[] =
|
|||
|
||||
#define YYBACKUP(Token, Value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY && yylen == 1) \
|
||||
{ \
|
||||
if (yychar == YYEMPTY && yylen == 1) { \
|
||||
yychar = (Token); \
|
||||
yylval = (Value); \
|
||||
yytoken = YYTRANSLATE(yychar); \
|
||||
YYPOPSTACK(1); \
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
} else { \
|
||||
yyerror(YY_("syntax error: cannot back up")); \
|
||||
YYERROR; \
|
||||
} \
|
||||
while (YYID(0))
|
||||
|
||||
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
|
||||
|
||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||
If N is 0, then set CURRENT to the empty location which ends
|
||||
the previous symbol: RHS[0] (always defined). */
|
||||
|
@ -581,24 +546,18 @@ while (YYID (0))
|
|||
#ifndef YYLLOC_DEFAULT
|
||||
#define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do \
|
||||
if (YYID (N)) \
|
||||
{ \
|
||||
if (YYID(N)) { \
|
||||
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
|
||||
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
|
||||
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
|
||||
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).first_line = (Current).last_line = \
|
||||
YYRHSLOC (Rhs, 0).last_line; \
|
||||
(Current).first_column = (Current).last_column = \
|
||||
YYRHSLOC (Rhs, 0).last_column; \
|
||||
} else { \
|
||||
(Current).first_line = (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
|
||||
(Current).first_column = (Current).last_column = YYRHSLOC(Rhs, 0).last_column; \
|
||||
} \
|
||||
while (YYID(0))
|
||||
#endif
|
||||
|
||||
|
||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||
This macro was not mandated originally: define only if we know
|
||||
we won't break user code: when these are the locations we know. */
|
||||
|
@ -614,7 +573,6 @@ while (YYID (0))
|
|||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||
|
||||
#ifdef YYLEX_PARAM
|
||||
|
@ -639,8 +597,7 @@ do { \
|
|||
|
||||
#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||
do { \
|
||||
if (yydebug) \
|
||||
{ \
|
||||
if (yydebug) { \
|
||||
YYFPRINTF(stderr, "%s ", Title); \
|
||||
yy_symbol_print(stderr, \
|
||||
Type, Value); \
|
||||
|
@ -648,7 +605,6 @@ do { \
|
|||
} \
|
||||
} while (YYID(0))
|
||||
|
||||
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
@ -674,14 +630,12 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
|
|||
#else
|
||||
YYUSE(yyoutput);
|
||||
#endif
|
||||
switch (yytype)
|
||||
{
|
||||
switch (yytype) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
@ -735,7 +689,6 @@ do { \
|
|||
yy_stack_print((Bottom), (Top)); \
|
||||
} while (YYID(0))
|
||||
|
||||
|
||||
/*------------------------------------------------.
|
||||
| Report that the YYRULE is going to be reduced. |
|
||||
`------------------------------------------------*/
|
||||
|
@ -757,12 +710,10 @@ yy_reduce_print (yyvsp, yyrule)
|
|||
YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||
yyrule - 1, yylno);
|
||||
/* The symbols being reduced. */
|
||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||
{
|
||||
for (yyi = 0; yyi < yynrhs; yyi++) {
|
||||
fprintf(stderr, " $%d = ", yyi + 1);
|
||||
yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||
&(yyvsp[(yyi + 1) - (yynrhs)])
|
||||
);
|
||||
&(yyvsp[(yyi + 1) - (yynrhs)]));
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -783,7 +734,6 @@ int yydebug;
|
|||
#define YY_REDUCE_PRINT(Rule)
|
||||
#endif /* !YYDEBUG */
|
||||
|
||||
|
||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||
#ifndef YYINITDEPTH
|
||||
#define YYINITDEPTH 200
|
||||
|
@ -800,8 +750,6 @@ int yydebug;
|
|||
#define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if YYERROR_VERBOSE
|
||||
|
||||
#ifndef yystrlen
|
||||
|
@ -839,8 +787,7 @@ static char *
|
|||
yystpcpy(char* yydest, const char* yysrc)
|
||||
#else
|
||||
static char*
|
||||
yystpcpy (yydest, yysrc)
|
||||
char *yydest;
|
||||
yystpcpy(yydest, yysrc) char* yydest;
|
||||
const char* yysrc;
|
||||
#endif
|
||||
{
|
||||
|
@ -866,14 +813,12 @@ yystpcpy (yydest, yysrc)
|
|||
static YYSIZE_T
|
||||
yytnamerr(char* yyres, const char* yystr)
|
||||
{
|
||||
if (*yystr == '"')
|
||||
{
|
||||
if (*yystr == '"') {
|
||||
YYSIZE_T yyn = 0;
|
||||
char const* yyp = yystr;
|
||||
|
||||
for (;;)
|
||||
switch (*++yyp)
|
||||
{
|
||||
switch (*++yyp) {
|
||||
case '\'':
|
||||
case ',':
|
||||
goto do_not_strip_quotes;
|
||||
|
@ -917,8 +862,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||
|
||||
if (!(YYPACT_NINF < yyn && yyn <= YYLAST))
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
else {
|
||||
int yytype = YYTRANSLATE(yychar);
|
||||
YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]);
|
||||
YYSIZE_T yysize = yysize0;
|
||||
|
@ -961,10 +905,8 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||
yyfmt = yystpcpy(yyformat, yyunexpected);
|
||||
|
||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||||
{
|
||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||
{
|
||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) {
|
||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
|
||||
yycount = 1;
|
||||
yysize = yysize0;
|
||||
yyformat[sizeof yyunexpected - 1] = '\0';
|
||||
|
@ -986,22 +928,17 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||
if (yysize_overflow)
|
||||
return YYSIZE_MAXIMUM;
|
||||
|
||||
if (yyresult)
|
||||
{
|
||||
if (yyresult) {
|
||||
/* Avoid sprintf, as that infringes on the user's name space.
|
||||
Don't have undefined behavior even if the translation
|
||||
produced a string with the wrong number of "%s"s. */
|
||||
char* yyp = yyresult;
|
||||
int yyi = 0;
|
||||
while ((*yyp = *yyf) != '\0')
|
||||
{
|
||||
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
||||
{
|
||||
while ((*yyp = *yyf) != '\0') {
|
||||
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) {
|
||||
yyp += yytnamerr(yyp, yyarg[yyi++]);
|
||||
yyf += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
yyp++;
|
||||
yyf++;
|
||||
}
|
||||
|
@ -1011,7 +948,6 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||
}
|
||||
}
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
|
||||
|
||||
/*-----------------------------------------------.
|
||||
| Release the memory associated to this symbol. |
|
||||
|
@ -1036,14 +972,12 @@ yydestruct (yymsg, yytype, yyvaluep)
|
|||
yymsg = "Deleting";
|
||||
YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
|
||||
|
||||
switch (yytype)
|
||||
{
|
||||
switch (yytype) {
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Prevent warnings from -Wmissing-prototypes. */
|
||||
|
||||
|
@ -1061,8 +995,6 @@ int yyparse ();
|
|||
#endif
|
||||
#endif /* ! YYPARSE_PARAM */
|
||||
|
||||
|
||||
|
||||
/* The look-ahead symbol. */
|
||||
int yychar;
|
||||
|
||||
|
@ -1072,8 +1004,6 @@ YYSTYPE yylval;
|
|||
/* Number of syntax errors so far. */
|
||||
int yynerrs;
|
||||
|
||||
|
||||
|
||||
/*----------.
|
||||
| yyparse. |
|
||||
`----------*/
|
||||
|
@ -1081,21 +1011,17 @@ int yynerrs;
|
|||
#ifdef YYPARSE_PARAM
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
int
|
||||
yyparse (void *YYPARSE_PARAM)
|
||||
int yyparse(void* YYPARSE_PARAM)
|
||||
#else
|
||||
int
|
||||
yyparse (YYPARSE_PARAM)
|
||||
void *YYPARSE_PARAM;
|
||||
yyparse(YYPARSE_PARAM) void* YYPARSE_PARAM;
|
||||
#endif
|
||||
#else /* ! YYPARSE_PARAM */
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
int
|
||||
yyparse (void)
|
||||
int yyparse(void)
|
||||
#else
|
||||
int
|
||||
yyparse ()
|
||||
int yyparse()
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1133,8 +1059,6 @@ yyparse ()
|
|||
YYSTYPE* yyvs = yyvsa;
|
||||
YYSTYPE* yyvsp;
|
||||
|
||||
|
||||
|
||||
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
|
||||
|
||||
YYSIZE_T yystacksize = YYINITDEPTH;
|
||||
|
@ -1143,7 +1067,6 @@ yyparse ()
|
|||
action routines. */
|
||||
YYSTYPE yyval;
|
||||
|
||||
|
||||
/* The number of symbols on the RHS of the reduced rule.
|
||||
Keep to zero when no symbol should be popped. */
|
||||
int yylen = 0;
|
||||
|
@ -1176,8 +1099,7 @@ yyparse ()
|
|||
yysetstate:
|
||||
*yyssp = yystate;
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp)
|
||||
{
|
||||
if (yyss + yystacksize - 1 <= yyssp) {
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
YYSIZE_T yysize = yyssp - yyss + 1;
|
||||
|
||||
|
@ -1189,7 +1111,6 @@ yyparse ()
|
|||
YYSTYPE* yyvs1 = yyvs;
|
||||
yytype_int16* yyss1 = yyss;
|
||||
|
||||
|
||||
/* Each stack pointer address is followed by the size of the
|
||||
data in use in that stack, in bytes. This used to be a
|
||||
conditional around just the two extra args, but that might
|
||||
|
@ -1216,8 +1137,7 @@ yyparse ()
|
|||
|
||||
{
|
||||
yytype_int16* yyss1 = yyss;
|
||||
union yyalloc *yyptr =
|
||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
union yyalloc* yyptr = (union yyalloc*)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
|
||||
if (!yyptr)
|
||||
goto yyexhaustedlab;
|
||||
YYSTACK_RELOCATE(yyss);
|
||||
|
@ -1233,7 +1153,6 @@ yyparse ()
|
|||
yyssp = yyss + yysize - 1;
|
||||
yyvsp = yyvs + yysize - 1;
|
||||
|
||||
|
||||
YYDPRINTF((stderr, "Stack size increased to %lu\n",
|
||||
(unsigned long int)yystacksize));
|
||||
|
||||
|
@ -1261,19 +1180,15 @@ yybackup:
|
|||
/* Not known => get a look-ahead token if don't already have one. */
|
||||
|
||||
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
|
||||
if (yychar == YYEMPTY)
|
||||
{
|
||||
if (yychar == YYEMPTY) {
|
||||
YYDPRINTF((stderr, "Reading a token: "));
|
||||
yychar = YYLEX;
|
||||
}
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
{
|
||||
if (yychar <= YYEOF) {
|
||||
yychar = yytoken = YYEOF;
|
||||
YYDPRINTF((stderr, "Now at end of input.\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
yytoken = YYTRANSLATE(yychar);
|
||||
YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
|
||||
}
|
||||
|
@ -1284,8 +1199,7 @@ yybackup:
|
|||
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
|
||||
goto yydefault;
|
||||
yyn = yytable[yyn];
|
||||
if (yyn <= 0)
|
||||
{
|
||||
if (yyn <= 0) {
|
||||
if (yyn == 0 || yyn == YYTABLE_NINF)
|
||||
goto yyerrlab;
|
||||
yyn = -yyn;
|
||||
|
@ -1312,7 +1226,6 @@ yybackup:
|
|||
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
/*-----------------------------------------------------------.
|
||||
| yydefault -- do the default action for the current state. |
|
||||
`-----------------------------------------------------------*/
|
||||
|
@ -1322,7 +1235,6 @@ yydefault:
|
|||
goto yyerrlab;
|
||||
goto yyreduce;
|
||||
|
||||
|
||||
/*-----------------------------.
|
||||
| yyreduce -- Do a reduction. |
|
||||
`-----------------------------*/
|
||||
|
@ -1340,74 +1252,96 @@ yyreduce:
|
|||
GCC warning that YYVAL may be used uninitialized. */
|
||||
yyval = yyvsp[1 - yylen];
|
||||
|
||||
|
||||
YY_REDUCE_PRINT(yyn);
|
||||
switch (yyn)
|
||||
{
|
||||
switch (yyn) {
|
||||
case 2:
|
||||
#line 32 "expr.ypp"
|
||||
{ result = (yyvsp[(1) - (1)]); ;}
|
||||
break;
|
||||
{
|
||||
result = (yyvsp[(1) - (1)]);
|
||||
;
|
||||
} break;
|
||||
|
||||
case 3:
|
||||
#line 36 "expr.ypp"
|
||||
{ (yyval) = (yyvsp[(1) - (1)]); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = (yyvsp[(1) - (1)]);
|
||||
;
|
||||
} break;
|
||||
|
||||
case 4:
|
||||
#line 37 "expr.ypp"
|
||||
{ (yyval) = (yyvsp[(2) - (3)]); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = (yyvsp[(2) - (3)]);
|
||||
;
|
||||
} break;
|
||||
|
||||
case 5:
|
||||
#line 38 "expr.ypp"
|
||||
{ (yyval) = exprNodeDot((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeDot((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
|
||||
;
|
||||
} break;
|
||||
|
||||
case 6:
|
||||
#line 39 "expr.ypp"
|
||||
{ (yyval) = exprNodeArrow((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeArrow((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
|
||||
;
|
||||
} break;
|
||||
|
||||
case 7:
|
||||
#line 40 "expr.ypp"
|
||||
{ (yyval) = exprNodeArray((yyvsp[(1) - (4)]), (yyvsp[(3) - (4)])); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeArray((yyvsp[(1) - (4)]), (yyvsp[(3) - (4)]));
|
||||
;
|
||||
} break;
|
||||
|
||||
case 8:
|
||||
#line 43 "expr.ypp"
|
||||
{ (yyval) = (yyvsp[(1) - (1)]); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = (yyvsp[(1) - (1)]);
|
||||
;
|
||||
} break;
|
||||
|
||||
case 9:
|
||||
#line 44 "expr.ypp"
|
||||
{ (yyval) = exprNodeStar((yyvsp[(2) - (2)])); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeStar((yyvsp[(2) - (2)]));
|
||||
;
|
||||
} break;
|
||||
|
||||
case 10:
|
||||
#line 45 "expr.ypp"
|
||||
{ (yyval) = exprNodeAddr((yyvsp[(2) - (2)])); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeAddr((yyvsp[(2) - (2)]));
|
||||
;
|
||||
} break;
|
||||
|
||||
case 11:
|
||||
#line 46 "expr.ypp"
|
||||
{ (yyval) = exprNodeSizeof((yyvsp[(3) - (4)])); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeSizeof((yyvsp[(3) - (4)]));
|
||||
;
|
||||
} break;
|
||||
|
||||
case 12:
|
||||
#line 50 "expr.ypp"
|
||||
{ (yyval) = exprNodeNumber(); ;}
|
||||
break;
|
||||
{
|
||||
(yyval) = exprNodeNumber();
|
||||
;
|
||||
} break;
|
||||
|
||||
case 13:
|
||||
#line 54 "expr.ypp"
|
||||
{(yyval) = exprNodeIdentifier(); ;}
|
||||
break;
|
||||
|
||||
{
|
||||
(yyval) = exprNodeIdentifier();
|
||||
;
|
||||
} break;
|
||||
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 1410 "expr.tab.cpp"
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
|
||||
|
@ -1417,7 +1351,6 @@ yyreduce:
|
|||
|
||||
*++yyvsp = yyval;
|
||||
|
||||
|
||||
/* Now `shift' the result of the reduction. Determine what state
|
||||
that goes to, based on the state we popped back to and the rule
|
||||
number reduced by. */
|
||||
|
@ -1432,22 +1365,19 @@ yyreduce:
|
|||
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
/*------------------------------------.
|
||||
| yyerrlab -- here on detecting error |
|
||||
`------------------------------------*/
|
||||
yyerrlab:
|
||||
/* If not already recovering from an error, report this error. */
|
||||
if (!yyerrstatus)
|
||||
{
|
||||
if (!yyerrstatus) {
|
||||
++yynerrs;
|
||||
#if !YYERROR_VERBOSE
|
||||
yyerror(YY_("syntax error"));
|
||||
#else
|
||||
{
|
||||
YYSIZE_T yysize = yysyntax_error(0, yystate, yychar);
|
||||
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
||||
{
|
||||
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) {
|
||||
YYSIZE_T yyalloc = 2 * yysize;
|
||||
if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
|
||||
yyalloc = YYSTACK_ALLOC_MAXIMUM;
|
||||
|
@ -1456,20 +1386,16 @@ yyerrlab:
|
|||
yymsg = (char*)YYSTACK_ALLOC(yyalloc);
|
||||
if (yymsg)
|
||||
yymsg_alloc = yyalloc;
|
||||
else
|
||||
{
|
||||
else {
|
||||
yymsg = yymsgbuf;
|
||||
yymsg_alloc = sizeof yymsgbuf;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < yysize && yysize <= yymsg_alloc)
|
||||
{
|
||||
if (0 < yysize && yysize <= yymsg_alloc) {
|
||||
(void)yysyntax_error(yymsg, yystate, yychar);
|
||||
yyerror(yymsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
yyerror(YY_("syntax error"));
|
||||
if (yysize != 0)
|
||||
goto yyexhaustedlab;
|
||||
|
@ -1478,21 +1404,15 @@ yyerrlab:
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (yyerrstatus == 3)
|
||||
{
|
||||
if (yyerrstatus == 3) {
|
||||
/* If just tried and failed to reuse look-ahead token after an
|
||||
error, discard it. */
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
{
|
||||
if (yychar <= YYEOF) {
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == YYEOF)
|
||||
YYABORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
yydestruct("Error: discarding",
|
||||
yytoken, &yylval);
|
||||
yychar = YYEMPTY;
|
||||
|
@ -1503,7 +1423,6 @@ yyerrlab:
|
|||
token. */
|
||||
goto yyerrlab1;
|
||||
|
||||
|
||||
/*---------------------------------------------------.
|
||||
| yyerrorlab -- error raised explicitly by YYERROR. |
|
||||
`---------------------------------------------------*/
|
||||
|
@ -1523,21 +1442,17 @@ yyerrorlab:
|
|||
yystate = *yyssp;
|
||||
goto yyerrlab1;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------.
|
||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||
`-------------------------------------------------------------*/
|
||||
yyerrlab1:
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
yyn = yypact[yystate];
|
||||
if (yyn != YYPACT_NINF)
|
||||
{
|
||||
if (yyn != YYPACT_NINF) {
|
||||
yyn += YYTERROR;
|
||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
||||
{
|
||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
|
||||
yyn = yytable[yyn];
|
||||
if (0 < yyn)
|
||||
break;
|
||||
|
@ -1548,7 +1463,6 @@ yyerrlab1:
|
|||
if (yyssp == yyss)
|
||||
YYABORT;
|
||||
|
||||
|
||||
yydestruct("Error: popping",
|
||||
yystos[yystate], yyvsp);
|
||||
YYPOPSTACK(1);
|
||||
|
@ -1561,14 +1475,12 @@ yyerrlab1:
|
|||
|
||||
*++yyvsp = yylval;
|
||||
|
||||
|
||||
/* Shift the error token. */
|
||||
YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp);
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
/*-------------------------------------.
|
||||
| yyacceptlab -- YYACCEPT comes here. |
|
||||
`-------------------------------------*/
|
||||
|
@ -1601,8 +1513,7 @@ yyreturn:
|
|||
this YYABORT or YYACCEPT. */
|
||||
YYPOPSTACK(yylen);
|
||||
YY_STACK_PRINT(yyss, yyssp);
|
||||
while (yyssp != yyss)
|
||||
{
|
||||
while (yyssp != yyss) {
|
||||
yydestruct("Cleanup: popping",
|
||||
yystos[*yyssp], yyvsp);
|
||||
YYPOPSTACK(1);
|
||||
|
@ -1619,10 +1530,8 @@ yyreturn:
|
|||
return YYID(yyresult);
|
||||
}
|
||||
|
||||
|
||||
#line 57 "expr.ypp"
|
||||
|
||||
|
||||
int yyerror(const char* s)
|
||||
{
|
||||
return 0;
|
||||
|
@ -1642,4 +1551,3 @@ int main(int argc, char **argv)
|
|||
result->print();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/Port.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/elf.h"
|
||||
#include "../common/Port.h"
|
||||
#include "exprNode.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
@ -163,8 +163,7 @@ bool exprNodeDotResolve(Node *n, Function *f, CompileUnit *u)
|
|||
if (n->expression->resolve(n->expression, f, u)) {
|
||||
TypeEnum tt = n->expression->type->type;
|
||||
|
||||
if(tt == TYPE_struct ||
|
||||
tt == TYPE_union) {
|
||||
if (tt == TYPE_struct || tt == TYPE_union) {
|
||||
u32 loc = n->expression->location;
|
||||
Type* t = n->expression->type;
|
||||
int count = t->structure->memberCount;
|
||||
|
@ -225,8 +224,7 @@ bool exprNodeArrowResolve(Node *n, Function *f, CompileUnit *u)
|
|||
}
|
||||
tt = n->expression->type->pointer->type;
|
||||
|
||||
if(tt == TYPE_struct ||
|
||||
tt == TYPE_union) {
|
||||
if (tt == TYPE_struct || tt == TYPE_union) {
|
||||
u32 loc = debuggerReadMemory(n->expression->location);
|
||||
Type* t = n->expression->type->pointer;
|
||||
int count = t->structure->memberCount;
|
||||
|
@ -361,8 +359,7 @@ bool exprNodeArrayResolve(Node *n, Function *f, CompileUnit *u)
|
|||
{
|
||||
if (n->expression->resolve(n->expression, f, u)) {
|
||||
TypeEnum tt = n->expression->type->type;
|
||||
if(tt != TYPE_array &&
|
||||
tt != TYPE_pointer) {
|
||||
if (tt != TYPE_array && tt != TYPE_pointer) {
|
||||
printf("Object not of array or pointer type\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -384,8 +381,7 @@ bool exprNodeArrayResolve(Node *n, Function *f, CompileUnit *u)
|
|||
n->type = n->expression->type;
|
||||
n->index = index + 1;
|
||||
n->locType = LOCATION_memory;
|
||||
n->location = n->expression->location +
|
||||
n->value * exprNodeGetSize(a, index);
|
||||
n->location = n->expression->location + n->value * exprNodeGetSize(a, index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,9 +146,12 @@ FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth)
|
|||
case k2xSaI:
|
||||
case kSuper2xSaI:
|
||||
case kSuperEagle:
|
||||
if (colorDepth == 15) Init_2xSaI(555);
|
||||
else if (colorDepth == 16) Init_2xSaI(565);
|
||||
else Init_2xSaI(colorDepth);
|
||||
if (colorDepth == 15)
|
||||
Init_2xSaI(555);
|
||||
else if (colorDepth == 16)
|
||||
Init_2xSaI(565);
|
||||
else
|
||||
Init_2xSaI(colorDepth);
|
||||
break;
|
||||
case khq2x:
|
||||
case klq2x:
|
||||
|
@ -218,10 +221,7 @@ u8 sdlStretcher[16384];
|
|||
#ifdef _MSC_VER
|
||||
#define SDL_CALL_STRETCHER \
|
||||
{ \
|
||||
__asm mov eax, stretcher\
|
||||
__asm mov edi, destPtr\
|
||||
__asm mov esi, srcPtr\
|
||||
__asm call eax\
|
||||
__asm mov eax, stretcher __asm mov edi, destPtr __asm mov esi, srcPtr __asm call eax \
|
||||
}
|
||||
#else
|
||||
#define SDL_CALL_STRETCHER \
|
||||
|
@ -632,7 +632,8 @@ bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth)
|
|||
return true;
|
||||
}
|
||||
|
||||
void sdlStretch1x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
|
||||
void sdlStretch1x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
int i;
|
||||
#ifndef C_CORE
|
||||
u32* stretcher = (u32*)sdlStretcher;
|
||||
|
@ -643,7 +644,8 @@ void sdlStretch1x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32
|
|||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
void sdlStretch2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
|
||||
void sdlStretch2x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
int i;
|
||||
#ifndef C_CORE
|
||||
u32* stretcher = (u32*)sdlStretcher;
|
||||
|
@ -656,7 +658,8 @@ void sdlStretch2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32
|
|||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
void sdlStretch3x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
|
||||
void sdlStretch3x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
int i;
|
||||
#ifndef C_CORE
|
||||
u32* stretcher = (u32*)sdlStretcher;
|
||||
|
@ -671,7 +674,8 @@ void sdlStretch3x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32
|
|||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
void sdlStretch4x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
|
||||
void sdlStretch4x(u8* srcPtr, u32 srcPitch, u8* /* deltaPtr */, u8* dstPtr, u32 dstPitch, int width, int height)
|
||||
{
|
||||
int i;
|
||||
#ifndef C_CORE
|
||||
u32* stretcher = (u32*)sdlStretcher;
|
||||
|
@ -688,5 +692,3 @@ void sdlStretch4x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32
|
|||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,10 @@ char *getFilterName(const int f);
|
|||
//
|
||||
|
||||
// List of available IFB filters
|
||||
enum IFBFilter { kIFBNone, kIBMotionBlur, kIBSmart, kInvalidIFBFilter };
|
||||
enum IFBFilter { kIFBNone,
|
||||
kIBMotionBlur,
|
||||
kIBSmart,
|
||||
kInvalidIFBFilter };
|
||||
|
||||
// Function pointer type for an IFB filter function
|
||||
typedef void (*IFBFilterFunc)(u8*, u32, int, int);
|
||||
|
|
|
@ -187,7 +187,9 @@ int optopt = '?';
|
|||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
||||
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
|
||||
|
||||
static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering;
|
||||
static enum { REQUIRE_ORDER,
|
||||
PERMUTE,
|
||||
RETURN_IN_ORDER } ordering;
|
||||
|
||||
/* Value of POSIXLY_CORRECT environment variable. */
|
||||
static char* posixly_correct;
|
||||
|
@ -509,8 +511,7 @@ int long_only;
|
|||
is only used when the used in the GNU libc. */
|
||||
#ifdef _LIBC
|
||||
#define NONOPTION_P \
|
||||
(argv[optind][0] != '-' || argv[optind][1] == '\0' || \
|
||||
(optind < nonoption_flags_len && __getopt_nonoption_flags[optind] == '1'))
|
||||
(argv[optind][0] != '-' || argv[optind][1] == '\0' || (optind < nonoption_flags_len && __getopt_nonoption_flags[optind] == '1'))
|
||||
#else
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#endif
|
||||
|
@ -601,9 +602,7 @@ int long_only;
|
|||
|
||||
This distinction seems to be the most useful approach. */
|
||||
|
||||
if (longopts != NULL &&
|
||||
(argv[optind][1] == '-' ||
|
||||
(long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1]))))) {
|
||||
if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1]))))) {
|
||||
char* nameend;
|
||||
const struct option* p;
|
||||
const struct option* pfound = NULL;
|
||||
|
@ -619,8 +618,7 @@ int long_only;
|
|||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp(p->name, nextchar, nameend - nextchar)) {
|
||||
if ((unsigned int)(nameend - nextchar) ==
|
||||
(unsigned int)strlen(p->name)) {
|
||||
if ((unsigned int)(nameend - nextchar) == (unsigned int)strlen(p->name)) {
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
|
@ -707,8 +705,7 @@ int long_only;
|
|||
or the option starts with '--' or is not a valid short
|
||||
option, then it's an error.
|
||||
Otherwise interpret it as a short option. */
|
||||
if (!long_only || argv[optind][1] == '-' ||
|
||||
my_index(optstring, *nextchar) == NULL) {
|
||||
if (!long_only || argv[optind][1] == '-' || my_index(optstring, *nextchar) == NULL) {
|
||||
if (opterr) {
|
||||
if (argv[optind][1] == '-')
|
||||
/* --option */
|
||||
|
|
|
@ -29,20 +29,16 @@ static bool sdlCheckJoyKey(int key);
|
|||
static bool sdlButtons[4][SDLBUTTONS_NUM] = {
|
||||
{ false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
false, false
|
||||
},
|
||||
false, false },
|
||||
{ false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
false, false
|
||||
},
|
||||
false, false },
|
||||
{ false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
false, false
|
||||
},
|
||||
false, false },
|
||||
{ false, false, false, false, false, false,
|
||||
false, false, false, false, false, false,
|
||||
false, false
|
||||
}
|
||||
false, false }
|
||||
};
|
||||
|
||||
static bool sdlMotionButtons[4] = { false, false, false, false };
|
||||
|
@ -59,7 +55,8 @@ static uint32_t joypad[5][SDLBUTTONS_NUM] = {
|
|||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ SDLK_LEFT, SDLK_RIGHT,
|
||||
{
|
||||
SDLK_LEFT, SDLK_RIGHT,
|
||||
SDLK_UP, SDLK_DOWN,
|
||||
SDLK_z, SDLK_x,
|
||||
SDLK_RETURN, SDLK_BACKSPACE,
|
||||
|
@ -77,50 +74,33 @@ static uint32_t defaultMotion[4] = {
|
|||
SDLK_KP_4, SDLK_KP_6, SDLK_KP_8, SDLK_KP_2
|
||||
};
|
||||
|
||||
|
||||
static uint32_t sdlGetHatCode(const SDL_Event& event)
|
||||
{
|
||||
if (!event.jhat.value) return 0;
|
||||
if (!event.jhat.value)
|
||||
return 0;
|
||||
|
||||
return (
|
||||
((event.jhat.which + 1) << 16) |
|
||||
32 |
|
||||
(event.jhat.hat << 2) |
|
||||
(
|
||||
event.jhat.value & SDL_HAT_UP ? 0 :
|
||||
event.jhat.value & SDL_HAT_DOWN ? 1 :
|
||||
event.jhat.value & SDL_HAT_RIGHT ? 2 :
|
||||
event.jhat.value & SDL_HAT_LEFT ? 3 : 0
|
||||
)
|
||||
);
|
||||
((event.jhat.which + 1) << 16) | 32 | (event.jhat.hat << 2) | (event.jhat.value & SDL_HAT_UP ? 0 : event.jhat.value & SDL_HAT_DOWN ? 1 : event.jhat.value & SDL_HAT_RIGHT ? 2 : event.jhat.value & SDL_HAT_LEFT ? 3 : 0));
|
||||
}
|
||||
|
||||
static uint32_t sdlGetButtonCode(const SDL_Event& event)
|
||||
{
|
||||
return (
|
||||
((event.jbutton.which + 1) << 16) |
|
||||
(event.jbutton.button + 0x80)
|
||||
);
|
||||
((event.jbutton.which + 1) << 16) | (event.jbutton.button + 0x80));
|
||||
}
|
||||
|
||||
static uint32_t sdlGetAxisCode(const SDL_Event& event)
|
||||
{
|
||||
if (event.jaxis.value >= -16384 && event.jaxis.value <= 16384) return 0;
|
||||
if (event.jaxis.value >= -16384 && event.jaxis.value <= 16384)
|
||||
return 0;
|
||||
|
||||
return (
|
||||
((event.jaxis.which + 1) << 16) |
|
||||
(event.jaxis.axis << 1) |
|
||||
(
|
||||
event.jaxis.value > 16384 ? 1 :
|
||||
event.jaxis.value < -16384 ? 0 : 0
|
||||
)
|
||||
);
|
||||
((event.jaxis.which + 1) << 16) | (event.jaxis.axis << 1) | (event.jaxis.value > 16384 ? 1 : event.jaxis.value < -16384 ? 0 : 0));
|
||||
}
|
||||
|
||||
uint32_t inputGetEventCode(const SDL_Event& event)
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
return event.key.keysym.sym;
|
||||
|
@ -160,8 +140,7 @@ bool inputGetAutoFire(EKey key)
|
|||
{
|
||||
int mask = 0;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
switch (key) {
|
||||
case KEY_BUTTON_A:
|
||||
mask = 1 << 0;
|
||||
break;
|
||||
|
@ -185,8 +164,7 @@ bool inputToggleAutoFire(EKey key)
|
|||
{
|
||||
int mask = 0;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
switch (key) {
|
||||
case KEY_BUTTON_A:
|
||||
mask = 1 << 0;
|
||||
break;
|
||||
|
@ -203,13 +181,10 @@ bool inputToggleAutoFire(EKey key)
|
|||
break;
|
||||
}
|
||||
|
||||
if(autoFire & mask)
|
||||
{
|
||||
if (autoFire & mask) {
|
||||
autoFire &= ~mask;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
autoFire |= mask;
|
||||
return true;
|
||||
}
|
||||
|
@ -398,8 +373,7 @@ void inputInitJoysticks()
|
|||
sdlNumDevices = SDL_NumJoysticks();
|
||||
|
||||
if (sdlNumDevices)
|
||||
sdlDevices = (SDL_Joystick **)calloc(1,sdlNumDevices *
|
||||
sizeof(SDL_Joystick **));
|
||||
sdlDevices = (SDL_Joystick**)calloc(1, sdlNumDevices * sizeof(SDL_Joystick**));
|
||||
bool usesJoy = false;
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
|
@ -460,13 +434,14 @@ void inputProcessSDLEvent(const SDL_Event &event)
|
|||
{
|
||||
// fprintf(stdout, "%x\n", inputGetEventCode(event));
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
if (!event.key.keysym.mod) sdlUpdateKey(event.key.keysym.sym, true);
|
||||
if (!event.key.keysym.mod)
|
||||
sdlUpdateKey(event.key.keysym.sym, true);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
if (!event.key.keysym.mod) sdlUpdateKey(event.key.keysym.sym, false);
|
||||
if (!event.key.keysym.mod)
|
||||
sdlUpdateKey(event.key.keysym.sym, false);
|
||||
break;
|
||||
case SDL_JOYHATMOTION:
|
||||
sdlUpdateJoyHat(event.jhat.which,
|
||||
|
@ -615,4 +590,3 @@ EPad inputGetDefaultJoypad()
|
|||
{
|
||||
return sdlDefaultJoypad;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,12 @@ enum EKey {
|
|||
KEY_BUTTON_AUTO_B
|
||||
};
|
||||
|
||||
enum EPad { PAD_MAIN, PAD_1 = PAD_MAIN, PAD_2, PAD_3, PAD_4, PAD_DEFAULT };
|
||||
enum EPad { PAD_MAIN,
|
||||
PAD_1 = PAD_MAIN,
|
||||
PAD_2,
|
||||
PAD_3,
|
||||
PAD_4,
|
||||
PAD_DEFAULT };
|
||||
|
||||
/**
|
||||
* Init the joysticks needed by the keymap. Verify that the keymap is compatible
|
||||
|
|
|
@ -51,8 +51,7 @@ void drawText(u8 *screen, int pitch, int x, int y,
|
|||
screen += x * inc;
|
||||
|
||||
switch (systemColorDepth) {
|
||||
case 16:
|
||||
{
|
||||
case 16: {
|
||||
while (*string) {
|
||||
char c = *string++;
|
||||
u8* scr = screen;
|
||||
|
@ -66,8 +65,7 @@ void drawText(u8 *screen, int pitch, int x, int y,
|
|||
|
||||
if (trans) {
|
||||
if (on)
|
||||
*s = ((0xf) << systemRedShift) +
|
||||
((*s & mask) >>1);
|
||||
*s = ((0xf) << systemRedShift) + ((*s & mask) >> 1);
|
||||
} else {
|
||||
if (on)
|
||||
*s = (0x1f) << systemRedShift;
|
||||
|
@ -78,10 +76,8 @@ void drawText(u8 *screen, int pitch, int x, int y,
|
|||
}
|
||||
screen += inc * 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
{
|
||||
} break;
|
||||
case 24: {
|
||||
while (*string) {
|
||||
char c = *string++;
|
||||
u8* scr = screen;
|
||||
|
@ -113,10 +109,8 @@ void drawText(u8 *screen, int pitch, int x, int y,
|
|||
}
|
||||
screen += inc * 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
{
|
||||
} break;
|
||||
case 32: {
|
||||
while (*string) {
|
||||
char c = *string++;
|
||||
u8* scr = screen;
|
||||
|
@ -141,8 +135,6 @@ void drawText(u8 *screen, int pitch, int x, int y,
|
|||
}
|
||||
screen += inc * 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "AVIWrite.h"
|
||||
#pragma comment(lib, "Vfw32")
|
||||
|
||||
|
||||
AVIWrite::AVIWrite()
|
||||
{
|
||||
m_failed = false;
|
||||
|
@ -24,7 +23,6 @@ AVIWrite::AVIWrite()
|
|||
AVIFileInit();
|
||||
}
|
||||
|
||||
|
||||
AVIWrite::~AVIWrite()
|
||||
{
|
||||
if (m_audioCompressed) {
|
||||
|
@ -50,10 +48,10 @@ AVIWrite::~AVIWrite()
|
|||
AVIFileExit();
|
||||
}
|
||||
|
||||
|
||||
bool AVIWrite::CreateAVIFile(LPCTSTR filename)
|
||||
{
|
||||
if( m_file || m_failed ) return false;
|
||||
if (m_file || m_failed)
|
||||
return false;
|
||||
|
||||
HRESULT err = 0;
|
||||
|
||||
|
@ -62,8 +60,7 @@ bool AVIWrite::CreateAVIFile( LPCTSTR filename )
|
|||
&m_file,
|
||||
filename,
|
||||
OF_CREATE | OF_WRITE | OF_SHARE_EXCLUSIVE,
|
||||
NULL
|
||||
);
|
||||
NULL);
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
|
@ -73,11 +70,11 @@ bool AVIWrite::CreateAVIFile( LPCTSTR filename )
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// colorBits: 16, 24 or 32
|
||||
bool AVIWrite::CreateVideoStream(LONG imageWidth, LONG imageHeight, WORD colorBits, DWORD framesPerSecond, HWND parentWnd)
|
||||
{
|
||||
if( m_videoStream || m_failed ) return false;
|
||||
if (m_videoStream || m_failed)
|
||||
return false;
|
||||
|
||||
HRESULT err = 0;
|
||||
AVISTREAMINFO videoInfo;
|
||||
|
@ -98,29 +95,25 @@ bool AVIWrite::CreateVideoStream( LONG imageWidth, LONG imageHeight, WORD colorB
|
|||
err = AVIFileCreateStream(
|
||||
m_file,
|
||||
&m_videoStream,
|
||||
&videoInfo
|
||||
);
|
||||
&videoInfo);
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -- ask for compression settings --
|
||||
if (AVISaveOptions(
|
||||
parentWnd,
|
||||
0,
|
||||
1,
|
||||
&m_videoStream,
|
||||
settings ) )
|
||||
{
|
||||
settings)) {
|
||||
err = AVIMakeCompressedStream(
|
||||
&m_videoCompressed,
|
||||
m_videoStream,
|
||||
settings[0],
|
||||
NULL
|
||||
);
|
||||
NULL);
|
||||
|
||||
AVISaveOptionsFree(1, settings);
|
||||
if (FAILED(err)) {
|
||||
|
@ -133,7 +126,6 @@ bool AVIWrite::CreateVideoStream( LONG imageWidth, LONG imageHeight, WORD colorB
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -- initialize the video stream format --
|
||||
bitmapInfo.biSize = sizeof(bitmapInfo);
|
||||
bitmapInfo.biWidth = imageWidth;
|
||||
|
@ -148,28 +140,26 @@ bool AVIWrite::CreateVideoStream( LONG imageWidth, LONG imageHeight, WORD colorB
|
|||
m_videoCompressed,
|
||||
0,
|
||||
&bitmapInfo,
|
||||
bitmapInfo.biSize + ( bitmapInfo.biClrUsed * sizeof( RGBQUAD ) )
|
||||
);
|
||||
bitmapInfo.biSize + (bitmapInfo.biClrUsed * sizeof(RGBQUAD)));
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_frameRate = framesPerSecond;
|
||||
m_videoFrameSize = imageWidth * imageHeight * (colorBits >> 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// call AddVideoStream() first
|
||||
// channelCount: max. 2
|
||||
// sampleBits: max. 16
|
||||
bool AVIWrite::CreateAudioStream(WORD channelCount, DWORD sampleRate, WORD sampleBits, HWND parentWnd)
|
||||
{
|
||||
if( m_audioStream || m_failed ) return false;
|
||||
if (m_audioStream || m_failed)
|
||||
return false;
|
||||
|
||||
HRESULT err = 0;
|
||||
AVISTREAMINFO audioInfo;
|
||||
|
@ -190,15 +180,13 @@ bool AVIWrite::CreateAudioStream( WORD channelCount, DWORD sampleRate, WORD samp
|
|||
err = AVIFileCreateStream(
|
||||
m_file,
|
||||
&m_audioStream,
|
||||
&audioInfo
|
||||
);
|
||||
&audioInfo);
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -- initialize the audio stream format --
|
||||
waveInfo.wFormatTag = WAVE_FORMAT_PCM;
|
||||
waveInfo.nChannels = channelCount;
|
||||
|
@ -213,8 +201,7 @@ bool AVIWrite::CreateAudioStream( WORD channelCount, DWORD sampleRate, WORD samp
|
|||
m_audioStream,
|
||||
0,
|
||||
&waveInfo,
|
||||
sizeof( waveInfo )
|
||||
);
|
||||
sizeof(waveInfo));
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
|
@ -227,10 +214,10 @@ bool AVIWrite::CreateAudioStream( WORD channelCount, DWORD sampleRate, WORD samp
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool AVIWrite::AddVideoFrame(LPVOID imageData)
|
||||
{
|
||||
if( !m_videoStream || m_failed ) return false;
|
||||
if (!m_videoStream || m_failed)
|
||||
return false;
|
||||
|
||||
HRESULT err = 0;
|
||||
|
||||
|
@ -242,8 +229,7 @@ bool AVIWrite::AddVideoFrame( LPVOID imageData )
|
|||
m_videoFrameSize,
|
||||
AVIIF_KEYFRAME,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
NULL);
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
|
@ -255,10 +241,10 @@ bool AVIWrite::AddVideoFrame( LPVOID imageData )
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool AVIWrite::AddAudioFrame(LPVOID soundData)
|
||||
{
|
||||
if( !m_audioStream || m_failed ) return false;
|
||||
if (!m_audioStream || m_failed)
|
||||
return false;
|
||||
|
||||
HRESULT err = 0;
|
||||
|
||||
|
@ -270,8 +256,7 @@ bool AVIWrite::AddAudioFrame( LPVOID soundData )
|
|||
m_audioFrameSize,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
NULL);
|
||||
|
||||
if (FAILED(err)) {
|
||||
m_failed = true;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include <vfw.h>
|
||||
|
||||
// info: recreate the whole AVIWrite object if any method fails
|
||||
class AVIWrite
|
||||
{
|
||||
class AVIWrite {
|
||||
public:
|
||||
AVIWrite();
|
||||
virtual ~AVIWrite();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "AboutDialog.h"
|
||||
#include "../AutoBuild.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -11,7 +11,6 @@ static char THIS_FILE[] = __FILE__;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AboutDialog dialog
|
||||
|
||||
|
||||
AboutDialog::AboutDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(AboutDialog::IDD, pParent)
|
||||
{
|
||||
|
@ -19,7 +18,6 @@ AboutDialog::AboutDialog(CWnd* pParent /*=NULL*/)
|
|||
m_date = _T(__DATE__);
|
||||
}
|
||||
|
||||
|
||||
void AboutDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -30,7 +28,6 @@ void AboutDialog::DoDataExchange(CDataExchange* pDX)
|
|||
DDX_Text(pDX, IDC_DATE, m_date);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(AboutDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(AboutDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#include "resource.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
class AboutDialog : public CDialog
|
||||
{
|
||||
class AboutDialog : public CDialog {
|
||||
public:
|
||||
AboutDialog(CWnd* pParent = NULL);
|
||||
enum { IDD = IDD_ABOUT };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "AccelEditor.h"
|
||||
#include "CmdAccelOb.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -12,7 +12,6 @@ static char THIS_FILE[] = __FILE__;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AccelEditor dialog
|
||||
|
||||
|
||||
AccelEditor::AccelEditor(CWnd* pParent /*=NULL*/)
|
||||
: ResizeDlg(AccelEditor::IDD, pParent)
|
||||
{
|
||||
|
@ -22,7 +21,6 @@ AccelEditor::AccelEditor(CWnd* pParent /*=NULL*/)
|
|||
mgr = theApp.winAccelMgr;
|
||||
}
|
||||
|
||||
|
||||
void AccelEditor::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -34,7 +32,6 @@ void AccelEditor::DoDataExchange(CDataExchange* pDX)
|
|||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(AccelEditor, CDialog)
|
||||
//{{AFX_MSG_MAP(AccelEditor)
|
||||
ON_BN_CLICKED(ID_OK, OnOk)
|
||||
|
@ -140,7 +137,6 @@ void AccelEditor::OnSelchangeCommands()
|
|||
}
|
||||
// Init the key editor
|
||||
// m_pKey->ResetKey();
|
||||
|
||||
}
|
||||
|
||||
void AccelEditor::OnReset()
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AccelEditor dialog
|
||||
|
||||
class AccelEditor : public ResizeDlg
|
||||
{
|
||||
class AccelEditor : public ResizeDlg {
|
||||
// Construction
|
||||
public:
|
||||
CAcceleratorManager mgr;
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "VBA.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "AcceleratorManager.h"
|
||||
#include "Reg.h"
|
||||
|
@ -38,8 +38,6 @@ static char THIS_FILE[]=__FILE__;
|
|||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Constructor/Destructor
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -55,7 +53,6 @@ CAcceleratorManager::CAcceleratorManager()
|
|||
m_bDefaultTable = false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -70,7 +67,6 @@ CAcceleratorManager::~CAcceleratorManager()
|
|||
Reset();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Internal fcts
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -96,7 +92,6 @@ void CAcceleratorManager::Reset()
|
|||
m_mapAccelTableSaved.RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -119,8 +114,7 @@ bool CAcceleratorManager::AddAccel(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTS
|
|||
POSITION pos = pCmdAccel->m_Accels.GetHeadPosition();
|
||||
while (pos != NULL) {
|
||||
pAccel = pCmdAccel->m_Accels.GetNext(pos);
|
||||
if (pAccel->m_cVirt == cVirt &&
|
||||
pAccel->m_wKey == wKey)
|
||||
if (pAccel->m_cVirt == cVirt && pAccel->m_wKey == wKey)
|
||||
return FALSE;
|
||||
}
|
||||
// Adding the accelerator
|
||||
|
@ -136,7 +130,6 @@ bool CAcceleratorManager::AddAccel(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTS
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Debug fcts
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -174,7 +167,6 @@ void CAcceleratorManager::Dump(CDumpContext& dc) const
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -187,7 +179,6 @@ void CAcceleratorManager::Connect(CWnd* pWnd, bool bAutoSave)
|
|||
m_bAutoSave = bAutoSave;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -201,7 +192,6 @@ bool CAcceleratorManager::GetRegKey(HKEY& hRegKey, CString& szRegKey)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -215,7 +205,6 @@ bool CAcceleratorManager::SetRegKey(HKEY hRegKey, LPCTSTR szRegKey)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Update the application's ACCELs table
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -285,7 +274,6 @@ bool CAcceleratorManager::UpdateWndTable()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Create/Destroy accelerators
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -314,7 +302,6 @@ bool CAcceleratorManager::DeleteAccel(BYTE cVirt, WORD wIDCommand, WORD wKey)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -337,7 +324,6 @@ bool CAcceleratorManager::DeleteEntry(WORD wIDCommand)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -352,7 +338,6 @@ bool CAcceleratorManager::DeleteEntry(LPCTSTR szCommand)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -363,7 +348,6 @@ bool CAcceleratorManager::SetAccel(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTS
|
|||
return AddAccel(cVirt, wIDCommand, wKey, szCommand, bLocked);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -389,7 +373,6 @@ bool CAcceleratorManager::AddCommandAccel(WORD wIDCommand, LPCTSTR szCommand, bo
|
|||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -409,7 +392,6 @@ bool CAcceleratorManager::CreateEntry(WORD wIDCommand, LPCTSTR szCommand)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Get a string from the ACCEL definition
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -428,7 +410,6 @@ bool CAcceleratorManager::GetStringFromACCEL(ACCEL* pACCEL, CString& szAccel)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -443,7 +424,6 @@ bool CAcceleratorManager::GetStringFromACCEL(BYTE cVirt, WORD nCode, CString& sz
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Copy function
|
||||
//
|
||||
|
@ -654,7 +634,6 @@ bool CAcceleratorManager::Load(HKEY hRegKey, LPCTSTR szRegKey)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -670,7 +649,6 @@ bool CAcceleratorManager::Load()
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -725,7 +703,6 @@ bool CAcceleratorManager::Write()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Defaults values management.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -773,7 +750,6 @@ bool CAcceleratorManager::CreateDefaultTable()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
|
|
@ -47,8 +47,7 @@ typedef CMap<WORD, WORD &, CCmdAccelOb *, CCmdAccelOb *&> CMapWordToCCmdAccelOb;
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
class CAcceleratorManager : public CObject
|
||||
{
|
||||
class CAcceleratorManager : public CObject {
|
||||
friend class AccelEditor;
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "Associate.h"
|
||||
#include "Reg.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -12,7 +12,6 @@ static char THIS_FILE[] = __FILE__;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Associate dialog
|
||||
|
||||
|
||||
Associate::Associate(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(Associate::IDD, pParent)
|
||||
{
|
||||
|
@ -28,7 +27,6 @@ Associate::Associate(CWnd* pParent /*=NULL*/)
|
|||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void Associate::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -44,7 +42,6 @@ void Associate::DoDataExchange(CDataExchange* pDX)
|
|||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(Associate, CDialog)
|
||||
//{{AFX_MSG_MAP(Associate)
|
||||
ON_BN_CLICKED(ID_CANCEL, OnCancel)
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Associate dialog
|
||||
|
||||
class Associate : public CDialog
|
||||
{
|
||||
class Associate : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
Associate(CWnd* pParent = NULL); // standard constructor
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include "stdafx.h"
|
||||
#include "VBA.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "AudioCoreSettingsDlg.h"
|
||||
|
||||
#define MIN_VOLUME 0.0f
|
||||
#define MAX_VOLUME 4.0f
|
||||
|
||||
|
||||
// AudioCoreSettingsDlg dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(AudioCoreSettingsDlg, CDialog)
|
||||
|
@ -117,13 +116,11 @@ BOOL AudioCoreSettingsDlg::OnTtnNeedText(UINT id, NMHDR *pNMHDR, LRESULT *pResul
|
|||
return i_provided_tooltip_with_text;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(AudioCoreSettingsDlg, CDialog)
|
||||
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, &AudioCoreSettingsDlg::OnTtnNeedText)
|
||||
ON_BN_CLICKED(IDC_DEFAULT_VOLUME, &AudioCoreSettingsDlg::OnBnClickedDefaultVolume)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// AudioCoreSettingsDlg message handlers
|
||||
|
||||
BOOL AudioCoreSettingsDlg::OnInitDialog()
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
// AudioCoreSettingsDlg dialog
|
||||
|
||||
class AudioCoreSettingsDlg : public CDialog
|
||||
{
|
||||
class AudioCoreSettingsDlg : public CDialog {
|
||||
DECLARE_DYNAMIC(AudioCoreSettingsDlg)
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "VBA.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BIOSDialog.h"
|
||||
|
||||
|
||||
// BIOSDialog dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(BIOSDialog, CDialog)
|
||||
|
@ -50,14 +49,12 @@ void BIOSDialog::DoDataExchange(CDataExchange* pDX)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(BIOSDialog, CDialog)
|
||||
ON_BN_CLICKED(IDC_SELECT_GB_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbBiosPath)
|
||||
ON_BN_CLICKED(IDC_SELECT_GBC_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbcBiosPath)
|
||||
ON_BN_CLICKED(IDC_SELECT_GBA_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbaBiosPath)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// BIOSDialog message handlers
|
||||
|
||||
void BIOSDialog::OnBnClickedSelectGbBiosPath()
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
// BIOSDialog dialog
|
||||
|
||||
class BIOSDialog : public CDialog
|
||||
{
|
||||
class BIOSDialog : public CDialog {
|
||||
DECLARE_DYNAMIC(BIOSDialog)
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "BitmapControl.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "BitmapControl.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -32,7 +32,6 @@ BitmapControl::~BitmapControl()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(BitmapControl, CScrollView)
|
||||
//{{AFX_MSG_MAP(BitmapControl)
|
||||
ON_WM_ERASEBKGND()
|
||||
|
@ -110,8 +109,7 @@ void BitmapControl::OnDraw(CDC* dc)
|
|||
dc->BitBlt(0, 0, w1, h1,
|
||||
&memDC, 0, 0, SRCCOPY);
|
||||
|
||||
if (boxreigon.right != 0 && boxreigon.bottom != 0)
|
||||
{
|
||||
if (boxreigon.right != 0 && boxreigon.bottom != 0) {
|
||||
CBrush br = CBrush(RGB(255, 0, 0));
|
||||
dc->FrameRect(&boxreigon, &br);
|
||||
}
|
||||
|
@ -179,9 +177,7 @@ void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt)
|
|||
int yyy = yy / 8;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
memcpy(&colors[i*3*8], &data[xxx * 8 * 3 +
|
||||
w * yyy * 8 * 3 +
|
||||
i * w * 3], 8 * 3);
|
||||
memcpy(&colors[i * 3 * 8], &data[xxx * 8 * 3 + w * yyy * 8 * 3 + i * w * 3], 8 * 3);
|
||||
}
|
||||
} else {
|
||||
POINT p;
|
||||
|
@ -191,8 +187,7 @@ void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt)
|
|||
p.x += x;
|
||||
p.y += y;
|
||||
|
||||
if(p.x >= w ||
|
||||
p.y >= h)
|
||||
if (p.x >= w || p.y >= h)
|
||||
return;
|
||||
|
||||
point = p.x | (p.y << 16);
|
||||
|
@ -201,16 +196,13 @@ void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt)
|
|||
int yyy = p.y / 8;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
memcpy(&colors[i*3*8], &data[xxx * 8 * 3 +
|
||||
w * yyy * 8 * 3 +
|
||||
i * w * 3], 8 * 3);
|
||||
memcpy(&colors[i * 3 * 8], &data[xxx * 8 * 3 + w * yyy * 8 * 3 + i * w * 3], 8 * 3);
|
||||
}
|
||||
}
|
||||
|
||||
GetParent()->SendMessage(WM_MAPINFO,
|
||||
point,
|
||||
(LPARAM)colors);
|
||||
|
||||
}
|
||||
|
||||
void BitmapControl::setBmpInfo(BITMAPINFO* info)
|
||||
|
@ -246,7 +238,6 @@ void BitmapControl::refresh()
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
void BitmapControl::registerClass()
|
||||
{
|
||||
if (!isRegistered) {
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BitmapControl view
|
||||
|
||||
class BitmapControl : public CScrollView
|
||||
{
|
||||
class BitmapControl : public CScrollView {
|
||||
public:
|
||||
BitmapControl(); // protected constructor used by dynamic creation
|
||||
protected:
|
||||
|
|
|
@ -19,17 +19,17 @@
|
|||
// BugReport.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "BugReport.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "BugReport.h"
|
||||
|
||||
#include "../agb/agbprint.h"
|
||||
#include "../AutoBuild.h"
|
||||
#include "../agb/GBA.h"
|
||||
#include "../Globals.h"
|
||||
#include "../Port.h"
|
||||
#include "../RTC.h"
|
||||
#include "../Sound.h"
|
||||
#include "../agb/GBA.h"
|
||||
#include "../agb/agbprint.h"
|
||||
#include "../dmg/gbCheats.h"
|
||||
#include "../dmg/gbGlobals.h"
|
||||
|
||||
|
@ -42,7 +42,6 @@ static char THIS_FILE[] = __FILE__;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BugReport dialog
|
||||
|
||||
|
||||
BugReport::BugReport(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(BugReport::IDD, pParent)
|
||||
{
|
||||
|
@ -51,7 +50,6 @@ BugReport::BugReport(CWnd* pParent /*=NULL*/)
|
|||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void BugReport::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -60,7 +58,6 @@ void BugReport::DoDataExchange(CDataExchange* pDX)
|
|||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(BugReport, CDialog)
|
||||
//{{AFX_MSG_MAP(BugReport)
|
||||
ON_BN_CLICKED(IDC_COPY, OnCopy)
|
||||
|
@ -123,7 +120,6 @@ BOOL BugReport::OnInitDialog()
|
|||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
static void AppendFormat(CString& report, const char* format, ...)
|
||||
{
|
||||
CString buffer;
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BugReport dialog
|
||||
|
||||
class BugReport : public CDialog
|
||||
{
|
||||
class BugReport : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
BugReport(CWnd* pParent = NULL); // standard constructor
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CmdAccelOb.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -155,7 +155,6 @@ MAPVIRTKEYS mapVirtKeys[] = {
|
|||
{ VK_OEM_CLEAR, "VK_OEM_CLEAR" },
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -165,7 +164,6 @@ MAPVIRTKEYS mapVirtSysKeys[] = {
|
|||
{ FSHIFT, "Shift" },
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// helper fct for external access
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -180,14 +178,11 @@ TCHAR* mapVirtKeysStringFromWORD(WORD wKey)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#define DEFAULT_ACCEL 0x01
|
||||
#define USER_ACCEL 0x02
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -200,7 +195,6 @@ CAccelsOb::CAccelsOb()
|
|||
m_bLocked = false;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -213,7 +207,6 @@ CAccelsOb::CAccelsOb(CAccelsOb* pFrom)
|
|||
m_bLocked = pFrom->m_bLocked;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -224,7 +217,6 @@ CAccelsOb::CAccelsOb(BYTE cVirt, WORD wKey, bool bLocked)
|
|||
m_bLocked = bLocked;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -237,7 +229,6 @@ CAccelsOb::CAccelsOb(LPACCEL pACCEL)
|
|||
m_bLocked = false;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -250,7 +241,6 @@ CAccelsOb& CAccelsOb::operator=(const CAccelsOb& from)
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -281,7 +271,6 @@ void CAccelsOb::GetString(CString& szBuffer)
|
|||
AfxMessageBox("Internal error : (CAccelsOb::GetString) m_wKey invalid");
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -290,7 +279,6 @@ bool CAccelsOb::IsEqual(WORD wKey, bool bCtrl, bool bAlt, bool bShift)
|
|||
// CString szTemp;
|
||||
// GetString(szTemp);
|
||||
|
||||
|
||||
bool m_bCtrl = (m_cVirt & FCONTROL) ? true : false;
|
||||
bool bRet = (bCtrl == m_bCtrl);
|
||||
|
||||
|
@ -305,7 +293,6 @@ bool CAccelsOb::IsEqual(WORD wKey, bool bCtrl, bool bAlt, bool bShift)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -321,7 +308,6 @@ DWORD CAccelsOb::GetData()
|
|||
return MAKELONG(m_wKey, bCodes);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -356,7 +342,6 @@ void CAccelsOb::Dump(CDumpContext& dc) const
|
|||
dc << "\t\t";
|
||||
CObject::Dump(dc);
|
||||
dc << "\t\tlocked=" << m_bLocked << ", cVirt=" << m_cVirt << ", wKey=" << m_wKey << "\n\n";
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -369,7 +354,6 @@ CCmdAccelOb::CCmdAccelOb()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -381,7 +365,6 @@ CCmdAccelOb::CCmdAccelOb(WORD wIDCommand, LPCTSTR szCommand)
|
|||
m_szCommand = szCommand;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -397,7 +380,6 @@ CCmdAccelOb::CCmdAccelOb(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTSTR szComma
|
|||
m_Accels.AddTail(pAccel);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -409,7 +391,6 @@ CCmdAccelOb::~CCmdAccelOb()
|
|||
m_Accels.RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -422,7 +403,6 @@ void CCmdAccelOb::Add(BYTE cVirt, WORD wKey, bool bLocked)
|
|||
m_Accels.AddTail(pAccel);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -432,7 +412,6 @@ void CCmdAccelOb::Add(CAccelsOb* pAccel)
|
|||
m_Accels.AddTail(pAccel);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -453,7 +432,6 @@ CCmdAccelOb& CCmdAccelOb::operator=(const CCmdAccelOb& from)
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -472,7 +450,6 @@ void CCmdAccelOb::DeleteUserAccels()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
@ -501,7 +478,6 @@ void CCmdAccelOb::AssertValid() const
|
|||
CObject::AssertValid();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
|
|
@ -46,8 +46,7 @@ typedef struct tagMAPVIRTKEYS {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
class CAccelsOb : public CObject
|
||||
{
|
||||
class CAccelsOb : public CObject {
|
||||
public:
|
||||
CAccelsOb();
|
||||
CAccelsOb(CAccelsOb* pFrom);
|
||||
|
@ -77,8 +76,7 @@ class CAccelsOb : public CObject
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
class CCmdAccelOb : public CObject
|
||||
{
|
||||
class CCmdAccelOb : public CObject {
|
||||
public:
|
||||
CCmdAccelOb();
|
||||
CCmdAccelOb(WORD wIDCommand, LPCTSTR szCommand);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "ColorButton.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "ColorButton.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -23,7 +23,6 @@ ColorButton::~ColorButton()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(ColorButton, CButton)
|
||||
//{{AFX_MSG_MAP(ColorButton)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
|
@ -62,8 +61,7 @@ void ColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
|||
|
||||
InflateRect(&rect, -margins.cx, -margins.cy);
|
||||
|
||||
HBRUSH br = CreateSolidBrush((state & ODS_DISABLED) ?
|
||||
::GetSysColor(COLOR_3DFACE) : RGB(r,g,b));
|
||||
HBRUSH br = CreateSolidBrush((state & ODS_DISABLED) ? ::GetSysColor(COLOR_3DFACE) : RGB(r, g, b));
|
||||
|
||||
FillRect(dc, &rect, br);
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ColorButton window
|
||||
|
||||
class ColorButton : public CButton
|
||||
{
|
||||
class ColorButton : public CButton {
|
||||
// Construction
|
||||
public:
|
||||
ColorButton();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "ColorControl.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "ColorControl.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -23,7 +23,6 @@ ColorControl::~ColorControl()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(ColorControl, CWnd)
|
||||
//{{AFX_MSG_MAP(ColorControl)
|
||||
ON_WM_PAINT()
|
||||
|
@ -31,7 +30,6 @@ BEGIN_MESSAGE_MAP(ColorControl, CWnd)
|
|||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ColorControl message handlers
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ColorControl window
|
||||
|
||||
class ColorControl : public CWnd
|
||||
{
|
||||
class ColorControl : public CWnd {
|
||||
// Construction
|
||||
public:
|
||||
ColorControl();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "AcceleratorManager.h"
|
||||
#include "resource.h"
|
||||
#include "stdafx.h"
|
||||
#include <afxres.h>
|
||||
|
||||
#include <afxtempl.h> // MFC Templates extension
|
||||
|
@ -228,5 +228,4 @@ void winAccelAddCommands(CAcceleratorManager& mgr)
|
|||
if (!mgr.AddCommandAccel(winAccelCommands[i].id, winAccelCommands[i].command, false))
|
||||
mgr.CreateEntry(winAccelCommands[i].id, winAccelCommands[i].command);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,26 +8,26 @@
|
|||
|
||||
#include "Display.h"
|
||||
|
||||
#include "MainWnd.h"
|
||||
#include "FullscreenSettings.h"
|
||||
#include "MainWnd.h"
|
||||
|
||||
#include "../System.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Globals.h"
|
||||
#include "../Util.h"
|
||||
#include "../gb/gbGlobals.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Globals.h"
|
||||
|
||||
#include <memory.h>
|
||||
#include <cassert>
|
||||
#include <memory.h>
|
||||
|
||||
// Direct3D
|
||||
#ifdef _DEBUG
|
||||
#define D3D_DEBUG_INFO
|
||||
#endif
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#include <d3d9.h> // main include file
|
||||
#include <D3dx9core.h> // required for font rendering
|
||||
#include <Dxerr.h> // contains debug functions
|
||||
#include <d3d9.h> // main include file
|
||||
|
||||
extern int Init_2xSaI(u32); // initializes all pixel filters
|
||||
extern int systemSpeed;
|
||||
|
@ -132,7 +132,6 @@ public:
|
|||
virtual bool selectFullScreenMode(VIDEO_MODE& mode);
|
||||
};
|
||||
|
||||
|
||||
Direct3DDisplay::Direct3DDisplay()
|
||||
{
|
||||
initialized = false;
|
||||
|
@ -153,10 +152,10 @@ Direct3DDisplay::Direct3DDisplay()
|
|||
pfthread_data = NULL;
|
||||
hThreads = NULL;
|
||||
nThreads = theApp.maxCpuCores;
|
||||
if( nThreads > 8 ) nThreads = 8;
|
||||
if (nThreads > 8)
|
||||
nThreads = 8;
|
||||
}
|
||||
|
||||
|
||||
Direct3DDisplay::~Direct3DDisplay()
|
||||
{
|
||||
cleanup();
|
||||
|
@ -183,7 +182,6 @@ void Direct3DDisplay::prepareDisplayMode()
|
|||
dpp.PresentationInterval = (vsync && !gba_joybus_active) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
// D3DPRESENT_INTERVAL_ONE means VSync ON
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
// make debugging full screen easier
|
||||
if (dpp.Windowed == FALSE) {
|
||||
|
@ -202,7 +200,6 @@ void Direct3DDisplay::prepareDisplayMode()
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::cleanup()
|
||||
{
|
||||
if (hThreads) {
|
||||
|
@ -229,7 +226,6 @@ void Direct3DDisplay::cleanup()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Direct3DDisplay::initialize()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -276,7 +272,6 @@ bool Direct3DDisplay::initialize()
|
|||
fsColorDepth = systemColorDepth;
|
||||
utilUpdateSystemColorMaps(theApp.cartridgeType == IMAGE_GBA && gbColorOption == 1);
|
||||
|
||||
|
||||
#ifdef MMX
|
||||
if (!disableMMX) {
|
||||
cpu_mmx = theApp.detectMMX();
|
||||
|
@ -285,11 +280,9 @@ bool Direct3DDisplay::initialize()
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
theApp.updateFilter();
|
||||
theApp.updateIFB();
|
||||
|
||||
|
||||
// create device
|
||||
// Direct3D will use the selected full screen adapter for windowed mode as well
|
||||
prepareDisplayMode();
|
||||
|
@ -298,8 +291,7 @@ bool Direct3DDisplay::initialize()
|
|||
fsAdapter,
|
||||
D3DDEVTYPE_HAL,
|
||||
theApp.m_pMainWnd->GetSafeHwnd(),
|
||||
D3DCREATE_FPU_PRESERVE |
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
|
||||
D3DCREATE_FPU_PRESERVE | D3DCREATE_SOFTWARE_VERTEXPROCESSING,
|
||||
&dpp,
|
||||
&pDevice);
|
||||
if (FAILED(hret)) {
|
||||
|
@ -326,7 +318,8 @@ bool Direct3DDisplay::initialize()
|
|||
failed = true;
|
||||
}
|
||||
|
||||
if(failed) return false;
|
||||
if (failed)
|
||||
return false;
|
||||
|
||||
initialized = true;
|
||||
|
||||
|
@ -337,7 +330,6 @@ bool Direct3DDisplay::initialize()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::clear()
|
||||
{
|
||||
if (pDevice) {
|
||||
|
@ -349,11 +341,12 @@ void Direct3DDisplay::clear()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::render()
|
||||
{
|
||||
if( failed ) return;
|
||||
if(!pDevice) return;
|
||||
if (failed)
|
||||
return;
|
||||
if (!pDevice)
|
||||
return;
|
||||
|
||||
// Multi-Tasking fix
|
||||
HRESULT hr = pDevice->TestCooperativeLevel();
|
||||
|
@ -455,13 +448,11 @@ void Direct3DDisplay::render()
|
|||
(u8*)lr.pBits,
|
||||
lr.Pitch,
|
||||
sizeX,
|
||||
sizeY
|
||||
);
|
||||
sizeY);
|
||||
}
|
||||
} else {
|
||||
// pixel filter disabled
|
||||
switch( systemColorDepth )
|
||||
{
|
||||
switch (systemColorDepth) {
|
||||
case 32:
|
||||
cpyImg32(
|
||||
(unsigned char*)lr.pBits,
|
||||
|
@ -469,8 +460,7 @@ void Direct3DDisplay::render()
|
|||
pix + pitch,
|
||||
pitch,
|
||||
sizeX,
|
||||
sizeY
|
||||
);
|
||||
sizeY);
|
||||
break;
|
||||
case 16:
|
||||
cpyImg16(
|
||||
|
@ -479,8 +469,7 @@ void Direct3DDisplay::render()
|
|||
pix + pitch,
|
||||
pitch,
|
||||
sizeX,
|
||||
sizeY
|
||||
);
|
||||
sizeY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +477,6 @@ void Direct3DDisplay::render()
|
|||
pDevice->UpdateTexture(tempImage, emulatedImage[mbCurrentTexture]);
|
||||
}
|
||||
|
||||
|
||||
if (!theApp.d3dMotionBlur) {
|
||||
// draw the current frame to the screen
|
||||
pDevice->SetTexture(0, emulatedImage[mbCurrentTexture]);
|
||||
|
@ -515,7 +503,6 @@ void Direct3DDisplay::render()
|
|||
mbCurrentTexture ^= 1; // switch current texture
|
||||
}
|
||||
|
||||
|
||||
// render speed and status messages
|
||||
D3DCOLOR color;
|
||||
RECT r;
|
||||
|
@ -552,7 +539,6 @@ void Direct3DDisplay::render()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
bool Direct3DDisplay::changeRenderSize(int w, int h)
|
||||
{
|
||||
if ((w != width) || (h != height)) {
|
||||
|
@ -567,22 +553,18 @@ bool Direct3DDisplay::changeRenderSize( int w, int h )
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::resize(int w, int h)
|
||||
{
|
||||
if (!initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( (w != dpp.BackBufferWidth) ||
|
||||
(h != dpp.BackBufferHeight) ||
|
||||
(videoOption > VIDEO_6X) ) {
|
||||
if ((w != dpp.BackBufferWidth) || (h != dpp.BackBufferHeight) || (videoOption > VIDEO_6X)) {
|
||||
resetDevice();
|
||||
calculateDestRect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Direct3DDisplay::selectFullScreenMode(VIDEO_MODE& mode)
|
||||
{
|
||||
FullscreenSettings dlg;
|
||||
|
@ -590,8 +572,7 @@ bool Direct3DDisplay::selectFullScreenMode( VIDEO_MODE &mode )
|
|||
INT_PTR ret = dlg.DoModal();
|
||||
if (ret == IDOK) {
|
||||
mode.adapter = dlg.m_device;
|
||||
switch( dlg.m_colorDepth )
|
||||
{
|
||||
switch (dlg.m_colorDepth) {
|
||||
case 30:
|
||||
// TODO: support
|
||||
return false;
|
||||
|
@ -613,7 +594,6 @@ bool Direct3DDisplay::selectFullScreenMode( VIDEO_MODE &mode )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::createFont()
|
||||
{
|
||||
if (!pFont) {
|
||||
|
@ -636,7 +616,6 @@ void Direct3DDisplay::createFont()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::destroyFont()
|
||||
{
|
||||
if (pFont) {
|
||||
|
@ -645,7 +624,6 @@ void Direct3DDisplay::destroyFont()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// fill texture completely with black
|
||||
bool Direct3DDisplay::clearTexture(LPDIRECT3DTEXTURE9 texture, size_t textureHeight)
|
||||
{
|
||||
|
@ -662,7 +640,6 @@ bool Direct3DDisplay::clearTexture( LPDIRECT3DTEXTURE9 texture, size_t textureHe
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// when either textureWidth or textureHeight is 0, last texture size will be used
|
||||
void Direct3DDisplay::createTexture(unsigned int textureWidth, unsigned int textureHeight)
|
||||
{
|
||||
|
@ -682,7 +659,6 @@ void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int tex
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (!tempImage) {
|
||||
HRESULT hr = pDevice->CreateTexture(
|
||||
textureSize, textureSize,
|
||||
|
@ -703,7 +679,6 @@ void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int tex
|
|||
clearTexture(tempImage, textureSize);
|
||||
}
|
||||
|
||||
|
||||
if (!emulatedImage[0]) {
|
||||
HRESULT hr = pDevice->CreateTexture(
|
||||
textureSize, textureSize,
|
||||
|
@ -739,7 +714,6 @@ void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int tex
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::destroyTexture()
|
||||
{
|
||||
if (tempImage) {
|
||||
|
@ -758,7 +732,6 @@ void Direct3DDisplay::destroyTexture()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::calculateDestRect()
|
||||
{
|
||||
if (fullScreenStretch) {
|
||||
|
@ -790,10 +763,7 @@ void Direct3DDisplay::calculateDestRect()
|
|||
destRect.bottom += diff;
|
||||
}
|
||||
|
||||
if( ( destRect.left == 0 ) &&
|
||||
( destRect.top == 0 ) &&
|
||||
( destRect.right == dpp.BackBufferWidth ) &&
|
||||
( destRect.bottom == dpp.BackBufferHeight ) ) {
|
||||
if ((destRect.left == 0) && (destRect.top == 0) && (destRect.right == dpp.BackBufferWidth) && (destRect.bottom == dpp.BackBufferHeight)) {
|
||||
rectangleFillsScreen = true;
|
||||
} else {
|
||||
rectangleFillsScreen = false;
|
||||
|
@ -864,7 +834,6 @@ void Direct3DDisplay::calculateDestRect()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Direct3DDisplay::setOption(const char* option, int value)
|
||||
{
|
||||
if (!_tcscmp(option, _T("vsync"))) {
|
||||
|
@ -880,8 +849,7 @@ void Direct3DDisplay::setOption( const char *option, int value )
|
|||
}
|
||||
|
||||
if (!_tcscmp(option, _T("d3dFilter"))) {
|
||||
switch( value )
|
||||
{
|
||||
switch (value) {
|
||||
case 0: //point
|
||||
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
|
||||
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
|
||||
|
@ -902,8 +870,7 @@ void Direct3DDisplay::setOption( const char *option, int value )
|
|||
}
|
||||
|
||||
if (!_tcscmp(option, _T("motionBlur"))) {
|
||||
switch( value )
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
mbCurrentTexture = 0;
|
||||
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
|
@ -923,10 +890,10 @@ void Direct3DDisplay::setOption( const char *option, int value )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Direct3DDisplay::resetDevice()
|
||||
{
|
||||
if( !pDevice ) return false;
|
||||
if (!pDevice)
|
||||
return false;
|
||||
|
||||
HRESULT hr;
|
||||
if (pFont) {
|
||||
|
@ -953,7 +920,6 @@ bool Direct3DDisplay::resetDevice()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
IDisplay* newDirect3DDisplay()
|
||||
{
|
||||
return new Direct3DDisplay();
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
#include "stdafx.h"
|
||||
#include "VBA.h"
|
||||
#include "Input.h"
|
||||
#include "Reg.h"
|
||||
#include "VBA.h"
|
||||
#include "WinResUtil.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#pragma comment(lib, "dinput8")
|
||||
#pragma comment(lib, "dxguid")
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
|
@ -67,11 +66,7 @@ static deviceInfo *pDevices = NULL;
|
|||
static LPDIRECTINPUT8 pDirectInput = NULL;
|
||||
static int axisNumber = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
LONG_PTR defvalues[JOYPADS * KEYS_PER_PAD + MOTION_KEYS] =
|
||||
{
|
||||
LONG_PTR defvalues[JOYPADS * KEYS_PER_PAD + MOTION_KEYS] = {
|
||||
DIK_LEFT, DIK_RIGHT,
|
||||
DIK_UP, DIK_DOWN,
|
||||
DIK_X, DIK_Z,
|
||||
|
@ -85,15 +80,13 @@ LONG_PTR defvalues[JOYPADS * KEYS_PER_PAD + MOTION_KEYS] =
|
|||
DIK_NUMPAD4, DIK_NUMPAD6, DIK_NUMPAD8, DIK_NUMPAD2
|
||||
};
|
||||
|
||||
|
||||
void winReadKey(const char* name, KeyList& Keys)
|
||||
{
|
||||
CString TxtKeyList = regQueryStringValue(name, "");
|
||||
int curPos = 0;
|
||||
|
||||
CString resToken = TxtKeyList.Tokenize(",", curPos);
|
||||
while (resToken != "")
|
||||
{
|
||||
while (resToken != "") {
|
||||
Keys.AddTail(atoi(resToken));
|
||||
resToken = TxtKeyList.Tokenize(",", curPos);
|
||||
};
|
||||
|
@ -107,7 +100,6 @@ void winReadKey(const char *name, int num, KeyList& Keys)
|
|||
winReadKey(buffer, Keys);
|
||||
}
|
||||
|
||||
|
||||
void winReadKeys()
|
||||
{
|
||||
|
||||
|
@ -137,8 +129,7 @@ void winSaveKey(char *name, KeyList& value)
|
|||
CString txtKeys;
|
||||
|
||||
POSITION p = value.GetHeadPosition();
|
||||
while(p!=NULL)
|
||||
{
|
||||
while (p != NULL) {
|
||||
CString tmp;
|
||||
tmp.Format("%d", value.GetNext(p));
|
||||
txtKeys += tmp;
|
||||
|
@ -209,8 +200,7 @@ static BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE pInst,
|
|||
hRet = pDevices[numDevices].device->GetCapabilities(&caps);
|
||||
|
||||
if (hRet == DI_OK) {
|
||||
if (caps.dwFlags & DIDC_POLLEDDATAFORMAT ||
|
||||
caps.dwFlags & DIDC_POLLEDDEVICE)
|
||||
if (caps.dwFlags & DIDC_POLLEDDATAFORMAT || caps.dwFlags & DIDC_POLLEDDEVICE)
|
||||
pDevices[numDevices].isPolled = TRUE;
|
||||
|
||||
pDevices[numDevices].nButtons = caps.dwButtons;
|
||||
|
@ -224,10 +214,8 @@ static BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE pInst,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
numDevices++;
|
||||
|
||||
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -260,13 +248,11 @@ static void checkKeys()
|
|||
LONG_PTR dev = 0;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < (sizeof(theApp.input->joypaddata) / sizeof(theApp.input->joypaddata[0])); i++)
|
||||
{
|
||||
for (i = 0; i < (sizeof(theApp.input->joypaddata) / sizeof(theApp.input->joypaddata[0])); i++) {
|
||||
if (theApp.input->joypaddata[i].IsEmpty() && defvalues[i])
|
||||
theApp.input->joypaddata[i].AddTail(defvalues[i]);
|
||||
POSITION p = theApp.input->joypaddata[i].GetHeadPosition();
|
||||
while(p!=NULL)
|
||||
{
|
||||
while (p != NULL) {
|
||||
LONG_PTR k = theApp.input->joypaddata[i].GetNext(p);
|
||||
if (k > 0 && DEVICEOF(k) < numDevices)
|
||||
pDevices[DEVICEOF(k)].needed = true;
|
||||
|
@ -279,8 +265,7 @@ static void checkKeys()
|
|||
static bool readKeyboard()
|
||||
{
|
||||
if (pDevices[0].needed) {
|
||||
HRESULT hret = pDevices[0].device->
|
||||
GetDeviceState(256,
|
||||
HRESULT hret = pDevices[0].device->GetDeviceState(256,
|
||||
(LPVOID)pDevices[0].data);
|
||||
|
||||
if (hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) {
|
||||
|
@ -301,8 +286,7 @@ static bool readJoystick(int joy)
|
|||
if (pDevices[joy].isPolled)
|
||||
((LPDIRECTINPUTDEVICE2)pDevices[joy].device)->Poll();
|
||||
|
||||
HRESULT hret = pDevices[joy].device->
|
||||
GetDeviceState(sizeof(DIJOYSTATE),
|
||||
HRESULT hret = pDevices[joy].device->GetDeviceState(sizeof(DIJOYSTATE),
|
||||
(LPVOID)&pDevices[joy].state);
|
||||
|
||||
if (hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) {
|
||||
|
@ -313,8 +297,7 @@ static bool readJoystick(int joy)
|
|||
if (pDevices[joy].isPolled)
|
||||
((LPDIRECTINPUTDEVICE2)pDevices[joy].device)->Poll();
|
||||
|
||||
hret = pDevices[joy].device->
|
||||
GetDeviceState(sizeof(DIJOYSTATE),
|
||||
hret = pDevices[joy].device->GetDeviceState(sizeof(DIJOYSTATE),
|
||||
(LPVOID)&pDevices[joy].state);
|
||||
}
|
||||
}
|
||||
|
@ -337,8 +320,7 @@ static void checkKeyboard()
|
|||
return;
|
||||
}
|
||||
|
||||
hret = pDevices[0].device->
|
||||
GetDeviceState(256, (LPVOID)keystate);
|
||||
hret = pDevices[0].device->GetDeviceState(256, (LPVOID)keystate);
|
||||
|
||||
if (hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) {
|
||||
return;
|
||||
|
@ -346,7 +328,8 @@ static void checkKeyboard()
|
|||
|
||||
if (hret == DI_OK) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (keystate[i] == pDevices[0].data[i]) continue;
|
||||
if (keystate[i] == pDevices[0].data[i])
|
||||
continue;
|
||||
if (KEYDOWN(keystate, i)) {
|
||||
SendMessage(GetFocus(), JOYCONFIG_MESSAGE, 0, i);
|
||||
break;
|
||||
|
@ -371,7 +354,6 @@ static void checkJoypads()
|
|||
for (i = 1; i < numDevices; i++) {
|
||||
HRESULT hret = pDevices[i].device->Acquire();
|
||||
|
||||
|
||||
if (pDevices[i].isPolled)
|
||||
((LPDIRECTINPUTDEVICE2)pDevices[i].device)->Poll();
|
||||
|
||||
|
@ -387,7 +369,8 @@ static void checkJoypads()
|
|||
|
||||
for (j = 0; j < pDevices[i].nButtons; j++) {
|
||||
if (((pDevices[i].state.rgbButtons[j] ^ joystick.rgbButtons[j])
|
||||
& joystick.rgbButtons[j]) & 0x80) {
|
||||
& joystick.rgbButtons[j])
|
||||
& 0x80) {
|
||||
HWND focus = GetFocus();
|
||||
|
||||
SendMessage(focus, JOYCONFIG_MESSAGE, i, j + 128);
|
||||
|
@ -468,8 +451,7 @@ BOOL checkKey(LONG_PTR key)
|
|||
BOOL checkKey(KeyList& k)
|
||||
{
|
||||
POSITION p = k.GetHeadPosition();
|
||||
while(p!=NULL)
|
||||
{
|
||||
while (p != NULL) {
|
||||
if (checkKey(k.GetNext(p)))
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -512,16 +494,14 @@ bool DirectInput::initialize()
|
|||
(LPVOID*)&pDirectInput,
|
||||
NULL);
|
||||
ASSERT(hr == DI_OK);
|
||||
if( hr != DI_OK ) return false;
|
||||
|
||||
if (hr != DI_OK)
|
||||
return false;
|
||||
|
||||
hr = pDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL,
|
||||
DIEnumDevicesCallback2,
|
||||
NULL,
|
||||
DIEDFL_ATTACHEDONLY);
|
||||
|
||||
|
||||
|
||||
pDevices = (deviceInfo*)calloc(numDevices, sizeof(deviceInfo));
|
||||
|
||||
hr = pDirectInput->CreateDevice(GUID_SysKeyboard, &pDevices[0].device, NULL);
|
||||
|
@ -533,7 +513,6 @@ bool DirectInput::initialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
numDevices = 1;
|
||||
|
||||
hr = pDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL,
|
||||
|
@ -541,7 +520,6 @@ bool DirectInput::initialize()
|
|||
NULL,
|
||||
DIEDFL_ATTACHEDONLY);
|
||||
|
||||
|
||||
if (hr != DI_OK) {
|
||||
return false;
|
||||
}
|
||||
|
@ -567,8 +545,7 @@ bool DirectInput::initialize()
|
|||
range.diph.dwHow = DIPH_BYOFFSET;
|
||||
// screw EnumObjects, just go through all the axis offsets and try to GetProperty
|
||||
// this should be more foolproof, less code, and probably faster
|
||||
for (unsigned int offset = 0; offset < DIJOFS_BUTTON(0); offset += sizeof(LONG))
|
||||
{
|
||||
for (unsigned int offset = 0; offset < DIJOFS_BUTTON(0); offset += sizeof(LONG)) {
|
||||
range.diph.dwObj = offset;
|
||||
// try to set some nice power of 2 values (8192)
|
||||
range.lMin = -(1 << 13);
|
||||
|
@ -577,8 +554,7 @@ bool DirectInput::initialize()
|
|||
// but i guess not all devices support setting range
|
||||
// so i getproperty right afterward incase it didn't set :P
|
||||
// this also checks that the axis is present
|
||||
if (SUCCEEDED(pDevices[i].device->GetProperty(DIPROP_RANGE, &range.diph)))
|
||||
{
|
||||
if (SUCCEEDED(pDevices[i].device->GetProperty(DIPROP_RANGE, &range.diph))) {
|
||||
const LONG center = (range.lMin + range.lMax) / 2;
|
||||
const LONG threshold = (range.lMax - center) / 2;
|
||||
|
||||
|
@ -589,12 +565,10 @@ bool DirectInput::initialize()
|
|||
|
||||
++axisNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
currentDevice->device->EnumObjects(EnumPovsCallback, NULL, DIDFT_POV);
|
||||
|
||||
|
||||
currentDevice = NULL;
|
||||
}
|
||||
|
||||
|
@ -704,8 +678,7 @@ CString DirectInput::getKeyName(LONG_PTR key)
|
|||
pDevices[0].device->GetObjectInfo(&di, (DWORD)key, DIPH_BYOFFSET);
|
||||
winBuffer = di.tszName;
|
||||
} else if (d < numDevices) {
|
||||
if (k < 16)
|
||||
{
|
||||
if (k < 16) {
|
||||
pDevices[d].device->GetObjectInfo(&di,
|
||||
pDevices[d].axis[k >> 1].offset,
|
||||
DIPH_BYOFFSET);
|
||||
|
@ -733,9 +706,7 @@ CString DirectInput::getKeyName(LONG_PTR key)
|
|||
DIPH_BYOFFSET);
|
||||
winBuffer.Format(winResLoadString(IDS_JOY_BUTTON), d, di.tszName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Joystick isn't plugged in. We can't decipher k, so just show its value.
|
||||
winBuffer.Format("Joy %d (%d)", d, k);
|
||||
}
|
||||
|
@ -808,7 +779,6 @@ Input *newDirectInput()
|
|||
return new DirectInput;
|
||||
}
|
||||
|
||||
|
||||
void DirectInput::checkDevices()
|
||||
{
|
||||
checkJoypads();
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
// Internals
|
||||
#include "../System.h"
|
||||
#include "../common/SoundDriver.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Globals.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../common/SoundDriver.h"
|
||||
|
||||
// DirectSound8
|
||||
#define DIRECTSOUND_VERSION 0x0800
|
||||
|
@ -21,8 +21,7 @@
|
|||
|
||||
extern bool soundBufferLow;
|
||||
|
||||
class DirectSound : public SoundDriver
|
||||
{
|
||||
class DirectSound : public SoundDriver {
|
||||
private:
|
||||
LPDIRECTSOUND8 pDirectSound; // DirectSound interface
|
||||
LPDIRECTSOUNDBUFFER dsbPrimary; // Primary DirectSound buffer
|
||||
|
@ -45,7 +44,6 @@ public:
|
|||
void write(u16* finalWave, int length); // write the emulated sound to the secondary sound buffer
|
||||
};
|
||||
|
||||
|
||||
DirectSound::DirectSound()
|
||||
{
|
||||
pDirectSound = NULL;
|
||||
|
@ -58,7 +56,6 @@ DirectSound::DirectSound()
|
|||
soundNextPosition = 0;
|
||||
}
|
||||
|
||||
|
||||
DirectSound::~DirectSound()
|
||||
{
|
||||
if (dsbNotify) {
|
||||
|
@ -87,7 +84,6 @@ DirectSound::~DirectSound()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool DirectSound::init(long sampleRate)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -112,7 +108,6 @@ bool DirectSound::init(long sampleRate)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Create primary sound buffer
|
||||
ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC));
|
||||
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
|
@ -146,7 +141,6 @@ bool DirectSound::init(long sampleRate)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Create secondary sound buffer
|
||||
ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC));
|
||||
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
|
@ -167,7 +161,6 @@ bool DirectSound::init(long sampleRate)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (SUCCEEDED(hr = dsbSecondary->QueryInterface(IID_IDirectSoundNotify8, (LPVOID*)&dsbNotify))) {
|
||||
dsbEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
DSBPOSITIONNOTIFY notify[10];
|
||||
|
@ -184,7 +177,6 @@ bool DirectSound::init(long sampleRate)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Play primary buffer
|
||||
if (FAILED(hr = dsbPrimary->Play(0, 0, DSBPLAY_LOOPING))) {
|
||||
systemMessage(IDS_CANNOT_PLAY_PRIMARY, _T("Cannot Play primary %08x"), hr);
|
||||
|
@ -194,22 +186,23 @@ bool DirectSound::init(long sampleRate)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DirectSound::pause()
|
||||
{
|
||||
if( dsbSecondary == NULL ) return;
|
||||
if (dsbSecondary == NULL)
|
||||
return;
|
||||
|
||||
DWORD status;
|
||||
|
||||
dsbSecondary->GetStatus(&status);
|
||||
|
||||
if( status & DSBSTATUS_PLAYING ) dsbSecondary->Stop();
|
||||
if (status & DSBSTATUS_PLAYING)
|
||||
dsbSecondary->Stop();
|
||||
}
|
||||
|
||||
|
||||
void DirectSound::reset()
|
||||
{
|
||||
if( dsbSecondary == NULL ) return;
|
||||
if (dsbSecondary == NULL)
|
||||
return;
|
||||
|
||||
dsbSecondary->Stop();
|
||||
|
||||
|
@ -218,19 +211,18 @@ void DirectSound::reset()
|
|||
soundNextPosition = 0;
|
||||
}
|
||||
|
||||
|
||||
void DirectSound::resume()
|
||||
{
|
||||
if( dsbSecondary == NULL ) return;
|
||||
if (dsbSecondary == NULL)
|
||||
return;
|
||||
|
||||
dsbSecondary->Play(0, 0, DSBPLAY_LOOPING);
|
||||
}
|
||||
|
||||
|
||||
void DirectSound::write(u16* finalWave, int length)
|
||||
{
|
||||
if(!pDirectSound) return;
|
||||
|
||||
if (!pDirectSound)
|
||||
return;
|
||||
|
||||
HRESULT hr;
|
||||
DWORD status = 0;
|
||||
|
@ -246,12 +238,9 @@ void DirectSound::write(u16 * finalWave, int length)
|
|||
if (!soundPaused) {
|
||||
while (true) {
|
||||
dsbSecondary->GetCurrentPosition(&play, NULL);
|
||||
int BufferLeft = ((soundNextPosition <= play) ?
|
||||
play - soundNextPosition :
|
||||
soundBufferTotalLen - soundNextPosition + play);
|
||||
int BufferLeft = ((soundNextPosition <= play) ? play - soundNextPosition : soundBufferTotalLen - soundNextPosition + play);
|
||||
|
||||
if(BufferLeft > soundBufferLen)
|
||||
{
|
||||
if (BufferLeft > soundBufferLen) {
|
||||
if (BufferLeft > soundBufferTotalLen - (soundBufferLen * 3))
|
||||
soundBufferLow = true;
|
||||
break;
|
||||
|
@ -269,7 +258,6 @@ void DirectSound::write(u16 * finalWave, int length)
|
|||
}*/
|
||||
}
|
||||
|
||||
|
||||
// Obtain memory address of write block.
|
||||
// This will be in two parts if the block wraps around.
|
||||
if (DSERR_BUFFERLOST == (hr = dsbSecondary->Lock(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "Directories.h"
|
||||
#include "Reg.h"
|
||||
#include "WinResUtil.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
@ -35,7 +35,6 @@ Directories::Directories(CWnd* pParent /*=NULL*/)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
void Directories::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -47,7 +46,6 @@ void Directories::DoDataExchange(CDataExchange* pDX)
|
|||
DDX_Control(pDX, IDC_BATTERY_PATH, m_batteryPath);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(Directories, CDialog)
|
||||
ON_BN_CLICKED(IDC_BATTERY_DIR, OnBatteryDir)
|
||||
ON_BN_CLICKED(IDC_CAPTURE_DIR, OnCaptureDir)
|
||||
|
@ -157,7 +155,6 @@ void Directories::OnOK()
|
|||
baseDir[MAX_PATH] = '\0'; // for security reasons
|
||||
PathRemoveFileSpec(baseDir); // removes the trailing file name and backslash
|
||||
|
||||
|
||||
CString buffer;
|
||||
|
||||
m_romPath.GetWindowText(buffer);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
class Directories : public CDialog
|
||||
{
|
||||
class Directories : public CDialog {
|
||||
public:
|
||||
Directories(CWnd* pParent = NULL);
|
||||
enum { IDD = IDD_DIRECTORIES };
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "Disassemble.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "Disassemble.h"
|
||||
|
||||
#include "../System.h"
|
||||
#include "../gba/armdis.h"
|
||||
#include "../gba/GBA.h"
|
||||
#include "../gba/Globals.h"
|
||||
#include "../gba/armdis.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -17,11 +17,9 @@ extern int emulating;
|
|||
|
||||
extern void CPUUpdateCPSR();
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Disassemble dialog
|
||||
|
||||
|
||||
Disassemble::Disassemble(CWnd* pParent /*=NULL*/)
|
||||
: ResizeDlg(Disassemble::IDD, pParent)
|
||||
{
|
||||
|
@ -41,7 +39,6 @@ Disassemble::Disassemble(CWnd* pParent /*=NULL*/)
|
|||
count = 1;
|
||||
}
|
||||
|
||||
|
||||
void Disassemble::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -59,7 +56,6 @@ void Disassemble::DoDataExchange(CDataExchange* pDX)
|
|||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(Disassemble, CDialog)
|
||||
//{{AFX_MSG_MAP(Disassemble)
|
||||
ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate)
|
||||
|
@ -122,8 +118,7 @@ void Disassemble::OnGo()
|
|||
|
||||
void Disassemble::OnGopc()
|
||||
{
|
||||
if(rom != NULL)
|
||||
{
|
||||
if (rom != NULL) {
|
||||
if (armState)
|
||||
address = armNextPC - 16;
|
||||
else
|
||||
|
@ -135,8 +130,7 @@ void Disassemble::OnGopc()
|
|||
|
||||
void Disassemble::OnNext()
|
||||
{
|
||||
if(rom != NULL)
|
||||
{
|
||||
if (rom != NULL) {
|
||||
CPULoop(1);
|
||||
if (armState) {
|
||||
u32 total = address + count * 4;
|
||||
|
@ -204,7 +198,6 @@ BOOL Disassemble::OnInitDialog()
|
|||
|
||||
GetDlgItem(IDC_MODE)->SetFont(font, FALSE);
|
||||
|
||||
|
||||
m_address.LimitText(8);
|
||||
refresh();
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Disassemble dialog
|
||||
|
||||
class Disassemble : public ResizeDlg, IUpdateListener
|
||||
{
|
||||
class Disassemble : public ResizeDlg, IUpdateListener {
|
||||
// Construction
|
||||
public:
|
||||
virtual void update();
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
#include <memory.h>
|
||||
|
||||
enum DISPLAY_TYPE { DIRECT_3D = 0, OPENGL = 1 };
|
||||
enum DISPLAY_TYPE { DIRECT_3D = 0,
|
||||
OPENGL = 1 };
|
||||
|
||||
class IDisplay
|
||||
{
|
||||
class IDisplay {
|
||||
public:
|
||||
IDisplay(){};
|
||||
virtual ~IDisplay(){};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "ExportGSASnapshot.h"
|
||||
#include "stdafx.h"
|
||||
#include "vba.h"
|
||||
#include "ExportGSASnapshot.h"
|
||||
|
||||
#include "../gba/GBA.h"
|
||||
#include "../NLS.h"
|
||||
#include "../gba/GBA.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -14,7 +14,6 @@ static char THIS_FILE[] = __FILE__;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ExportGSASnapshot dialog
|
||||
|
||||
|
||||
ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(ExportGSASnapshot::IDD, pParent)
|
||||
{
|
||||
|
@ -43,7 +42,6 @@ ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd* pPar
|
|||
m_desc.Format("%s %s", date, time);
|
||||
}
|
||||
|
||||
|
||||
void ExportGSASnapshot::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
|
@ -57,7 +55,6 @@ void ExportGSASnapshot::DoDataExchange(CDataExchange* pDX)
|
|||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(ExportGSASnapshot, CDialog)
|
||||
//{{AFX_MSG_MAP(ExportGSASnapshot)
|
||||
ON_BN_CLICKED(ID_CANCEL, OnCancel)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue