mirror of
https://github.com/libretro/mgba.git
synced 2024-11-22 23:49:51 +00:00
All: Add clang-format options and run them
This commit is contained in:
parent
3ba13e9286
commit
908e61f415
34
.clang-format
Normal file
34
.clang-format
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: WebKit
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: true
|
||||||
|
AlignEscapedNewlinesLeft: true
|
||||||
|
AlignOperands: false
|
||||||
|
AlignTrailingComments: false
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeTernaryOperators: false
|
||||||
|
BreakConstructorInitializersBeforeComma: true
|
||||||
|
ColumnLimit: 120
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentWidth: 4
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
PointerAlignment: Left
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: ForIndentation
|
@ -42,30 +42,29 @@ void ARMSetPrivilegeMode(struct ARMCore* cpu, enum PrivilegeMode mode) {
|
|||||||
|
|
||||||
cpu->bankedSPSRs[oldBank] = cpu->spsr.packed;
|
cpu->bankedSPSRs[oldBank] = cpu->spsr.packed;
|
||||||
cpu->spsr.packed = cpu->bankedSPSRs[newBank];
|
cpu->spsr.packed = cpu->bankedSPSRs[newBank];
|
||||||
|
|
||||||
}
|
}
|
||||||
cpu->privilegeMode = mode;
|
cpu->privilegeMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline enum RegisterBank _ARMSelectBank(enum PrivilegeMode mode) {
|
static inline enum RegisterBank _ARMSelectBank(enum PrivilegeMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_USER:
|
case MODE_USER:
|
||||||
case MODE_SYSTEM:
|
case MODE_SYSTEM:
|
||||||
// No banked registers
|
// No banked registers
|
||||||
return BANK_NONE;
|
return BANK_NONE;
|
||||||
case MODE_FIQ:
|
case MODE_FIQ:
|
||||||
return BANK_FIQ;
|
return BANK_FIQ;
|
||||||
case MODE_IRQ:
|
case MODE_IRQ:
|
||||||
return BANK_IRQ;
|
return BANK_IRQ;
|
||||||
case MODE_SUPERVISOR:
|
case MODE_SUPERVISOR:
|
||||||
return BANK_SUPERVISOR;
|
return BANK_SUPERVISOR;
|
||||||
case MODE_ABORT:
|
case MODE_ABORT:
|
||||||
return BANK_ABORT;
|
return BANK_ABORT;
|
||||||
case MODE_UNDEFINED:
|
case MODE_UNDEFINED:
|
||||||
return BANK_UNDEFINED;
|
return BANK_UNDEFINED;
|
||||||
default:
|
default:
|
||||||
// This should be unreached
|
// This should be unreached
|
||||||
return BANK_NONE;
|
return BANK_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +307,7 @@ void ARMRunLoop(struct ARMCore* cpu) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ARMRunFake(struct ARMCore* cpu, uint32_t opcode) {
|
void ARMRunFake(struct ARMCore* cpu, uint32_t opcode) {
|
||||||
if (cpu->executionMode== MODE_ARM) {
|
if (cpu->executionMode == MODE_ARM) {
|
||||||
cpu->gprs[ARM_PC] -= WORD_SIZE_ARM;
|
cpu->gprs[ARM_PC] -= WORD_SIZE_ARM;
|
||||||
} else {
|
} else {
|
||||||
cpu->gprs[ARM_PC] -= WORD_SIZE_THUMB;
|
cpu->gprs[ARM_PC] -= WORD_SIZE_THUMB;
|
||||||
|
@ -101,8 +101,10 @@ struct ARMMemory {
|
|||||||
void (*store16)(struct ARMCore*, uint32_t address, int16_t value, int* cycleCounter);
|
void (*store16)(struct ARMCore*, uint32_t address, int16_t value, int* cycleCounter);
|
||||||
void (*store8)(struct ARMCore*, uint32_t address, int8_t value, int* cycleCounter);
|
void (*store8)(struct ARMCore*, uint32_t address, int8_t value, int* cycleCounter);
|
||||||
|
|
||||||
uint32_t (*loadMultiple)(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction, int* cycleCounter);
|
uint32_t (*loadMultiple)(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction,
|
||||||
uint32_t (*storeMultiple)(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction, int* cycleCounter);
|
int* cycleCounter);
|
||||||
|
uint32_t (*storeMultiple)(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction,
|
||||||
|
int* cycleCounter);
|
||||||
|
|
||||||
uint32_t* activeRegion;
|
uint32_t* activeRegion;
|
||||||
uint32_t activeMask;
|
uint32_t activeMask;
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define LOAD_CYCLES \
|
#define LOAD_CYCLES \
|
||||||
info->iCycles = 1; \
|
info->iCycles = 1; \
|
||||||
info->nDataCycles = 1;
|
info->nDataCycles = 1;
|
||||||
|
|
||||||
#define STORE_CYCLES \
|
#define STORE_CYCLES \
|
||||||
info->sInstructionCycles = 0; \
|
info->sInstructionCycles = 0; \
|
||||||
info->nInstructionCycles = 1; \
|
info->nInstructionCycles = 1; \
|
||||||
info->nDataCycles = 1;
|
info->nDataCycles = 1;
|
||||||
|
@ -209,7 +209,8 @@ struct ARMInstructionInfo {
|
|||||||
|
|
||||||
void ARMDecodeARM(uint32_t opcode, struct ARMInstructionInfo* info);
|
void ARMDecodeARM(uint32_t opcode, struct ARMInstructionInfo* info);
|
||||||
void ARMDecodeThumb(uint16_t opcode, struct ARMInstructionInfo* info);
|
void ARMDecodeThumb(uint16_t opcode, struct ARMInstructionInfo* info);
|
||||||
bool ARMDecodeThumbCombine(struct ARMInstructionInfo* info1, struct ARMInstructionInfo* info2, struct ARMInstructionInfo* out);
|
bool ARMDecodeThumbCombine(struct ARMInstructionInfo* info1, struct ARMInstructionInfo* info2,
|
||||||
|
struct ARMInstructionInfo* out);
|
||||||
int ARMDisassemble(struct ARMInstructionInfo* info, uint32_t pc, char* buffer, int blen);
|
int ARMDisassemble(struct ARMInstructionInfo* info, uint32_t pc, char* buffer, int blen);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,5 +15,4 @@ struct ARMCore;
|
|||||||
typedef void (*ARMInstruction)(struct ARMCore*, uint32_t opcode);
|
typedef void (*ARMInstruction)(struct ARMCore*, uint32_t opcode);
|
||||||
const ARMInstruction _armTable[0x1000];
|
const ARMInstruction _armTable[0x1000];
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,37 +35,37 @@
|
|||||||
#define ARM_V_ADDITION(M, N, D) (!(ARM_SIGN((M) ^ (N))) && (ARM_SIGN((M) ^ (D))) && (ARM_SIGN((N) ^ (D))))
|
#define ARM_V_ADDITION(M, N, D) (!(ARM_SIGN((M) ^ (N))) && (ARM_SIGN((M) ^ (D))) && (ARM_SIGN((N) ^ (D))))
|
||||||
#define ARM_V_SUBTRACTION(M, N, D) ((ARM_SIGN((M) ^ (N))) && (ARM_SIGN((M) ^ (D))))
|
#define ARM_V_SUBTRACTION(M, N, D) ((ARM_SIGN((M) ^ (N))) && (ARM_SIGN((M) ^ (D))))
|
||||||
|
|
||||||
#define ARM_WAIT_MUL(R) \
|
#define ARM_WAIT_MUL(R) \
|
||||||
{ \
|
{ \
|
||||||
int32_t wait; \
|
int32_t wait; \
|
||||||
if ((R & 0xFFFFFF00) == 0xFFFFFF00 || !(R & 0xFFFFFF00)) { \
|
if ((R & 0xFFFFFF00) == 0xFFFFFF00 || !(R & 0xFFFFFF00)) { \
|
||||||
wait = 1; \
|
wait = 1; \
|
||||||
} else if ((R & 0xFFFF0000) == 0xFFFF0000 || !(R & 0xFFFF0000)) { \
|
} else if ((R & 0xFFFF0000) == 0xFFFF0000 || !(R & 0xFFFF0000)) { \
|
||||||
wait = 2; \
|
wait = 2; \
|
||||||
} else if ((R & 0xFF000000) == 0xFF000000 || !(R & 0xFF000000)) { \
|
} else if ((R & 0xFF000000) == 0xFF000000 || !(R & 0xFF000000)) { \
|
||||||
wait = 3; \
|
wait = 3; \
|
||||||
} else { \
|
} else { \
|
||||||
wait = 4; \
|
wait = 4; \
|
||||||
} \
|
} \
|
||||||
currentCycles += cpu->memory.stall(cpu, wait); \
|
currentCycles += cpu->memory.stall(cpu, wait); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ARM_STUB cpu->irqh.hitStub(cpu, opcode)
|
#define ARM_STUB cpu->irqh.hitStub(cpu, opcode)
|
||||||
#define ARM_ILL cpu->irqh.hitIllegal(cpu, opcode)
|
#define ARM_ILL cpu->irqh.hitIllegal(cpu, opcode)
|
||||||
|
|
||||||
#define ARM_WRITE_PC \
|
#define ARM_WRITE_PC \
|
||||||
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_ARM); \
|
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_ARM); \
|
||||||
cpu->memory.setActiveRegion(cpu, cpu->gprs[ARM_PC]); \
|
cpu->memory.setActiveRegion(cpu, cpu->gprs[ARM_PC]); \
|
||||||
LOAD_32(cpu->prefetch[0], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
LOAD_32(cpu->prefetch[0], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
||||||
cpu->gprs[ARM_PC] += WORD_SIZE_ARM; \
|
cpu->gprs[ARM_PC] += WORD_SIZE_ARM; \
|
||||||
LOAD_32(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
LOAD_32(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
||||||
currentCycles += 2 + cpu->memory.activeNonseqCycles32 + cpu->memory.activeSeqCycles32;
|
currentCycles += 2 + cpu->memory.activeNonseqCycles32 + cpu->memory.activeSeqCycles32;
|
||||||
|
|
||||||
#define THUMB_WRITE_PC \
|
#define THUMB_WRITE_PC \
|
||||||
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_THUMB); \
|
cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_THUMB); \
|
||||||
cpu->memory.setActiveRegion(cpu, cpu->gprs[ARM_PC]); \
|
cpu->memory.setActiveRegion(cpu, cpu->gprs[ARM_PC]); \
|
||||||
LOAD_16(cpu->prefetch[0], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
LOAD_16(cpu->prefetch[0], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
||||||
cpu->gprs[ARM_PC] += WORD_SIZE_THUMB; \
|
cpu->gprs[ARM_PC] += WORD_SIZE_THUMB; \
|
||||||
LOAD_16(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
LOAD_16(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); \
|
||||||
currentCycles += 2 + cpu->memory.activeNonseqCycles16 + cpu->memory.activeSeqCycles16;
|
currentCycles += 2 + cpu->memory.activeNonseqCycles16 + cpu->memory.activeSeqCycles16;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ static struct CLIDebuggerCommandSummary _debuggerCommands[] = {
|
|||||||
{ "print/t", _printBin, CLIDVParse, "Print a value as binary" },
|
{ "print/t", _printBin, CLIDVParse, "Print a value as binary" },
|
||||||
{ "print/x", _printHex, CLIDVParse, "Print a value as hexadecimal" },
|
{ "print/x", _printHex, CLIDVParse, "Print a value as hexadecimal" },
|
||||||
{ "q", _quit, 0, "Quit the emulator" },
|
{ "q", _quit, 0, "Quit the emulator" },
|
||||||
{ "quit", _quit, 0, "Quit the emulator" },
|
{ "quit", _quit, 0, "Quit the emulator" },
|
||||||
{ "reset", _reset, 0, "Reset the emulation" },
|
{ "reset", _reset, 0, "Reset the emulation" },
|
||||||
{ "r/1", _readByte, CLIDVParse, "Read a byte from a specified offset" },
|
{ "r/1", _readByte, CLIDVParse, "Read a byte from a specified offset" },
|
||||||
{ "r/2", _readHalfword, CLIDVParse, "Read a halfword from a specified offset" },
|
{ "r/2", _readHalfword, CLIDVParse, "Read a halfword from a specified offset" },
|
||||||
@ -103,13 +103,13 @@ static struct CLIDebuggerCommandSummary _debuggerCommands[] = {
|
|||||||
|
|
||||||
static inline void _printPSR(union PSR psr) {
|
static inline void _printPSR(union PSR psr) {
|
||||||
printf("%08X [%c%c%c%c%c%c%c]\n", psr.packed,
|
printf("%08X [%c%c%c%c%c%c%c]\n", psr.packed,
|
||||||
psr.n ? 'N' : '-',
|
psr.n ? 'N' : '-',
|
||||||
psr.z ? 'Z' : '-',
|
psr.z ? 'Z' : '-',
|
||||||
psr.c ? 'C' : '-',
|
psr.c ? 'C' : '-',
|
||||||
psr.v ? 'V' : '-',
|
psr.v ? 'V' : '-',
|
||||||
psr.i ? 'I' : '-',
|
psr.i ? 'I' : '-',
|
||||||
psr.f ? 'F' : '-',
|
psr.f ? 'F' : '-',
|
||||||
psr.t ? 'T' : '-');
|
psr.t ? 'T' : '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _handleDeath(int sig) {
|
static void _handleDeath(int sig) {
|
||||||
@ -196,7 +196,7 @@ static void _disassembleMode(struct CLIDebugger* debugger, struct CLIDebugVector
|
|||||||
|
|
||||||
static void _print(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
static void _print(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
UNUSED(debugger);
|
UNUSED(debugger);
|
||||||
for ( ; dv; dv = dv->next) {
|
for (; dv; dv = dv->next) {
|
||||||
printf(" %u", dv->intValue);
|
printf(" %u", dv->intValue);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -204,7 +204,7 @@ static void _print(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
|||||||
|
|
||||||
static void _printBin(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
static void _printBin(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
UNUSED(debugger);
|
UNUSED(debugger);
|
||||||
for ( ; dv; dv = dv->next) {
|
for (; dv; dv = dv->next) {
|
||||||
printf(" 0b");
|
printf(" 0b");
|
||||||
int i = 32;
|
int i = 32;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
@ -216,7 +216,7 @@ static void _printBin(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
|||||||
|
|
||||||
static void _printHex(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
static void _printHex(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
UNUSED(debugger);
|
UNUSED(debugger);
|
||||||
for ( ; dv; dv = dv->next) {
|
for (; dv; dv = dv->next) {
|
||||||
printf(" 0x%08X", dv->intValue);
|
printf(" 0x%08X", dv->intValue);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -289,10 +289,10 @@ static void _printStatus(struct CLIDebugger* debugger, struct CLIDebugVector* dv
|
|||||||
int r;
|
int r;
|
||||||
for (r = 0; r < 4; ++r) {
|
for (r = 0; r < 4; ++r) {
|
||||||
printf("%08X %08X %08X %08X\n",
|
printf("%08X %08X %08X %08X\n",
|
||||||
debugger->d.cpu->gprs[r << 2],
|
debugger->d.cpu->gprs[r << 2],
|
||||||
debugger->d.cpu->gprs[(r << 2) + 1],
|
debugger->d.cpu->gprs[(r << 2) + 1],
|
||||||
debugger->d.cpu->gprs[(r << 2) + 2],
|
debugger->d.cpu->gprs[(r << 2) + 2],
|
||||||
debugger->d.cpu->gprs[(r << 2) + 3]);
|
debugger->d.cpu->gprs[(r << 2) + 3]);
|
||||||
}
|
}
|
||||||
_printPSR(debugger->d.cpu->cpsr);
|
_printPSR(debugger->d.cpu->cpsr);
|
||||||
int instructionLength;
|
int instructionLength;
|
||||||
|
@ -108,7 +108,7 @@ static uint32_t _hex2int(const char* hex, int maxDigits) {
|
|||||||
letter = *hex - '0';
|
letter = *hex - '0';
|
||||||
if (letter > 9) {
|
if (letter > 9) {
|
||||||
letter = *hex - 'a';
|
letter = *hex - 'a';
|
||||||
if (letter > 5) {
|
if (letter > 5) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
value *= 0x10;
|
value *= 0x10;
|
||||||
|
@ -118,8 +118,8 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
|
|||||||
break;
|
break;
|
||||||
case LEX_EXPECT_BINARY:
|
case LEX_EXPECT_BINARY:
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case '0':
|
case '0':
|
||||||
case '1':
|
case '1':
|
||||||
// TODO: handle overflow
|
// TODO: handle overflow
|
||||||
next <<= 1;
|
next <<= 1;
|
||||||
next += token - '0';
|
next += token - '0';
|
||||||
|
@ -41,7 +41,7 @@ void GBAAudioInit(struct GBAAudio* audio, size_t samples) {
|
|||||||
audio->left = blip_new(BLIP_BUFFER_SIZE);
|
audio->left = blip_new(BLIP_BUFFER_SIZE);
|
||||||
audio->right = blip_new(BLIP_BUFFER_SIZE);
|
audio->right = blip_new(BLIP_BUFFER_SIZE);
|
||||||
// Guess too large; we hang producing extra samples if we guess too low
|
// Guess too large; we hang producing extra samples if we guess too low
|
||||||
blip_set_rates(audio->left, GBA_ARM7TDMI_FREQUENCY, 96000);
|
blip_set_rates(audio->left, GBA_ARM7TDMI_FREQUENCY, 96000);
|
||||||
blip_set_rates(audio->right, GBA_ARM7TDMI_FREQUENCY, 96000);
|
blip_set_rates(audio->right, GBA_ARM7TDMI_FREQUENCY, 96000);
|
||||||
#endif
|
#endif
|
||||||
CircleBufferInit(&audio->chA.fifo, GBA_AUDIO_FIFO_SIZE);
|
CircleBufferInit(&audio->chA.fifo, GBA_AUDIO_FIFO_SIZE);
|
||||||
|
@ -279,7 +279,8 @@ void GBAAudioSampleFIFO(struct GBAAudio* audio, int fifoId, int32_t cycles);
|
|||||||
|
|
||||||
#if RESAMPLE_LIBRARY != RESAMPLE_BLIP_BUF
|
#if RESAMPLE_LIBRARY != RESAMPLE_BLIP_BUF
|
||||||
unsigned GBAAudioCopy(struct GBAAudio* audio, void* left, void* right, unsigned nSamples);
|
unsigned GBAAudioCopy(struct GBAAudio* audio, void* left, void* right, unsigned nSamples);
|
||||||
unsigned GBAAudioResampleNN(struct GBAAudio*, float ratio, float* drift, struct GBAStereoSample* output, unsigned nSamples);
|
unsigned GBAAudioResampleNN(struct GBAAudio*, float ratio, float* drift, struct GBAStereoSample* output,
|
||||||
|
unsigned nSamples);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct GBASerializedState;
|
struct GBASerializedState;
|
||||||
|
@ -175,7 +175,7 @@ static void _Div(struct GBA* gba, int32_t num, int32_t denom) {
|
|||||||
void GBASwi16(struct ARMCore* cpu, int immediate) {
|
void GBASwi16(struct ARMCore* cpu, int immediate) {
|
||||||
struct GBA* gba = (struct GBA*) cpu->master;
|
struct GBA* gba = (struct GBA*) cpu->master;
|
||||||
GBALog(gba, GBA_LOG_SWI, "SWI: %02X r0: %08X r1: %08X r2: %08X r3: %08X",
|
GBALog(gba, GBA_LOG_SWI, "SWI: %02X r0: %08X r1: %08X r2: %08X r3: %08X",
|
||||||
immediate, cpu->gprs[0], cpu->gprs[1], cpu->gprs[2], cpu->gprs[3]);
|
immediate, cpu->gprs[0], cpu->gprs[1], cpu->gprs[2], cpu->gprs[3]);
|
||||||
|
|
||||||
if (gba->memory.fullBios) {
|
if (gba->memory.fullBios) {
|
||||||
ARMRaiseSWI(cpu);
|
ARMRaiseSWI(cpu);
|
||||||
@ -192,8 +192,8 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||||||
GBAHalt(gba);
|
GBAHalt(gba);
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
// VBlankIntrWait
|
// VBlankIntrWait
|
||||||
// Fall through:
|
// Fall through:
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// IntrWait
|
// IntrWait
|
||||||
ARMRaiseSWI(cpu);
|
ARMRaiseSWI(cpu);
|
||||||
@ -236,14 +236,14 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
||||||
default:
|
default:
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad LZ77 destination");
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad LZ77 destination");
|
||||||
// Fall through
|
// Fall through
|
||||||
case REGION_WORKING_RAM:
|
case REGION_WORKING_RAM:
|
||||||
case REGION_WORKING_IRAM:
|
case REGION_WORKING_IRAM:
|
||||||
case REGION_VRAM:
|
case REGION_VRAM:
|
||||||
_unLz77(gba, immediate == 0x11 ? 1 : 2);
|
_unLz77(gba, immediate == 0x11 ? 1 : 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x13:
|
case 0x13:
|
||||||
@ -252,14 +252,14 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
||||||
default:
|
default:
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad Huffman destination");
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad Huffman destination");
|
||||||
// Fall through
|
// Fall through
|
||||||
case REGION_WORKING_RAM:
|
case REGION_WORKING_RAM:
|
||||||
case REGION_WORKING_IRAM:
|
case REGION_WORKING_IRAM:
|
||||||
case REGION_VRAM:
|
case REGION_VRAM:
|
||||||
_unHuffman(gba);
|
_unHuffman(gba);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x14:
|
case 0x14:
|
||||||
@ -269,14 +269,14 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
||||||
default:
|
default:
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad RL destination");
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad RL destination");
|
||||||
// Fall through
|
// Fall through
|
||||||
case REGION_WORKING_RAM:
|
case REGION_WORKING_RAM:
|
||||||
case REGION_WORKING_IRAM:
|
case REGION_WORKING_IRAM:
|
||||||
case REGION_VRAM:
|
case REGION_VRAM:
|
||||||
_unRl(gba, immediate == 0x14 ? 1 : 2);
|
_unRl(gba, immediate == 0x14 ? 1 : 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
@ -287,14 +287,14 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
switch (cpu->gprs[1] >> BASE_OFFSET) {
|
||||||
default:
|
default:
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad UnFilter destination");
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad UnFilter destination");
|
||||||
// Fall through
|
// Fall through
|
||||||
case REGION_WORKING_RAM:
|
case REGION_WORKING_RAM:
|
||||||
case REGION_WORKING_IRAM:
|
case REGION_WORKING_IRAM:
|
||||||
case REGION_VRAM:
|
case REGION_VRAM:
|
||||||
_unFilter(gba, immediate == 0x18 ? 2 : 1, immediate == 0x16 ? 1 : 2);
|
_unFilter(gba, immediate == 0x18 ? 2 : 1, immediate == 0x16 ? 1 : 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x1F:
|
case 0x1F:
|
||||||
@ -457,7 +457,6 @@ static void _unHuffman(struct GBA* gba) {
|
|||||||
block = 0;
|
block = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
cpu->gprs[0] = source;
|
cpu->gprs[0] = source;
|
||||||
cpu->gprs[1] = dest;
|
cpu->gprs[1] = dest;
|
||||||
|
@ -198,7 +198,7 @@ bool GBACheatAddGameShark(struct GBACheatSet* set, uint32_t op1, uint32_t op2) {
|
|||||||
switch (set->gsaVersion) {
|
switch (set->gsaVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
GBACheatSetGameSharkVersion(set, 1);
|
GBACheatSetGameSharkVersion(set, 1);
|
||||||
// Fall through
|
// Fall through
|
||||||
case 1:
|
case 1:
|
||||||
GBACheatDecryptGameShark(&o1, &o2, set->gsaSeeds);
|
GBACheatDecryptGameShark(&o1, &o2, set->gsaSeeds);
|
||||||
return GBACheatAddGameSharkRaw(set, o1, o2);
|
return GBACheatAddGameSharkRaw(set, o1, o2);
|
||||||
|
@ -298,7 +298,7 @@ bool GBACheatAddProActionReplay(struct GBACheatSet* set, uint32_t op1, uint32_t
|
|||||||
switch (set->gsaVersion) {
|
switch (set->gsaVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
GBACheatSetGameSharkVersion(set, 3);
|
GBACheatSetGameSharkVersion(set, 3);
|
||||||
// Fall through
|
// Fall through
|
||||||
case 1:
|
case 1:
|
||||||
GBACheatDecryptGameShark(&o1, &o2, set->gsaSeeds);
|
GBACheatDecryptGameShark(&o1, &o2, set->gsaSeeds);
|
||||||
return GBACheatAddProActionReplayRaw(set, o1, o2);
|
return GBACheatAddProActionReplayRaw(set, o1, o2);
|
||||||
|
@ -203,7 +203,8 @@ void GBAHalt(struct GBA* gba);
|
|||||||
void GBAAttachDebugger(struct GBA* gba, struct ARMDebugger* debugger);
|
void GBAAttachDebugger(struct GBA* gba, struct ARMDebugger* debugger);
|
||||||
void GBADetachDebugger(struct GBA* gba);
|
void GBADetachDebugger(struct GBA* gba);
|
||||||
|
|
||||||
void GBASetBreakpoint(struct GBA* gba, struct ARMComponent* component, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
|
void GBASetBreakpoint(struct GBA* gba, struct ARMComponent* component, uint32_t address, enum ExecutionMode mode,
|
||||||
|
uint32_t* opcode);
|
||||||
void GBAClearBreakpoint(struct GBA* gba, uint32_t address, enum ExecutionMode mode, uint32_t opcode);
|
void GBAClearBreakpoint(struct GBA* gba, uint32_t address, enum ExecutionMode mode, uint32_t opcode);
|
||||||
|
|
||||||
void GBALoadROM(struct GBA* gba, struct VFile* vf, struct VFile* sav, const char* fname);
|
void GBALoadROM(struct GBA* gba, struct VFile* vf, struct VFile* sav, const char* fname);
|
||||||
@ -220,7 +221,7 @@ void GBAGetGameTitle(struct GBA* gba, char* out);
|
|||||||
void GBAFrameStarted(struct GBA* gba);
|
void GBAFrameStarted(struct GBA* gba);
|
||||||
void GBAFrameEnded(struct GBA* gba);
|
void GBAFrameEnded(struct GBA* gba);
|
||||||
|
|
||||||
ATTRIBUTE_FORMAT(printf,3,4)
|
ATTRIBUTE_FORMAT(printf, 3, 4)
|
||||||
void GBALog(struct GBA* gba, enum GBALogLevel level, const char* format, ...);
|
void GBALog(struct GBA* gba, enum GBALogLevel level, const char* format, ...);
|
||||||
|
|
||||||
ATTRIBUTE_FORMAT(printf, 3, 4)
|
ATTRIBUTE_FORMAT(printf, 3, 4)
|
||||||
|
@ -3,49 +3,49 @@
|
|||||||
#include "gba/memory.h"
|
#include "gba/memory.h"
|
||||||
|
|
||||||
const uint8_t hleBios[SIZE_BIOS] = {
|
const uint8_t hleBios[SIZE_BIOS] = {
|
||||||
0x06, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x07, 0x00, 0x00, 0xea,
|
0x06, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x07, 0x00, 0x00, 0xea,
|
||||||
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1,
|
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1,
|
||||||
0x28, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0xf3, 0xa0, 0xe3,
|
0x28, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0xf3, 0xa0, 0xe3,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x29, 0xe1, 0x00, 0x00, 0x5d, 0xe3,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x29, 0xe1, 0x00, 0x00, 0x5d, 0xe3,
|
||||||
0x01, 0xd3, 0xa0, 0x03, 0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9,
|
0x01, 0xd3, 0xa0, 0x03, 0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9,
|
||||||
0x02, 0xb0, 0x5e, 0xe5, 0x8c, 0xc0, 0xa0, 0xe3, 0x0b, 0xb1, 0x9c, 0xe7,
|
0x02, 0xb0, 0x5e, 0xe5, 0x8c, 0xc0, 0xa0, 0xe3, 0x0b, 0xb1, 0x9c, 0xe7,
|
||||||
0x00, 0x00, 0x5b, 0xe3, 0x00, 0xc0, 0x4f, 0xe1, 0x00, 0x10, 0x2d, 0xe9,
|
0x00, 0x00, 0x5b, 0xe3, 0x00, 0xc0, 0x4f, 0xe1, 0x00, 0x10, 0x2d, 0xe9,
|
||||||
0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3, 0x0c, 0xf0, 0x29, 0xe1,
|
0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3, 0x0c, 0xf0, 0x29, 0xe1,
|
||||||
0x00, 0x40, 0x2d, 0xe9, 0x0f, 0xe0, 0xa0, 0xe1, 0x1b, 0xff, 0x2f, 0x11,
|
0x00, 0x40, 0x2d, 0xe9, 0x0f, 0xe0, 0xa0, 0xe1, 0x1b, 0xff, 0x2f, 0x11,
|
||||||
0x00, 0x40, 0xbd, 0xe8, 0x93, 0xf0, 0x29, 0xe3, 0x00, 0x10, 0xbd, 0xe8,
|
0x00, 0x40, 0xbd, 0xe8, 0x93, 0xf0, 0x29, 0xe3, 0x00, 0x10, 0xbd, 0xe8,
|
||||||
0x0c, 0xf0, 0x69, 0xe1, 0x00, 0x58, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1,
|
0x0c, 0xf0, 0x69, 0xe1, 0x00, 0x58, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0xa0, 0xe3, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0xa0, 0xe3, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xe8, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xe8, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
|
||||||
0x0f, 0x50, 0x2d, 0xe9, 0x01, 0x03, 0xa0, 0xe3, 0x00, 0xe0, 0x8f, 0xe2,
|
0x0f, 0x50, 0x2d, 0xe9, 0x01, 0x03, 0xa0, 0xe3, 0x00, 0xe0, 0x8f, 0xe2,
|
||||||
0x04, 0xf0, 0x10, 0xe5, 0x0f, 0x50, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2,
|
0x04, 0xf0, 0x10, 0xe5, 0x0f, 0x50, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x5e, 0xe5, 0x01, 0x00, 0xa0, 0xe3,
|
0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x5e, 0xe5, 0x01, 0x00, 0xa0, 0xe3,
|
||||||
0x01, 0x10, 0xa0, 0xe3, 0x0c, 0x40, 0x2d, 0xe9, 0x01, 0xc3, 0xa0, 0xe3,
|
0x01, 0x10, 0xa0, 0xe3, 0x0c, 0x40, 0x2d, 0xe9, 0x01, 0xc3, 0xa0, 0xe3,
|
||||||
0x00, 0x00, 0x50, 0xe3, 0x00, 0x00, 0xa0, 0xe3, 0x01, 0x20, 0xa0, 0xe3,
|
0x00, 0x00, 0x50, 0xe3, 0x00, 0x00, 0xa0, 0xe3, 0x01, 0x20, 0xa0, 0xe3,
|
||||||
0x03, 0x00, 0x00, 0x0a, 0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0xc3, 0xe1,
|
0x03, 0x00, 0x00, 0x0a, 0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0xc3, 0xe1,
|
||||||
0xb8, 0x30, 0x4c, 0xe1, 0x01, 0x03, 0xcc, 0xe5, 0x08, 0x02, 0xcc, 0xe5,
|
0xb8, 0x30, 0x4c, 0xe1, 0x01, 0x03, 0xcc, 0xe5, 0x08, 0x02, 0xcc, 0xe5,
|
||||||
0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0x13, 0xe0, 0x01, 0x30, 0x23, 0x10,
|
0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0x13, 0xe0, 0x01, 0x30, 0x23, 0x10,
|
||||||
0xb8, 0x30, 0x4c, 0x11, 0x08, 0x22, 0xcc, 0xe5, 0xf7, 0xff, 0xff, 0x0a,
|
0xb8, 0x30, 0x4c, 0x11, 0x08, 0x22, 0xcc, 0xe5, 0xf7, 0xff, 0xff, 0x0a,
|
||||||
0x0c, 0x80, 0xbd, 0xe8, 0x00, 0x40, 0x2d, 0xe9, 0x02, 0x36, 0xa0, 0xe1,
|
0x0c, 0x80, 0xbd, 0xe8, 0x00, 0x40, 0x2d, 0xe9, 0x02, 0x36, 0xa0, 0xe1,
|
||||||
0x01, 0x04, 0x12, 0xe3, 0x0f, 0x00, 0x00, 0x0a, 0x01, 0x03, 0x12, 0xe3,
|
0x01, 0x04, 0x12, 0xe3, 0x0f, 0x00, 0x00, 0x0a, 0x01, 0x03, 0x12, 0xe3,
|
||||||
0x05, 0x00, 0x00, 0x0a, 0x23, 0x35, 0x81, 0xe0, 0x04, 0x00, 0xb0, 0xe8,
|
0x05, 0x00, 0x00, 0x0a, 0x23, 0x35, 0x81, 0xe0, 0x04, 0x00, 0xb0, 0xe8,
|
||||||
0x03, 0x00, 0x51, 0xe1, 0x04, 0x00, 0xa1, 0xb8, 0xfc, 0xff, 0xff, 0xba,
|
0x03, 0x00, 0x51, 0xe1, 0x04, 0x00, 0xa1, 0xb8, 0xfc, 0xff, 0xff, 0xba,
|
||||||
0x16, 0x00, 0x00, 0xea, 0x01, 0x00, 0xc0, 0xe3, 0x01, 0x10, 0xc1, 0xe3,
|
0x16, 0x00, 0x00, 0xea, 0x01, 0x00, 0xc0, 0xe3, 0x01, 0x10, 0xc1, 0xe3,
|
||||||
0xa3, 0x35, 0x81, 0xe0, 0xb0, 0x20, 0xd0, 0xe1, 0x03, 0x00, 0x51, 0xe1,
|
0xa3, 0x35, 0x81, 0xe0, 0xb0, 0x20, 0xd0, 0xe1, 0x03, 0x00, 0x51, 0xe1,
|
||||||
0xb2, 0x20, 0xc1, 0xb0, 0xfc, 0xff, 0xff, 0xba, 0x0e, 0x00, 0x00, 0xea,
|
0xb2, 0x20, 0xc1, 0xb0, 0xfc, 0xff, 0xff, 0xba, 0x0e, 0x00, 0x00, 0xea,
|
||||||
0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a, 0x23, 0x35, 0x81, 0xe0,
|
0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a, 0x23, 0x35, 0x81, 0xe0,
|
||||||
0x03, 0x00, 0x51, 0xe1, 0x04, 0x00, 0xb0, 0xb8, 0x04, 0x00, 0xa1, 0xb8,
|
0x03, 0x00, 0x51, 0xe1, 0x04, 0x00, 0xb0, 0xb8, 0x04, 0x00, 0xa1, 0xb8,
|
||||||
0xfb, 0xff, 0xff, 0xba, 0x06, 0x00, 0x00, 0xea, 0xa3, 0x35, 0x81, 0xe0,
|
0xfb, 0xff, 0xff, 0xba, 0x06, 0x00, 0x00, 0xea, 0xa3, 0x35, 0x81, 0xe0,
|
||||||
0x01, 0x00, 0xc0, 0xe3, 0x01, 0x10, 0xc1, 0xe3, 0x03, 0x00, 0x51, 0xe1,
|
0x01, 0x00, 0xc0, 0xe3, 0x01, 0x10, 0xc1, 0xe3, 0x03, 0x00, 0x51, 0xe1,
|
||||||
0xb2, 0x20, 0xd0, 0xb0, 0xb2, 0x20, 0xc1, 0xb0, 0xfb, 0xff, 0xff, 0xba,
|
0xb2, 0x20, 0xd0, 0xb0, 0xb2, 0x20, 0xc1, 0xb0, 0xfb, 0xff, 0xff, 0xba,
|
||||||
0x00, 0x80, 0xbd, 0xe8, 0xf0, 0x47, 0x2d, 0xe9, 0x01, 0x04, 0x12, 0xe3,
|
0x00, 0x80, 0xbd, 0xe8, 0xf0, 0x47, 0x2d, 0xe9, 0x01, 0x04, 0x12, 0xe3,
|
||||||
0x02, 0x36, 0xa0, 0xe1, 0x23, 0x25, 0x81, 0xe0, 0x0b, 0x00, 0x00, 0x0a,
|
0x02, 0x36, 0xa0, 0xe1, 0x23, 0x25, 0x81, 0xe0, 0x0b, 0x00, 0x00, 0x0a,
|
||||||
0x00, 0x30, 0x90, 0xe5, 0x03, 0x40, 0xa0, 0xe1, 0x03, 0x50, 0xa0, 0xe1,
|
0x00, 0x30, 0x90, 0xe5, 0x03, 0x40, 0xa0, 0xe1, 0x03, 0x50, 0xa0, 0xe1,
|
||||||
0x03, 0x60, 0xa0, 0xe1, 0x03, 0x70, 0xa0, 0xe1, 0x03, 0x80, 0xa0, 0xe1,
|
0x03, 0x60, 0xa0, 0xe1, 0x03, 0x70, 0xa0, 0xe1, 0x03, 0x80, 0xa0, 0xe1,
|
||||||
0x03, 0x90, 0xa0, 0xe1, 0x03, 0xa0, 0xa0, 0xe1, 0x02, 0x00, 0x51, 0xe1,
|
0x03, 0x90, 0xa0, 0xe1, 0x03, 0xa0, 0xa0, 0xe1, 0x02, 0x00, 0x51, 0xe1,
|
||||||
0xf8, 0x07, 0xa1, 0xb8, 0xfc, 0xff, 0xff, 0xba, 0x03, 0x00, 0x00, 0xea,
|
0xf8, 0x07, 0xa1, 0xb8, 0xfc, 0xff, 0xff, 0xba, 0x03, 0x00, 0x00, 0xea,
|
||||||
0x02, 0x00, 0x51, 0xe1, 0xf8, 0x07, 0xb0, 0xb8, 0xf8, 0x07, 0xa1, 0xb8,
|
0x02, 0x00, 0x51, 0xe1, 0xf8, 0x07, 0xb0, 0xb8, 0xf8, 0x07, 0xa1, 0xb8,
|
||||||
0xfb, 0xff, 0xff, 0xba, 0xf0, 0x87, 0xbd, 0xe8
|
0xfb, 0xff, 0xff, 0xba, 0xf0, 0x87, 0xbd, 0xe8
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,9 @@ void GBAInputProfileSave(const struct GBAInputMap*, uint32_t type, struct Config
|
|||||||
const char* GBAInputGetPreferredDevice(const struct Configuration*, uint32_t type, int playerId);
|
const char* GBAInputGetPreferredDevice(const struct Configuration*, uint32_t type, int playerId);
|
||||||
void GBAInputSetPreferredDevice(struct Configuration*, uint32_t type, int playerId, const char* deviceName);
|
void GBAInputSetPreferredDevice(struct Configuration*, uint32_t type, int playerId, const char* deviceName);
|
||||||
|
|
||||||
const char* GBAInputGetCustomValue(const struct Configuration* config, uint32_t type, const char* key, const char* profile);
|
const char* GBAInputGetCustomValue(const struct Configuration* config, uint32_t type, const char* key,
|
||||||
void GBAInputSetCustomValue(struct Configuration* config, uint32_t type, const char* key, const char* value, const char* profile);
|
const char* profile);
|
||||||
|
void GBAInputSetCustomValue(struct Configuration* config, uint32_t type, const char* key, const char* value,
|
||||||
|
const char* profile);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -273,7 +273,7 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
|
|||||||
if ((address & (SIZE_CART0 - 1)) < memory->romSize) {
|
if ((address & (SIZE_CART0 - 1)) < memory->romSize) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Fall through
|
// Fall through
|
||||||
default:
|
default:
|
||||||
memory->activeRegion = -1;
|
memory->activeRegion = -1;
|
||||||
cpu->memory.activeRegion = _deadbeef;
|
cpu->memory.activeRegion = _deadbeef;
|
||||||
@ -481,7 +481,7 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
|||||||
LOAD_16(value, address & (SIZE_CART0 - 2), memory->rom);
|
LOAD_16(value, address & (SIZE_CART0 - 2), memory->rom);
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load16: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load16: 0x%08X", address);
|
||||||
value = (address >> 1) & 0xFFFF; \
|
value = (address >> 1) & 0xFFFF;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REGION_CART2_EX:
|
case REGION_CART2_EX:
|
||||||
@ -492,7 +492,7 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
|||||||
LOAD_16(value, address & (SIZE_CART0 - 2), memory->rom);
|
LOAD_16(value, address & (SIZE_CART0 - 2), memory->rom);
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load16: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load16: 0x%08X", address);
|
||||||
value = (address >> 1) & 0xFFFF; \
|
value = (address >> 1) & 0xFFFF;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REGION_CART_SRAM:
|
case REGION_CART_SRAM:
|
||||||
@ -576,7 +576,7 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
|||||||
value = ((uint8_t*) memory->rom)[address & (SIZE_CART0 - 1)];
|
value = ((uint8_t*) memory->rom)[address & (SIZE_CART0 - 1)];
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load8: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load8: 0x%08X", address);
|
||||||
value = (address >> 1) & 0xFF; \
|
value = (address >> 1) & 0xFF;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REGION_CART_SRAM:
|
case REGION_CART_SRAM:
|
||||||
@ -1266,7 +1266,7 @@ void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters) {
|
|||||||
int ws2seq = (parameters & 0x0400) >> 10;
|
int ws2seq = (parameters & 0x0400) >> 10;
|
||||||
int prefetch = parameters & 0x4000;
|
int prefetch = parameters & 0x4000;
|
||||||
|
|
||||||
memory->waitstatesNonseq16[REGION_CART_SRAM] = memory->waitstatesNonseq16[REGION_CART_SRAM_MIRROR] = GBA_ROM_WAITSTATES[sram];
|
memory->waitstatesNonseq16[REGION_CART_SRAM] = memory->waitstatesNonseq16[REGION_CART_SRAM_MIRROR] = GBA_ROM_WAITSTATES[sram];
|
||||||
memory->waitstatesSeq16[REGION_CART_SRAM] = memory->waitstatesSeq16[REGION_CART_SRAM_MIRROR] = GBA_ROM_WAITSTATES[sram];
|
memory->waitstatesSeq16[REGION_CART_SRAM] = memory->waitstatesSeq16[REGION_CART_SRAM_MIRROR] = GBA_ROM_WAITSTATES[sram];
|
||||||
memory->waitstatesNonseq32[REGION_CART_SRAM] = memory->waitstatesNonseq32[REGION_CART_SRAM_MIRROR] = 2 * GBA_ROM_WAITSTATES[sram] + 1;
|
memory->waitstatesNonseq32[REGION_CART_SRAM] = memory->waitstatesNonseq32[REGION_CART_SRAM_MIRROR] = 2 * GBA_ROM_WAITSTATES[sram] + 1;
|
||||||
memory->waitstatesSeq32[REGION_CART_SRAM] = memory->waitstatesSeq32[REGION_CART_SRAM_MIRROR] = 2 * GBA_ROM_WAITSTATES[sram] + 1;
|
memory->waitstatesSeq32[REGION_CART_SRAM] = memory->waitstatesSeq32[REGION_CART_SRAM_MIRROR] = 2 * GBA_ROM_WAITSTATES[sram] + 1;
|
||||||
|
@ -86,7 +86,6 @@ enum DMATiming {
|
|||||||
DMA_TIMING_CUSTOM = 3
|
DMA_TIMING_CUSTOM = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DECL_BITFIELD(GBADMARegister, uint16_t);
|
DECL_BITFIELD(GBADMARegister, uint16_t);
|
||||||
DECL_BITS(GBADMARegister, DestControl, 5, 2);
|
DECL_BITS(GBADMARegister, DestControl, 5, 2);
|
||||||
DECL_BITS(GBADMARegister, SrcControl, 7, 2);
|
DECL_BITS(GBADMARegister, SrcControl, 7, 2);
|
||||||
@ -159,8 +158,10 @@ void GBAPatch32(struct ARMCore* cpu, uint32_t address, int32_t value, int32_t* o
|
|||||||
void GBAPatch16(struct ARMCore* cpu, uint32_t address, int16_t value, int16_t* old);
|
void GBAPatch16(struct ARMCore* cpu, uint32_t address, int16_t value, int16_t* old);
|
||||||
void GBAPatch8(struct ARMCore* cpu, uint32_t address, int8_t value, int8_t* old);
|
void GBAPatch8(struct ARMCore* cpu, uint32_t address, int8_t value, int8_t* old);
|
||||||
|
|
||||||
uint32_t GBALoadMultiple(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction, int* cycleCounter);
|
uint32_t GBALoadMultiple(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction,
|
||||||
uint32_t GBAStoreMultiple(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction, int* cycleCounter);
|
int* cycleCounter);
|
||||||
|
uint32_t GBAStoreMultiple(struct ARMCore*, uint32_t baseAddress, int mask, enum LSMDirection direction,
|
||||||
|
int* cycleCounter);
|
||||||
|
|
||||||
void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters);
|
void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters);
|
||||||
|
|
||||||
|
@ -14,11 +14,16 @@
|
|||||||
#define VIDEO_CHECKS true
|
#define VIDEO_CHECKS true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GBAVideoSoftwareRendererDrawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int y);
|
void GBAVideoSoftwareRendererDrawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer,
|
||||||
void GBAVideoSoftwareRendererDrawBackgroundMode2(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int y);
|
struct GBAVideoSoftwareBackground* background, int y);
|
||||||
void GBAVideoSoftwareRendererDrawBackgroundMode3(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int y);
|
void GBAVideoSoftwareRendererDrawBackgroundMode2(struct GBAVideoSoftwareRenderer* renderer,
|
||||||
void GBAVideoSoftwareRendererDrawBackgroundMode4(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int y);
|
struct GBAVideoSoftwareBackground* background, int y);
|
||||||
void GBAVideoSoftwareRendererDrawBackgroundMode5(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int y);
|
void GBAVideoSoftwareRendererDrawBackgroundMode3(struct GBAVideoSoftwareRenderer* renderer,
|
||||||
|
struct GBAVideoSoftwareBackground* background, int y);
|
||||||
|
void GBAVideoSoftwareRendererDrawBackgroundMode4(struct GBAVideoSoftwareRenderer* renderer,
|
||||||
|
struct GBAVideoSoftwareBackground* background, int y);
|
||||||
|
void GBAVideoSoftwareRendererDrawBackgroundMode5(struct GBAVideoSoftwareRenderer* renderer,
|
||||||
|
struct GBAVideoSoftwareBackground* background, int y);
|
||||||
|
|
||||||
int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj* sprite, int y);
|
int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj* sprite, int y);
|
||||||
void GBAVideoSoftwareRendererPostprocessSprite(struct GBAVideoSoftwareRenderer* renderer, unsigned priority);
|
void GBAVideoSoftwareRendererPostprocessSprite(struct GBAVideoSoftwareRenderer* renderer, unsigned priority);
|
||||||
@ -58,22 +63,24 @@ static inline void _compositeBlendNoObjwin(struct GBAVideoSoftwareRenderer* rend
|
|||||||
*pixel = color;
|
*pixel = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _compositeNoBlendObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color, uint32_t current) {
|
static inline void _compositeNoBlendObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color,
|
||||||
|
uint32_t current) {
|
||||||
UNUSED(renderer);
|
UNUSED(renderer);
|
||||||
if (color < current) {
|
if (color < current) {
|
||||||
*pixel = color | (current & FLAG_OBJWIN);
|
*pixel = color | (current & FLAG_OBJWIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color, uint32_t current) {
|
static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color,
|
||||||
|
uint32_t current) {
|
||||||
UNUSED(renderer);
|
UNUSED(renderer);
|
||||||
if (color < current) {
|
if (color < current) {
|
||||||
*pixel = color;
|
*pixel = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COMPOSITE_16_OBJWIN(BLEND) \
|
#define COMPOSITE_16_OBJWIN(BLEND) \
|
||||||
if (objwinForceEnable || !(current & FLAG_OBJWIN) == objwinOnly) { \
|
if (objwinForceEnable || !(current & FLAG_OBJWIN) == objwinOnly) { \
|
||||||
unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[paletteData | pixelData] : palette[pixelData]; \
|
unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[paletteData | pixelData] : palette[pixelData]; \
|
||||||
unsigned mergedFlags = flags; \
|
unsigned mergedFlags = flags; \
|
||||||
if (current & FLAG_OBJWIN) { \
|
if (current & FLAG_OBJWIN) { \
|
||||||
@ -115,78 +122,86 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
|||||||
tileData >>= 8;
|
tileData >>= 8;
|
||||||
|
|
||||||
// TODO: Remove UNUSEDs after implementing OBJWIN for modes 3 - 5
|
// TODO: Remove UNUSEDs after implementing OBJWIN for modes 3 - 5
|
||||||
#define PREPARE_OBJWIN \
|
#define PREPARE_OBJWIN \
|
||||||
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt); \
|
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt); \
|
||||||
int objwinOnly = 0; \
|
int objwinOnly = 0; \
|
||||||
int objwinForceEnable = 0; \
|
int objwinForceEnable = 0; \
|
||||||
UNUSED(objwinForceEnable); \
|
UNUSED(objwinForceEnable); \
|
||||||
color_t* objwinPalette = renderer->normalPalette; \
|
color_t* objwinPalette = renderer->normalPalette; \
|
||||||
UNUSED(objwinPalette); \
|
UNUSED(objwinPalette); \
|
||||||
if (objwinSlowPath) { \
|
if (objwinSlowPath) { \
|
||||||
if (background->target1 && GBAWindowControlIsBlendEnable(renderer->objwin.packed) && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN)) { \
|
if (background->target1 && GBAWindowControlIsBlendEnable(renderer->objwin.packed) && \
|
||||||
objwinPalette = renderer->variantPalette; \
|
(renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN)) { \
|
||||||
} \
|
objwinPalette = renderer->variantPalette; \
|
||||||
switch (background->index) { \
|
} \
|
||||||
case 0: \
|
switch (background->index) { \
|
||||||
objwinForceEnable = GBAWindowControlIsBg0Enable(renderer->objwin.packed) && GBAWindowControlIsBg0Enable(renderer->currentWindow.packed); \
|
case 0: \
|
||||||
objwinOnly = !GBAWindowControlIsBg0Enable(renderer->objwin.packed); \
|
objwinForceEnable = GBAWindowControlIsBg0Enable(renderer->objwin.packed) && \
|
||||||
break; \
|
GBAWindowControlIsBg0Enable(renderer->currentWindow.packed); \
|
||||||
case 1: \
|
objwinOnly = !GBAWindowControlIsBg0Enable(renderer->objwin.packed); \
|
||||||
objwinForceEnable = GBAWindowControlIsBg1Enable(renderer->objwin.packed) && GBAWindowControlIsBg1Enable(renderer->currentWindow.packed); \
|
break; \
|
||||||
objwinOnly = !GBAWindowControlIsBg1Enable(renderer->objwin.packed); \
|
case 1: \
|
||||||
break; \
|
objwinForceEnable = GBAWindowControlIsBg1Enable(renderer->objwin.packed) && \
|
||||||
case 2: \
|
GBAWindowControlIsBg1Enable(renderer->currentWindow.packed); \
|
||||||
objwinForceEnable = GBAWindowControlIsBg2Enable(renderer->objwin.packed) && GBAWindowControlIsBg2Enable(renderer->currentWindow.packed); \
|
objwinOnly = !GBAWindowControlIsBg1Enable(renderer->objwin.packed); \
|
||||||
objwinOnly = !GBAWindowControlIsBg2Enable(renderer->objwin.packed); \
|
break; \
|
||||||
break; \
|
case 2: \
|
||||||
case 3: \
|
objwinForceEnable = GBAWindowControlIsBg2Enable(renderer->objwin.packed) && \
|
||||||
objwinForceEnable = GBAWindowControlIsBg3Enable(renderer->objwin.packed) && GBAWindowControlIsBg3Enable(renderer->currentWindow.packed); \
|
GBAWindowControlIsBg2Enable(renderer->currentWindow.packed); \
|
||||||
objwinOnly = !GBAWindowControlIsBg3Enable(renderer->objwin.packed); \
|
objwinOnly = !GBAWindowControlIsBg2Enable(renderer->objwin.packed); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
case 3: \
|
||||||
|
objwinForceEnable = GBAWindowControlIsBg3Enable(renderer->objwin.packed) && \
|
||||||
|
GBAWindowControlIsBg3Enable(renderer->currentWindow.packed); \
|
||||||
|
objwinOnly = !GBAWindowControlIsBg3Enable(renderer->objwin.packed); \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BACKGROUND_BITMAP_INIT \
|
#define BACKGROUND_BITMAP_INIT \
|
||||||
int32_t x = background->sx + (renderer->start - 1) * background->dx; \
|
int32_t x = background->sx + (renderer->start - 1) * background->dx; \
|
||||||
int32_t y = background->sy + (renderer->start - 1) * background->dy; \
|
int32_t y = background->sy + (renderer->start - 1) * background->dy; \
|
||||||
int mosaicH = 0; \
|
int mosaicH = 0; \
|
||||||
int mosaicWait = 0; \
|
int mosaicWait = 0; \
|
||||||
if (background->mosaic) { \
|
if (background->mosaic) { \
|
||||||
int mosaicV = GBAMosaicControlGetBgV(renderer->mosaic) + 1; \
|
int mosaicV = GBAMosaicControlGetBgV(renderer->mosaic) + 1; \
|
||||||
y -= (inY % mosaicV) * background->dmy; \
|
y -= (inY % mosaicV) * background->dmy; \
|
||||||
x -= (inY % mosaicV) * background->dmx; \
|
x -= (inY % mosaicV) * background->dmx; \
|
||||||
mosaicH = GBAMosaicControlGetBgH(renderer->mosaic); \
|
mosaicH = GBAMosaicControlGetBgH(renderer->mosaic); \
|
||||||
mosaicWait = renderer->start % (mosaicH + 1); \
|
mosaicWait = renderer->start % (mosaicH + 1); \
|
||||||
} \
|
} \
|
||||||
int32_t localX; \
|
int32_t localX; \
|
||||||
int32_t localY; \
|
int32_t localY; \
|
||||||
\
|
\
|
||||||
int flags = (background->priority << OFFSET_PRIORITY) | (background->index << OFFSET_INDEX) | FLAG_IS_BACKGROUND; \
|
int flags = (background->priority << OFFSET_PRIORITY) | (background->index << OFFSET_INDEX) | FLAG_IS_BACKGROUND; \
|
||||||
flags |= FLAG_TARGET_2 * background->target2; \
|
flags |= FLAG_TARGET_2 * background->target2; \
|
||||||
int objwinFlags = FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA && GBAWindowControlIsBlendEnable(renderer->objwin.packed)); \
|
int objwinFlags = FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA && \
|
||||||
objwinFlags |= flags; \
|
GBAWindowControlIsBlendEnable(renderer->objwin.packed)); \
|
||||||
flags |= FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed)); \
|
objwinFlags |= flags; \
|
||||||
if (renderer->blda == 0x10 && renderer->bldb == 0) { \
|
flags |= FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA && \
|
||||||
flags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
GBAWindowControlIsBlendEnable(renderer->currentWindow.packed)); \
|
||||||
objwinFlags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
if (renderer->blda == 0x10 && renderer->bldb == 0) { \
|
||||||
} \
|
flags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
||||||
int variant = background->target1 && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed) && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); \
|
objwinFlags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
||||||
color_t* palette = renderer->normalPalette; \
|
} \
|
||||||
if (variant) { \
|
int variant = background->target1 && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed) && \
|
||||||
palette = renderer->variantPalette; \
|
(renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); \
|
||||||
} \
|
color_t* palette = renderer->normalPalette; \
|
||||||
UNUSED(palette); \
|
if (variant) { \
|
||||||
|
palette = renderer->variantPalette; \
|
||||||
|
} \
|
||||||
|
UNUSED(palette); \
|
||||||
PREPARE_OBJWIN;
|
PREPARE_OBJWIN;
|
||||||
|
|
||||||
#define BACKGROUND_BITMAP_ITERATE(W, H) \
|
#define BACKGROUND_BITMAP_ITERATE(W, H) \
|
||||||
x += background->dx; \
|
x += background->dx; \
|
||||||
y += background->dy; \
|
y += background->dy; \
|
||||||
\
|
\
|
||||||
if (x < 0 || y < 0 || (x >> 8) >= W || (y >> 8) >= H) { \
|
if (x < 0 || y < 0 || (x >> 8) >= W || (y >> 8) >= H) { \
|
||||||
continue; \
|
continue; \
|
||||||
} else { \
|
} else { \
|
||||||
localX = x; \
|
localX = x; \
|
||||||
localY = y; \
|
localY = y; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned _brighten(unsigned color, int y) {
|
static inline unsigned _brighten(unsigned color, int y) {
|
||||||
|
@ -291,20 +291,20 @@ bool GBASaveStateNamed(struct GBA* gba, struct VFile* vf, bool screenshot) {
|
|||||||
vf->unmap(vf, state, sizeof(struct GBASerializedState));
|
vf->unmap(vf, state, sizeof(struct GBASerializedState));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
else {
|
else {
|
||||||
return _savePNGState(gba, vf);
|
return _savePNGState(gba, vf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GBALoadStateNamed(struct GBA* gba, struct VFile* vf) {
|
bool GBALoadStateNamed(struct GBA* gba, struct VFile* vf) {
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
if (isPNG(vf)) {
|
if (isPNG(vf)) {
|
||||||
return _loadPNGState(gba, vf);
|
return _loadPNGState(gba, vf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (vf->size(vf) < (ssize_t) sizeof(struct GBASerializedState)) {
|
if (vf->size(vf) < (ssize_t) sizeof(struct GBASerializedState)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ bool GBASavedataImportSharkPort(struct GBA* gba, struct VFile* vf, bool testChec
|
|||||||
if (copySize > SIZE_CART_FLASH512) {
|
if (copySize > SIZE_CART_FLASH512) {
|
||||||
GBASavedataForceType(&gba->memory.savedata, SAVEDATA_FLASH1M, gba->memory.savedata.realisticTiming);
|
GBASavedataForceType(&gba->memory.savedata, SAVEDATA_FLASH1M, gba->memory.savedata.realisticTiming);
|
||||||
}
|
}
|
||||||
// Fall through
|
// Fall through
|
||||||
case SAVEDATA_FLASH1M:
|
case SAVEDATA_FLASH1M:
|
||||||
if (copySize > SIZE_CART_FLASH1M) {
|
if (copySize > SIZE_CART_FLASH1M) {
|
||||||
copySize = SIZE_CART_FLASH1M;
|
copySize = SIZE_CART_FLASH1M;
|
||||||
@ -149,7 +149,6 @@ cleanup:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
|
bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
|
||||||
union {
|
union {
|
||||||
char c[0x1C];
|
char c[0x1C];
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "gba/gba.h"
|
#include "gba/gba.h"
|
||||||
#include "gba/hardware.h"
|
#include "gba/hardware.h"
|
||||||
|
|
||||||
#include "util/configuration.h"
|
#include "util/configuration.h"
|
||||||
|
|
||||||
static const struct GBACartridgeOverride _overrides[] = {
|
static const struct GBACartridgeOverride _overrides[] = {
|
||||||
// Advance Wars
|
// Advance Wars
|
||||||
|
@ -108,7 +108,7 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
|
|||||||
struct Patch patch;
|
struct Patch patch;
|
||||||
struct GBACheatDevice cheatDevice;
|
struct GBACheatDevice cheatDevice;
|
||||||
struct GBAThread* threadContext = context;
|
struct GBAThread* threadContext = context;
|
||||||
struct ARMComponent* components[GBA_COMPONENT_MAX] = {0};
|
struct ARMComponent* components[GBA_COMPONENT_MAX] = { 0 };
|
||||||
struct GBARRContext* movie = 0;
|
struct GBARRContext* movie = 0;
|
||||||
int numComponents = GBA_COMPONENT_MAX;
|
int numComponents = GBA_COMPONENT_MAX;
|
||||||
|
|
||||||
@ -701,7 +701,7 @@ void GBAThreadReplaceROM(struct GBAThread* threadContext, const char* fname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GBAThreadLoadROM(threadContext, fname);
|
GBAThreadLoadROM(threadContext, fname);
|
||||||
if(threadContext->gameDir) {
|
if (threadContext->gameDir) {
|
||||||
_loadGameDir(threadContext);
|
_loadGameDir(threadContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,6 @@ static void GBAVideoDummyRendererGetPixels(struct GBAVideoRenderer* renderer, un
|
|||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GBAVideoSerialize(const struct GBAVideo* video, struct GBASerializedState* state) {
|
void GBAVideoSerialize(const struct GBAVideo* video, struct GBASerializedState* state) {
|
||||||
memcpy(state->vram, video->renderer->vram, SIZE_VRAM);
|
memcpy(state->vram, video->renderer->vram, SIZE_VRAM);
|
||||||
memcpy(state->oam, video->oam.raw, SIZE_OAM);
|
memcpy(state->oam, video->oam.raw, SIZE_OAM);
|
||||||
|
@ -65,7 +65,6 @@ DECL_BIT(GBAObjAttributesA, Mosaic, 12);
|
|||||||
DECL_BIT(GBAObjAttributesA, 256Color, 13);
|
DECL_BIT(GBAObjAttributesA, 256Color, 13);
|
||||||
DECL_BITS(GBAObjAttributesA, Shape, 14, 2);
|
DECL_BITS(GBAObjAttributesA, Shape, 14, 2);
|
||||||
|
|
||||||
|
|
||||||
DECL_BITFIELD(GBAObjAttributesB, uint16_t);
|
DECL_BITFIELD(GBAObjAttributesB, uint16_t);
|
||||||
DECL_BITS(GBAObjAttributesB, X, 0, 9);
|
DECL_BITS(GBAObjAttributesB, X, 0, 9);
|
||||||
DECL_BITS(GBAObjAttributesB, MatIndex, 9, 5);
|
DECL_BITS(GBAObjAttributesB, MatIndex, 9, 5);
|
||||||
|
@ -46,7 +46,8 @@ struct GraphicsOpts {
|
|||||||
|
|
||||||
struct GBAThread;
|
struct GBAThread;
|
||||||
|
|
||||||
bool parseArguments(struct GBAArguments* opts, struct GBAConfig* config, int argc, char* const* argv, struct SubParser* subparser);
|
bool parseArguments(struct GBAArguments* opts, struct GBAConfig* config, int argc, char* const* argv,
|
||||||
|
struct SubParser* subparser);
|
||||||
void freeArguments(struct GBAArguments* opts);
|
void freeArguments(struct GBAArguments* opts);
|
||||||
|
|
||||||
void usage(const char* arg0, const char* extraOptions);
|
void usage(const char* arg0, const char* extraOptions);
|
||||||
|
@ -248,9 +248,9 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
|||||||
avcodec_fill_audio_frame(encoder->audioFrame, encoder->audio->channels, encoder->audio->sample_fmt, (const uint8_t*) encoder->postaudioBuffer, encoder->postaudioBufferSize, 0);
|
avcodec_fill_audio_frame(encoder->audioFrame, encoder->audio->channels, encoder->audio->sample_fmt, (const uint8_t*) encoder->postaudioBuffer, encoder->postaudioBufferSize, 0);
|
||||||
|
|
||||||
if (encoder->audio->codec->id == AV_CODEC_ID_AAC &&
|
if (encoder->audio->codec->id == AV_CODEC_ID_AAC &&
|
||||||
(strcasecmp(encoder->containerFormat, "mp4") ||
|
(strcasecmp(encoder->containerFormat, "mp4") ||
|
||||||
strcasecmp(encoder->containerFormat, "m4v") ||
|
strcasecmp(encoder->containerFormat, "m4v") ||
|
||||||
strcasecmp(encoder->containerFormat, "mov"))) {
|
strcasecmp(encoder->containerFormat, "mov"))) {
|
||||||
// MP4 container doesn't support the raw ADTS AAC format that the encoder spits out
|
// MP4 container doesn't support the raw ADTS AAC format that the encoder spits out
|
||||||
encoder->absf = av_bitstream_filter_init("aac_adtstoasc");
|
encoder->absf = av_bitstream_filter_init("aac_adtstoasc");
|
||||||
}
|
}
|
||||||
@ -292,19 +292,19 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
|||||||
encoder->scaleContext = sws_getContext(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS,
|
encoder->scaleContext = sws_getContext(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS,
|
||||||
#ifdef COLOR_16_BIT
|
#ifdef COLOR_16_BIT
|
||||||
#ifdef COLOR_5_6_5
|
#ifdef COLOR_5_6_5
|
||||||
AV_PIX_FMT_RGB565,
|
AV_PIX_FMT_RGB565,
|
||||||
#else
|
#else
|
||||||
AV_PIX_FMT_BGR555,
|
AV_PIX_FMT_BGR555,
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifndef USE_LIBAV
|
#ifndef USE_LIBAV
|
||||||
AV_PIX_FMT_0BGR32,
|
AV_PIX_FMT_0BGR32,
|
||||||
#else
|
#else
|
||||||
AV_PIX_FMT_BGR32,
|
AV_PIX_FMT_BGR32,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
encoder->videoFrame->width, encoder->videoFrame->height, encoder->video->pix_fmt,
|
encoder->videoFrame->width, encoder->videoFrame->height, encoder->video->pix_fmt,
|
||||||
SWS_POINT, 0, 0, 0);
|
SWS_POINT, 0, 0, 0);
|
||||||
av_image_alloc(encoder->videoFrame->data, encoder->videoFrame->linesize, encoder->video->width, encoder->video->height, encoder->video->pix_fmt, 32);
|
av_image_alloc(encoder->videoFrame->data, encoder->videoFrame->linesize, encoder->video->width, encoder->video->height, encoder->video->pix_fmt, 32);
|
||||||
|
|
||||||
avio_open(&encoder->context->pb, outfile, AVIO_FLAG_WRITE);
|
avio_open(&encoder->context->pb, outfile, AVIO_FLAG_WRITE);
|
||||||
@ -378,8 +378,8 @@ void _ffmpegPostAudioFrame(struct GBAAVStream* stream, int16_t left, int16_t rig
|
|||||||
|
|
||||||
int channelSize = 2 * av_get_bytes_per_sample(encoder->audio->sample_fmt);
|
int channelSize = 2 * av_get_bytes_per_sample(encoder->audio->sample_fmt);
|
||||||
avresample_convert(encoder->resampleContext,
|
avresample_convert(encoder->resampleContext,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
(uint8_t**) &encoder->audioBuffer, 0, encoder->audioBufferSize / 4);
|
(uint8_t**) &encoder->audioBuffer, 0, encoder->audioBufferSize / 4);
|
||||||
if (avresample_available(encoder->resampleContext) < encoder->audioFrame->nb_samples) {
|
if (avresample_available(encoder->resampleContext) < encoder->audioFrame->nb_samples) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -402,8 +402,8 @@ void _ffmpegPostAudioFrame(struct GBAAVStream* stream, int16_t left, int16_t rig
|
|||||||
if (encoder->absf) {
|
if (encoder->absf) {
|
||||||
AVPacket tempPacket = packet;
|
AVPacket tempPacket = packet;
|
||||||
int success = av_bitstream_filter_filter(encoder->absf, encoder->audio, 0,
|
int success = av_bitstream_filter_filter(encoder->absf, encoder->audio, 0,
|
||||||
&tempPacket.data, &tempPacket.size,
|
&tempPacket.data, &tempPacket.size,
|
||||||
packet.data, packet.size, 0);
|
packet.data, packet.size, 0);
|
||||||
if (success > 0) {
|
if (success > 0) {
|
||||||
#if LIBAVUTIL_VERSION_MAJOR >= 53
|
#if LIBAVUTIL_VERSION_MAJOR >= 53
|
||||||
tempPacket.buf = av_buffer_create(tempPacket.data, tempPacket.size, av_buffer_default_free, 0, 0);
|
tempPacket.buf = av_buffer_create(tempPacket.data, tempPacket.size, av_buffer_default_free, 0, 0);
|
||||||
|
@ -58,7 +58,7 @@ static void _magickPostVideoFrame(struct GBAAVStream* stream, struct GBAVideoRen
|
|||||||
renderer->getPixels(renderer, &stride, (void**) &pixels);
|
renderer->getPixels(renderer, &stride, (void**) &pixels);
|
||||||
size_t row;
|
size_t row;
|
||||||
for (row = 0; row < VIDEO_VERTICAL_PIXELS; ++row) {
|
for (row = 0; row < VIDEO_VERTICAL_PIXELS; ++row) {
|
||||||
memcpy(&encoder->frame[row * VIDEO_HORIZONTAL_PIXELS], &pixels[row * 4 *stride], VIDEO_HORIZONTAL_PIXELS * 4);
|
memcpy(&encoder->frame[row * VIDEO_HORIZONTAL_PIXELS], &pixels[row * 4 * stride], VIDEO_HORIZONTAL_PIXELS * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
MagickConstituteImage(encoder->wand, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, "RGBP", CharPixel, encoder->frame);
|
MagickConstituteImage(encoder->wand, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, "RGBP", CharPixel, encoder->frame);
|
||||||
|
@ -78,7 +78,7 @@ void GBAGLContextDrawFrame(struct VideoBackend* v) {
|
|||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
glVertexPointer(2, GL_INT, 0, _glVertices);
|
glVertexPointer(2, GL_INT, 0, _glVertices);
|
||||||
glTexCoordPointer(2, GL_INT, 0, _glTexCoords);
|
glTexCoordPointer(2, GL_INT, 0, _glTexCoords);
|
||||||
glMatrixMode (GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, 0, 0, 1);
|
glOrtho(0, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, 0, 0, 1);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
@ -104,7 +104,7 @@ QModelIndex CheatsModel::parent(const QModelIndex& index) const {
|
|||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags CheatsModel::flags(const QModelIndex &index) const {
|
Qt::ItemFlags CheatsModel::flags(const QModelIndex& index) const {
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -152,7 +152,6 @@ void CheatsModel::removeAt(const QModelIndex& index) {
|
|||||||
GBACheatSetDeinit(set);
|
GBACheatSetDeinit(set);
|
||||||
delete set;
|
delete set;
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CheatsModel::toString(const QModelIndexList& indices) const {
|
QString CheatsModel::toString(const QModelIndexList& indices) const {
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
|
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||||
|
|
||||||
GBACheatSet* itemAt(const QModelIndex& index);
|
GBACheatSet* itemAt(const QModelIndex& index);
|
||||||
void removeAt(const QModelIndex& index);
|
void removeAt(const QModelIndex& index);
|
||||||
|
@ -80,7 +80,7 @@ void ConfigOption::setValue(const char* value) {
|
|||||||
|
|
||||||
void ConfigOption::setValue(const QVariant& value) {
|
void ConfigOption::setValue(const QVariant& value) {
|
||||||
QPair<QAction*, QVariant> action;
|
QPair<QAction*, QVariant> action;
|
||||||
foreach(action, m_actions) {
|
foreach (action, m_actions) {
|
||||||
bool signalsEnabled = action.first->blockSignals(true);
|
bool signalsEnabled = action.first->blockSignals(true);
|
||||||
action.first->setChecked(value == action.second);
|
action.first->setChecked(value == action.second);
|
||||||
action.first->blockSignals(signalsEnabled);
|
action.first->blockSignals(signalsEnabled);
|
||||||
|
@ -46,7 +46,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
class FileDialog : public QFileDialog {
|
class FileDialog : public QFileDialog {
|
||||||
public:
|
public:
|
||||||
FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(), const QString& filter = QString());
|
FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
|
||||||
|
const QString& filter = QString());
|
||||||
virtual int exec() override;
|
virtual int exec() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -205,7 +205,7 @@ void GBAKeyEditor::refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GBAKeyEditor::lookupBinding(const GBAInputMap* map, KeyEditor* keyEditor, GBAKey key) {
|
void GBAKeyEditor::lookupBinding(const GBAInputMap* map, KeyEditor* keyEditor, GBAKey key) {
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
if (m_type == SDL_BINDING_BUTTON) {
|
if (m_type == SDL_BINDING_BUTTON) {
|
||||||
int value = GBAInputQueryBinding(map, m_type, key);
|
int value = GBAInputQueryBinding(map, m_type, key);
|
||||||
if (value != GBA_NO_MAPPING) {
|
if (value != GBA_NO_MAPPING) {
|
||||||
@ -213,7 +213,7 @@ void GBAKeyEditor::lookupBinding(const GBAInputMap* map, KeyEditor* keyEditor, G
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
keyEditor->setValueKey(GBAInputQueryBinding(map, m_type, key));
|
keyEditor->setValueKey(GBAInputQueryBinding(map, m_type, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,5 +304,6 @@ KeyEditor* GBAKeyEditor::keyById(GBAKey key) {
|
|||||||
void GBAKeyEditor::setLocation(QWidget* widget, qreal x, qreal y) {
|
void GBAKeyEditor::setLocation(QWidget* widget, qreal x, qreal y) {
|
||||||
QSize s = size();
|
QSize s = size();
|
||||||
QSize hint = widget->sizeHint();
|
QSize hint = widget->sizeHint();
|
||||||
widget->setGeometry(s.width() * x - hint.width() / 2.0, s.height() * y - hint.height() / 2.0, hint.width(), hint.height());
|
widget->setGeometry(s.width() * x - hint.width() / 2.0, s.height() * y - hint.height() / 2.0, hint.width(),
|
||||||
|
hint.height());
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ void GDBController::attach() {
|
|||||||
ARMDebuggerEnter(&m_gdbStub.d, DEBUGGER_ENTER_ATTACHED, 0);
|
ARMDebuggerEnter(&m_gdbStub.d, DEBUGGER_ENTER_ATTACHED, 0);
|
||||||
} else {
|
} else {
|
||||||
QObject::disconnect(m_autoattach);
|
QObject::disconnect(m_autoattach);
|
||||||
m_autoattach = connect(m_gameController, &GameController::gameStarted, [this] () {
|
m_autoattach = connect(m_gameController, &GameController::gameStarted, [this]() {
|
||||||
QObject::disconnect(m_autoattach);
|
QObject::disconnect(m_autoattach);
|
||||||
ARMDebuggerEnter(&m_gdbStub.d, DEBUGGER_ENTER_ATTACHED, 0);
|
ARMDebuggerEnter(&m_gdbStub.d, DEBUGGER_ENTER_ATTACHED, 0);
|
||||||
});
|
});
|
||||||
|
@ -106,9 +106,8 @@ void GDBWindow::stopped() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GDBWindow::failed() {
|
void GDBWindow::failed() {
|
||||||
QMessageBox* failure = new QMessageBox(QMessageBox::Warning, tr("Crash"),
|
QMessageBox* failure = new QMessageBox(QMessageBox::Warning, tr("Crash"), tr("Could not start GDB server"),
|
||||||
tr("Could not start GDB server"),
|
QMessageBox::Ok, this, Qt::Sheet);
|
||||||
QMessageBox::Ok, this, Qt::Sheet);
|
|
||||||
failure->setAttribute(Qt::WA_DeleteOnClose);
|
failure->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
failure->show();
|
failure->show();
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,12 @@ GameController::GameController(QObject* parent)
|
|||||||
m_threadContext.logLevel = GBA_LOG_ALL;
|
m_threadContext.logLevel = GBA_LOG_ALL;
|
||||||
|
|
||||||
m_lux.p = this;
|
m_lux.p = this;
|
||||||
m_lux.sample = [] (GBALuminanceSource* context) {
|
m_lux.sample = [](GBALuminanceSource* context) {
|
||||||
GameControllerLux* lux = static_cast<GameControllerLux*>(context);
|
GameControllerLux* lux = static_cast<GameControllerLux*>(context);
|
||||||
lux->value = 0xFF - lux->p->m_luxValue;
|
lux->value = 0xFF - lux->p->m_luxValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
m_lux.readLuminance = [] (GBALuminanceSource* context) {
|
m_lux.readLuminance = [](GBALuminanceSource* context) {
|
||||||
GameControllerLux* lux = static_cast<GameControllerLux*>(context);
|
GameControllerLux* lux = static_cast<GameControllerLux*>(context);
|
||||||
return lux->value;
|
return lux->value;
|
||||||
};
|
};
|
||||||
@ -83,8 +83,8 @@ GameController::GameController(QObject* parent)
|
|||||||
|
|
||||||
m_rtc.p = this;
|
m_rtc.p = this;
|
||||||
m_rtc.override = GameControllerRTC::NO_OVERRIDE;
|
m_rtc.override = GameControllerRTC::NO_OVERRIDE;
|
||||||
m_rtc.sample = [] (GBARTCSource* context) { };
|
m_rtc.sample = [](GBARTCSource* context) {};
|
||||||
m_rtc.unixTime = [] (GBARTCSource* context) -> time_t {
|
m_rtc.unixTime = [](GBARTCSource* context) -> time_t {
|
||||||
GameControllerRTC* rtc = static_cast<GameControllerRTC*>(context);
|
GameControllerRTC* rtc = static_cast<GameControllerRTC*>(context);
|
||||||
switch (rtc->override) {
|
switch (rtc->override) {
|
||||||
case GameControllerRTC::NO_OVERRIDE:
|
case GameControllerRTC::NO_OVERRIDE:
|
||||||
@ -97,7 +97,7 @@ GameController::GameController(QObject* parent)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
m_threadContext.startCallback = [] (GBAThread* context) {
|
m_threadContext.startCallback = [](GBAThread* context) {
|
||||||
GameController* controller = static_cast<GameController*>(context->userData);
|
GameController* controller = static_cast<GameController*>(context->userData);
|
||||||
controller->m_audioProcessor->setInput(context);
|
controller->m_audioProcessor->setInput(context);
|
||||||
context->gba->luminanceSource = &controller->m_lux;
|
context->gba->luminanceSource = &controller->m_lux;
|
||||||
@ -108,12 +108,12 @@ GameController::GameController(QObject* parent)
|
|||||||
controller->gameStarted(context);
|
controller->gameStarted(context);
|
||||||
};
|
};
|
||||||
|
|
||||||
m_threadContext.cleanCallback = [] (GBAThread* context) {
|
m_threadContext.cleanCallback = [](GBAThread* context) {
|
||||||
GameController* controller = static_cast<GameController*>(context->userData);
|
GameController* controller = static_cast<GameController*>(context->userData);
|
||||||
controller->gameStopped(context);
|
controller->gameStopped(context);
|
||||||
};
|
};
|
||||||
|
|
||||||
m_threadContext.frameCallback = [] (GBAThread* context) {
|
m_threadContext.frameCallback = [](GBAThread* context) {
|
||||||
GameController* controller = static_cast<GameController*>(context->userData);
|
GameController* controller = static_cast<GameController*>(context->userData);
|
||||||
if (controller->m_pauseAfterFrame.testAndSetAcquire(true, false)) {
|
if (controller->m_pauseAfterFrame.testAndSetAcquire(true, false)) {
|
||||||
GBAThreadPauseFromThread(context);
|
GBAThreadPauseFromThread(context);
|
||||||
@ -126,7 +126,7 @@ GameController::GameController(QObject* parent)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
m_threadContext.logHandler = [] (GBAThread* context, enum GBALogLevel level, const char* format, va_list args) {
|
m_threadContext.logHandler = [](GBAThread* context, enum GBALogLevel level, const char* format, va_list args) {
|
||||||
static const char* stubMessage = "Stub software interrupt";
|
static const char* stubMessage = "Stub software interrupt";
|
||||||
if (!context) {
|
if (!context) {
|
||||||
return;
|
return;
|
||||||
@ -324,7 +324,6 @@ void GameController::yankPak() {
|
|||||||
threadContinue();
|
threadContinue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GameController::replaceGame(const QString& path) {
|
void GameController::replaceGame(const QString& path) {
|
||||||
if (!m_gameOpen) {
|
if (!m_gameOpen) {
|
||||||
return;
|
return;
|
||||||
|
@ -16,7 +16,7 @@ namespace QGBA {
|
|||||||
|
|
||||||
class InputController;
|
class InputController;
|
||||||
|
|
||||||
class GamepadAxisEvent : public QEvent {
|
class GamepadAxisEvent : public QEvent {
|
||||||
public:
|
public:
|
||||||
enum Direction {
|
enum Direction {
|
||||||
NEUTRAL = 0,
|
NEUTRAL = 0,
|
||||||
|
@ -16,7 +16,7 @@ namespace QGBA {
|
|||||||
|
|
||||||
class InputController;
|
class InputController;
|
||||||
|
|
||||||
class GamepadButtonEvent : public QEvent {
|
class GamepadButtonEvent : public QEvent {
|
||||||
public:
|
public:
|
||||||
GamepadButtonEvent(Type pressType, int button, int type, InputController* controller = nullptr);
|
GamepadButtonEvent(Type pressType, int button, int type, InputController* controller = nullptr);
|
||||||
|
|
||||||
|
@ -195,9 +195,12 @@ void MemoryModel::paintEvent(QPaintEvent* event) {
|
|||||||
static QString arg("%0");
|
static QString arg("%0");
|
||||||
QSizeF letterSize = QSizeF(m_letterWidth, m_cellHeight);
|
QSizeF letterSize = QSizeF(m_letterWidth, m_cellHeight);
|
||||||
painter.drawStaticText(QPointF((m_margins.left() - m_regionName.size().width() - 1) / 2.0, 0), m_regionName);
|
painter.drawStaticText(QPointF((m_margins.left() - m_regionName.size().width() - 1) / 2.0, 0), m_regionName);
|
||||||
painter.drawText(QRect(QPoint(viewport()->size().width() - m_margins.right(), 0), QSize(m_margins.right(), m_margins.top())), Qt::AlignHCenter, tr("ASCII"));
|
painter.drawText(
|
||||||
|
QRect(QPoint(viewport()->size().width() - m_margins.right(), 0), QSize(m_margins.right(), m_margins.top())),
|
||||||
|
Qt::AlignHCenter, tr("ASCII"));
|
||||||
for (int x = 0; x < 16; ++x) {
|
for (int x = 0; x < 16; ++x) {
|
||||||
painter.drawText(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), 0), m_cellSize), Qt::AlignHCenter, QString::number(x, 16).toUpper());
|
painter.drawText(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), 0), m_cellSize), Qt::AlignHCenter,
|
||||||
|
QString::number(x, 16).toUpper());
|
||||||
}
|
}
|
||||||
int height = (viewport()->size().height() - m_cellHeight) / m_cellHeight;
|
int height = (viewport()->size().height() - m_cellHeight) / m_cellHeight;
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
@ -209,38 +212,56 @@ void MemoryModel::paintEvent(QPaintEvent* event) {
|
|||||||
for (int x = 0; x < 16; x += 2) {
|
for (int x = 0; x < 16; x += 2) {
|
||||||
uint32_t address = (y + m_top) * 16 + x + m_base;
|
uint32_t address = (y + m_top) * 16 + x + m_base;
|
||||||
if (isInSelection(address)) {
|
if (isInSelection(address)) {
|
||||||
painter.fillRect(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), yp), QSizeF(m_cellSize.width() * 2, m_cellSize.height())), palette.highlight());
|
painter.fillRect(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), yp),
|
||||||
|
QSizeF(m_cellSize.width() * 2, m_cellSize.height())),
|
||||||
|
palette.highlight());
|
||||||
painter.setPen(palette.color(QPalette::HighlightedText));
|
painter.setPen(palette.color(QPalette::HighlightedText));
|
||||||
if (isEditing(address)) {
|
if (isEditing(address)) {
|
||||||
drawEditingText(painter, QPointF(m_cellSize.width() * (x + 1.0) - 2 * m_letterWidth + m_margins.left(), yp));
|
drawEditingText(
|
||||||
|
painter,
|
||||||
|
QPointF(m_cellSize.width() * (x + 1.0) - 2 * m_letterWidth + m_margins.left(), yp));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
painter.setPen(palette.color(QPalette::WindowText));
|
painter.setPen(palette.color(QPalette::WindowText));
|
||||||
}
|
}
|
||||||
uint16_t b = m_cpu->memory.load16(m_cpu, address, nullptr);
|
uint16_t b = m_cpu->memory.load16(m_cpu, address, nullptr);
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 1.0) - 2 * m_letterWidth + m_margins.left(), yp), m_staticNumbers[(b >> 8) & 0xFF]);
|
painter.drawStaticText(
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 1.0) + m_margins.left(), yp), m_staticNumbers[b & 0xFF]);
|
QPointF(m_cellSize.width() * (x + 1.0) - 2 * m_letterWidth + m_margins.left(), yp),
|
||||||
|
m_staticNumbers[(b >> 8) & 0xFF]);
|
||||||
|
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 1.0) + m_margins.left(), yp),
|
||||||
|
m_staticNumbers[b & 0xFF]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
for (int x = 0; x < 16; x += 4) {
|
for (int x = 0; x < 16; x += 4) {
|
||||||
uint32_t address = (y + m_top) * 16 + x + m_base;
|
uint32_t address = (y + m_top) * 16 + x + m_base;
|
||||||
if (isInSelection(address)) {
|
if (isInSelection(address)) {
|
||||||
painter.fillRect(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), yp), QSizeF(m_cellSize.width() * 4, m_cellSize.height())), palette.highlight());
|
painter.fillRect(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), yp),
|
||||||
|
QSizeF(m_cellSize.width() * 4, m_cellSize.height())),
|
||||||
|
palette.highlight());
|
||||||
painter.setPen(palette.color(QPalette::HighlightedText));
|
painter.setPen(palette.color(QPalette::HighlightedText));
|
||||||
if (isEditing(address)) {
|
if (isEditing(address)) {
|
||||||
drawEditingText(painter, QPointF(m_cellSize.width() * (x + 2.0) - 4 * m_letterWidth + m_margins.left(), yp));
|
drawEditingText(
|
||||||
|
painter,
|
||||||
|
QPointF(m_cellSize.width() * (x + 2.0) - 4 * m_letterWidth + m_margins.left(), yp));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
painter.setPen(palette.color(QPalette::WindowText));
|
painter.setPen(palette.color(QPalette::WindowText));
|
||||||
}
|
}
|
||||||
uint32_t b = m_cpu->memory.load32(m_cpu, address, nullptr);
|
uint32_t b = m_cpu->memory.load32(m_cpu, address, nullptr);
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 2.0) - 4 * m_letterWidth + m_margins.left(), yp), m_staticNumbers[(b >> 24) & 0xFF]);
|
painter.drawStaticText(
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 2.0) - 2 * m_letterWidth + m_margins.left(), yp), m_staticNumbers[(b >> 16) & 0xFF]);
|
QPointF(m_cellSize.width() * (x + 2.0) - 4 * m_letterWidth + m_margins.left(), yp),
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 2.0) + m_margins.left(), yp), m_staticNumbers[(b >> 8) & 0xFF]);
|
m_staticNumbers[(b >> 24) & 0xFF]);
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 2.0) + 2 * m_letterWidth + m_margins.left(), yp), m_staticNumbers[b & 0xFF]);
|
painter.drawStaticText(
|
||||||
|
QPointF(m_cellSize.width() * (x + 2.0) - 2 * m_letterWidth + m_margins.left(), yp),
|
||||||
|
m_staticNumbers[(b >> 16) & 0xFF]);
|
||||||
|
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 2.0) + m_margins.left(), yp),
|
||||||
|
m_staticNumbers[(b >> 8) & 0xFF]);
|
||||||
|
painter.drawStaticText(
|
||||||
|
QPointF(m_cellSize.width() * (x + 2.0) + 2 * m_letterWidth + m_margins.left(), yp),
|
||||||
|
m_staticNumbers[b & 0xFF]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -248,28 +269,34 @@ void MemoryModel::paintEvent(QPaintEvent* event) {
|
|||||||
for (int x = 0; x < 16; ++x) {
|
for (int x = 0; x < 16; ++x) {
|
||||||
uint32_t address = (y + m_top) * 16 + x + m_base;
|
uint32_t address = (y + m_top) * 16 + x + m_base;
|
||||||
if (isInSelection(address)) {
|
if (isInSelection(address)) {
|
||||||
painter.fillRect(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), yp), m_cellSize), palette.highlight());
|
painter.fillRect(QRectF(QPointF(m_cellSize.width() * x + m_margins.left(), yp), m_cellSize),
|
||||||
|
palette.highlight());
|
||||||
painter.setPen(palette.color(QPalette::HighlightedText));
|
painter.setPen(palette.color(QPalette::HighlightedText));
|
||||||
if (isEditing(address)) {
|
if (isEditing(address)) {
|
||||||
drawEditingText(painter, QPointF(m_cellSize.width() * (x + 0.5) - m_letterWidth + m_margins.left(), yp));
|
drawEditingText(painter,
|
||||||
|
QPointF(m_cellSize.width() * (x + 0.5) - m_letterWidth + m_margins.left(), yp));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
painter.setPen(palette.color(QPalette::WindowText));
|
painter.setPen(palette.color(QPalette::WindowText));
|
||||||
}
|
}
|
||||||
uint8_t b = m_cpu->memory.load8(m_cpu, address, nullptr);
|
uint8_t b = m_cpu->memory.load8(m_cpu, address, nullptr);
|
||||||
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 0.5) - m_letterWidth + m_margins.left(), yp), m_staticNumbers[b]);
|
painter.drawStaticText(QPointF(m_cellSize.width() * (x + 0.5) - m_letterWidth + m_margins.left(), yp),
|
||||||
|
m_staticNumbers[b]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
painter.setPen(palette.color(QPalette::WindowText));
|
painter.setPen(palette.color(QPalette::WindowText));
|
||||||
for (int x = 0; x < 16; ++x) {
|
for (int x = 0; x < 16; ++x) {
|
||||||
uint8_t b = m_cpu->memory.load8(m_cpu, (y + m_top) * 16 + x + m_base, nullptr);
|
uint8_t b = m_cpu->memory.load8(m_cpu, (y + m_top) * 16 + x + m_base, nullptr);
|
||||||
painter.drawStaticText(QPointF(viewport()->size().width() - (16 - x) * m_margins.right() / 17.0 - m_letterWidth * 0.5, yp), b < 0x80 ? m_staticAscii[b] : m_staticAscii[0]);
|
painter.drawStaticText(
|
||||||
|
QPointF(viewport()->size().width() - (16 - x) * m_margins.right() / 17.0 - m_letterWidth * 0.5, yp),
|
||||||
|
b < 0x80 ? m_staticAscii[b] : m_staticAscii[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
painter.drawLine(m_margins.left(), 0, m_margins.left(), viewport()->size().height());
|
painter.drawLine(m_margins.left(), 0, m_margins.left(), viewport()->size().height());
|
||||||
painter.drawLine(viewport()->size().width() - m_margins.right(), 0, viewport()->size().width() - m_margins.right(), viewport()->size().height());
|
painter.drawLine(viewport()->size().width() - m_margins.right(), 0, viewport()->size().width() - m_margins.right(),
|
||||||
|
viewport()->size().height());
|
||||||
painter.drawLine(0, m_margins.top(), viewport()->size().width(), m_margins.top());
|
painter.drawLine(0, m_margins.top(), viewport()->size().width(), m_margins.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,13 +309,15 @@ void MemoryModel::wheelEvent(QWheelEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MemoryModel::mousePressEvent(QMouseEvent* event) {
|
void MemoryModel::mousePressEvent(QMouseEvent* event) {
|
||||||
if (event->x() < m_margins.left() || event->y() < m_margins.top() || event->x() > size().width() - m_margins.right()) {
|
if (event->x() < m_margins.left() || event->y() < m_margins.top() ||
|
||||||
|
event->x() > size().width() - m_margins.right()) {
|
||||||
m_selection = qMakePair(0, 0);
|
m_selection = qMakePair(0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint position(event->pos() - QPoint(m_margins.left(), m_margins.top()));
|
QPoint position(event->pos() - QPoint(m_margins.left(), m_margins.top()));
|
||||||
uint32_t address = int(position.x() / m_cellSize.width()) + (int(position.y() / m_cellSize.height()) + m_top) * 16 + m_base;
|
uint32_t address =
|
||||||
|
int(position.x() / m_cellSize.width()) + (int(position.y() / m_cellSize.height()) + m_top) * 16 + m_base;
|
||||||
if (event->button() == Qt::RightButton && isInSelection(address)) {
|
if (event->button() == Qt::RightButton && isInSelection(address)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -301,12 +330,14 @@ void MemoryModel::mousePressEvent(QMouseEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MemoryModel::mouseMoveEvent(QMouseEvent* event) {
|
void MemoryModel::mouseMoveEvent(QMouseEvent* event) {
|
||||||
if (event->x() < m_margins.left() || event->y() < m_margins.top() || event->x() > size().width() - m_margins.right()) {
|
if (event->x() < m_margins.left() || event->y() < m_margins.top() ||
|
||||||
|
event->x() > size().width() - m_margins.right()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint position(event->pos() - QPoint(m_margins.left(), m_margins.top()));
|
QPoint position(event->pos() - QPoint(m_margins.left(), m_margins.top()));
|
||||||
uint32_t address = int(position.x() / m_cellSize.width()) + (int(position.y() / m_cellSize.height()) + m_top) * 16 + m_base;
|
uint32_t address =
|
||||||
|
int(position.x() / m_cellSize.width()) + (int(position.y() / m_cellSize.height()) + m_top) * 16 + m_base;
|
||||||
if ((address & ~(m_align - 1)) < m_selectionAnchor) {
|
if ((address & ~(m_align - 1)) < m_selectionAnchor) {
|
||||||
m_selection = qMakePair(address & ~(m_align - 1), m_selectionAnchor + m_align);
|
m_selection = qMakePair(address & ~(m_align - 1), m_selectionAnchor + m_align);
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,7 +87,8 @@ void OverrideView::updateOverrides() {
|
|||||||
m_override.idleLoop = parsedIdleLoop;
|
m_override.idleLoop = parsedIdleLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_override.savetype != SAVEDATA_AUTODETECT || m_override.hardware != HW_NO_OVERRIDE || m_override.idleLoop != IDLE_LOOP_NONE) {
|
if (m_override.savetype != SAVEDATA_AUTODETECT || m_override.hardware != HW_NO_OVERRIDE ||
|
||||||
|
m_override.idleLoop != IDLE_LOOP_NONE) {
|
||||||
m_controller->setOverride(m_override);
|
m_controller->setOverride(m_override);
|
||||||
} else {
|
} else {
|
||||||
m_controller->clearOverride();
|
m_controller->clearOverride();
|
||||||
@ -119,7 +120,6 @@ void OverrideView::gameStarted(GBAThread* thread) {
|
|||||||
m_ui.idleLoop->setText(QString::number(thread->gba->idleLoop, 16));
|
m_ui.idleLoop->setText(QString::number(thread->gba->idleLoop, 16));
|
||||||
} else {
|
} else {
|
||||||
m_ui.idleLoop->clear();
|
m_ui.idleLoop->clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GBAGetGameCode(thread->gba, m_override.id);
|
GBAGetGameCode(thread->gba, m_override.id);
|
||||||
|
@ -84,7 +84,8 @@ void PaletteView::exportPalette(int start, int length) {
|
|||||||
length = 512 - start;
|
length = 512 - start;
|
||||||
}
|
}
|
||||||
m_controller->threadInterrupt();
|
m_controller->threadInterrupt();
|
||||||
QFileDialog* dialog = GBAApp::app()->getSaveFileDialog(this, tr("Export palette"), tr("Windows PAL (*.pal);;Adobe Color Table (*.act)"));
|
QFileDialog* dialog = GBAApp::app()->getSaveFileDialog(this, tr("Export palette"),
|
||||||
|
tr("Windows PAL (*.pal);;Adobe Color Table (*.act)"));
|
||||||
if (!dialog->exec()) {
|
if (!dialog->exec()) {
|
||||||
m_controller->threadContinue();
|
m_controller->threadContinue();
|
||||||
return;
|
return;
|
||||||
|
@ -91,7 +91,8 @@ bool SensorView::eventFilter(QObject*, QEvent* event) {
|
|||||||
|
|
||||||
void SensorView::updateSensors() {
|
void SensorView::updateSensors() {
|
||||||
m_controller->threadInterrupt();
|
m_controller->threadInterrupt();
|
||||||
if (m_rotation->sample && (!m_controller->isLoaded() || !(m_controller->thread()->gba->memory.hw.devices & (HW_GYRO | HW_TILT)))) {
|
if (m_rotation->sample &&
|
||||||
|
(!m_controller->isLoaded() || !(m_controller->thread()->gba->memory.hw.devices & (HW_GYRO | HW_TILT)))) {
|
||||||
m_rotation->sample(m_rotation);
|
m_rotation->sample(m_rotation);
|
||||||
m_rotation->sample(m_rotation);
|
m_rotation->sample(m_rotation);
|
||||||
m_rotation->sample(m_rotation);
|
m_rotation->sample(m_rotation);
|
||||||
|
@ -118,10 +118,12 @@ void ShortcutController::addAction(QMenu* menu, QAction* action, const QString&
|
|||||||
if (m_config) {
|
if (m_config) {
|
||||||
loadShortcuts(item);
|
loadShortcuts(item);
|
||||||
}
|
}
|
||||||
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item), createIndex(smenu->items().count() - 1, 2, item));
|
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item),
|
||||||
|
createIndex(smenu->items().count() - 1, 2, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutController::addFunctions(QMenu* menu, std::function<void ()> press, std::function<void ()> release, const QKeySequence& shortcut, const QString& visibleName, const QString& name) {
|
void ShortcutController::addFunctions(QMenu* menu, std::function<void()> press, std::function<void()> release,
|
||||||
|
const QKeySequence& shortcut, const QString& visibleName, const QString& name) {
|
||||||
ShortcutItem* smenu = m_menuMap[menu];
|
ShortcutItem* smenu = m_menuMap[menu];
|
||||||
if (!smenu) {
|
if (!smenu) {
|
||||||
return;
|
return;
|
||||||
@ -137,7 +139,8 @@ void ShortcutController::addFunctions(QMenu* menu, std::function<void ()> press,
|
|||||||
loadShortcuts(item);
|
loadShortcuts(item);
|
||||||
}
|
}
|
||||||
m_heldKeys[shortcut] = item;
|
m_heldKeys[shortcut] = item;
|
||||||
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item), createIndex(smenu->items().count() - 1, 2, item));
|
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item),
|
||||||
|
createIndex(smenu->items().count() - 1, 2, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutController::addMenu(QMenu* menu, QMenu* parentMenu) {
|
void ShortcutController::addMenu(QMenu* menu, QMenu* parentMenu) {
|
||||||
@ -155,7 +158,8 @@ void ShortcutController::addMenu(QMenu* menu, QMenu* parentMenu) {
|
|||||||
smenu->addSubmenu(menu);
|
smenu->addSubmenu(menu);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
ShortcutItem* item = &smenu->items().last();
|
ShortcutItem* item = &smenu->items().last();
|
||||||
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item), createIndex(smenu->items().count() - 1, 2, item));
|
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item),
|
||||||
|
createIndex(smenu->items().count() - 1, 2, item));
|
||||||
m_menuMap[menu] = item;
|
m_menuMap[menu] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +215,8 @@ void ShortcutController::updateKey(const QModelIndex& index, const QKeySequence&
|
|||||||
if (m_config) {
|
if (m_config) {
|
||||||
m_config->setQtOption(item->name(), keySequence.toString(), KEY_SECTION);
|
m_config->setQtOption(item->name(), keySequence.toString(), KEY_SECTION);
|
||||||
}
|
}
|
||||||
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()), createIndex(index.row(), 2, index.internalPointer()));
|
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()),
|
||||||
|
createIndex(index.row(), 2, index.internalPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutController::updateButton(const QModelIndex& index, int button) {
|
void ShortcutController::updateButton(const QModelIndex& index, int button) {
|
||||||
@ -235,7 +240,8 @@ void ShortcutController::updateButton(const QModelIndex& index, int button) {
|
|||||||
if (m_config) {
|
if (m_config) {
|
||||||
m_config->setQtOption(item->name(), button, BUTTON_SECTION);
|
m_config->setQtOption(item->name(), button, BUTTON_SECTION);
|
||||||
}
|
}
|
||||||
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()), createIndex(index.row(), 2, index.internalPointer()));
|
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()),
|
||||||
|
createIndex(index.row(), 2, index.internalPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutController::updateAxis(const QModelIndex& index, int axis, GamepadAxisEvent::Direction direction) {
|
void ShortcutController::updateAxis(const QModelIndex& index, int axis, GamepadAxisEvent::Direction direction) {
|
||||||
@ -267,7 +273,8 @@ void ShortcutController::updateAxis(const QModelIndex& index, int axis, GamepadA
|
|||||||
}
|
}
|
||||||
m_config->setQtOption(item->name(), QString("%1%2").arg(d).arg(axis), AXIS_SECTION);
|
m_config->setQtOption(item->name(), QString("%1%2").arg(d).arg(axis), AXIS_SECTION);
|
||||||
}
|
}
|
||||||
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()), createIndex(index.row(), 2, index.internalPointer()));
|
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()),
|
||||||
|
createIndex(index.row(), 2, index.internalPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutController::clearKey(const QModelIndex& index) {
|
void ShortcutController::clearKey(const QModelIndex& index) {
|
||||||
@ -473,7 +480,9 @@ void ShortcutController::ShortcutItem::addAction(QAction* action, const QString&
|
|||||||
m_items.append(ShortcutItem(action, name, this));
|
m_items.append(ShortcutItem(action, name, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutController::ShortcutItem::addFunctions(ShortcutController::ShortcutItem::Functions functions, const QKeySequence& shortcut, const QString& visibleName, const QString& name) {
|
void ShortcutController::ShortcutItem::addFunctions(ShortcutController::ShortcutItem::Functions functions,
|
||||||
|
const QKeySequence& shortcut, const QString& visibleName,
|
||||||
|
const QString& name) {
|
||||||
m_items.append(ShortcutItem(functions, shortcut, visibleName, name, this));
|
m_items.append(ShortcutItem(functions, shortcut, visibleName, name, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ private:
|
|||||||
typedef QPair<std::function<void ()>, std::function<void ()>> Functions;
|
typedef QPair<std::function<void ()>, std::function<void ()>> Functions;
|
||||||
|
|
||||||
ShortcutItem(QAction* action, const QString& name, ShortcutItem* parent = nullptr);
|
ShortcutItem(QAction* action, const QString& name, ShortcutItem* parent = nullptr);
|
||||||
ShortcutItem(Functions functions, const QKeySequence& shortcut, const QString& visibleName, const QString& name, ShortcutItem* parent = nullptr);
|
ShortcutItem(Functions functions, const QKeySequence& shortcut, const QString& visibleName, const QString& name,
|
||||||
|
ShortcutItem* parent = nullptr);
|
||||||
ShortcutItem(QMenu* action, ShortcutItem* parent = nullptr);
|
ShortcutItem(QMenu* action, ShortcutItem* parent = nullptr);
|
||||||
|
|
||||||
QAction* action() { return m_action; }
|
QAction* action() { return m_action; }
|
||||||
@ -51,7 +52,8 @@ private:
|
|||||||
ShortcutItem* parent() { return m_parent; }
|
ShortcutItem* parent() { return m_parent; }
|
||||||
const ShortcutItem* parent() const { return m_parent; }
|
const ShortcutItem* parent() const { return m_parent; }
|
||||||
void addAction(QAction* action, const QString& name);
|
void addAction(QAction* action, const QString& name);
|
||||||
void addFunctions(Functions functions, const QKeySequence& shortcut, const QString& visibleName, const QString& name);
|
void addFunctions(Functions functions, const QKeySequence& shortcut, const QString& visibleName,
|
||||||
|
const QString& name);
|
||||||
void addSubmenu(QMenu* menu);
|
void addSubmenu(QMenu* menu);
|
||||||
int button() const { return m_button; }
|
int button() const { return m_button; }
|
||||||
void setShortcut(const QKeySequence& sequence);
|
void setShortcut(const QKeySequence& sequence);
|
||||||
@ -60,7 +62,9 @@ private:
|
|||||||
GamepadAxisEvent::Direction direction() const { return m_direction; }
|
GamepadAxisEvent::Direction direction() const { return m_direction; }
|
||||||
void setAxis(int axis, GamepadAxisEvent::Direction direction);
|
void setAxis(int axis, GamepadAxisEvent::Direction direction);
|
||||||
|
|
||||||
bool operator==(const ShortcutItem& other) const { return m_menu == other.m_menu && m_action == other.m_action; }
|
bool operator==(const ShortcutItem& other) const {
|
||||||
|
return m_menu == other.m_menu && m_action == other.m_action;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAction* m_action;
|
QAction* m_action;
|
||||||
@ -91,7 +95,8 @@ public:
|
|||||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
|
|
||||||
void addAction(QMenu* menu, QAction* action, const QString& name);
|
void addAction(QMenu* menu, QAction* action, const QString& name);
|
||||||
void addFunctions(QMenu* menu, std::function<void ()> press, std::function<void()> release, const QKeySequence& shortcut, const QString& visibleName, const QString& name);
|
void addFunctions(QMenu* menu, std::function<void()> press, std::function<void()> release,
|
||||||
|
const QKeySequence& shortcut, const QString& visibleName, const QString& name);
|
||||||
void addMenu(QMenu* menu, QMenu* parent = nullptr);
|
void addMenu(QMenu* menu, QMenu* parent = nullptr);
|
||||||
|
|
||||||
QKeySequence shortcutAt(const QModelIndex& index) const;
|
QKeySequence shortcutAt(const QModelIndex& index) const;
|
||||||
|
@ -104,10 +104,10 @@ void ShortcutView::updateButton(int button) {
|
|||||||
m_controller->updateButton(m_ui.shortcutTable->selectionModel()->currentIndex(), button);
|
m_controller->updateButton(m_ui.shortcutTable->selectionModel()->currentIndex(), button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ShortcutView::updateAxis(int axis, int direction) {
|
void ShortcutView::updateAxis(int axis, int direction) {
|
||||||
if (!m_controller || m_controller->isMenuAt(m_ui.shortcutTable->selectionModel()->currentIndex())) {
|
if (!m_controller || m_controller->isMenuAt(m_ui.shortcutTable->selectionModel()->currentIndex())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_controller->updateAxis(m_ui.shortcutTable->selectionModel()->currentIndex(), axis, static_cast<GamepadAxisEvent::Direction>(direction));
|
m_controller->updateAxis(m_ui.shortcutTable->selectionModel()->currentIndex(), axis,
|
||||||
|
static_cast<GamepadAxisEvent::Direction>(direction));
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ void Window::gameStarted(GBAThread* context) {
|
|||||||
attachWidget(m_display);
|
attachWidget(m_display);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
if(isFullScreen()) {
|
if (isFullScreen()) {
|
||||||
menuBar()->hide();
|
menuBar()->hide();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -532,16 +532,16 @@ void Window::gameStopped() {
|
|||||||
|
|
||||||
void Window::gameCrashed(const QString& errorMessage) {
|
void Window::gameCrashed(const QString& errorMessage) {
|
||||||
QMessageBox* crash = new QMessageBox(QMessageBox::Critical, tr("Crash"),
|
QMessageBox* crash = new QMessageBox(QMessageBox::Critical, tr("Crash"),
|
||||||
tr("The game has crashed with the following error:\n\n%1").arg(errorMessage),
|
tr("The game has crashed with the following error:\n\n%1").arg(errorMessage),
|
||||||
QMessageBox::Ok, this, Qt::Sheet);
|
QMessageBox::Ok, this, Qt::Sheet);
|
||||||
crash->setAttribute(Qt::WA_DeleteOnClose);
|
crash->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
crash->show();
|
crash->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::gameFailed() {
|
void Window::gameFailed() {
|
||||||
QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("Couldn't Load"),
|
QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("Couldn't Load"),
|
||||||
tr("Could not load game. Are you sure it's in the correct format?"),
|
tr("Could not load game. Are you sure it's in the correct format?"),
|
||||||
QMessageBox::Ok, this, Qt::Sheet);
|
QMessageBox::Ok, this, Qt::Sheet);
|
||||||
fail->setAttribute(Qt::WA_DeleteOnClose);
|
fail->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
fail->show();
|
fail->show();
|
||||||
}
|
}
|
||||||
@ -552,9 +552,10 @@ void Window::unimplementedBiosCall(int call) {
|
|||||||
}
|
}
|
||||||
m_hitUnimplementedBiosCall = true;
|
m_hitUnimplementedBiosCall = true;
|
||||||
|
|
||||||
QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("Unimplemented BIOS call"),
|
QMessageBox* fail = new QMessageBox(
|
||||||
tr("This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience."),
|
QMessageBox::Warning, tr("Unimplemented BIOS call"),
|
||||||
QMessageBox::Ok, this, Qt::Sheet);
|
tr("This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience."),
|
||||||
|
QMessageBox::Ok, this, Qt::Sheet);
|
||||||
fail->setAttribute(Qt::WA_DeleteOnClose);
|
fail->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
fail->show();
|
fail->show();
|
||||||
}
|
}
|
||||||
@ -628,7 +629,8 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||||||
QMenu* fileMenu = menubar->addMenu(tr("&File"));
|
QMenu* fileMenu = menubar->addMenu(tr("&File"));
|
||||||
m_shortcutController->addMenu(fileMenu);
|
m_shortcutController->addMenu(fileMenu);
|
||||||
installEventFilter(m_shortcutController);
|
installEventFilter(m_shortcutController);
|
||||||
addControlledAction(fileMenu, fileMenu->addAction(tr("Load &ROM..."), this, SLOT(selectROM()), QKeySequence::Open), "loadROM");
|
addControlledAction(fileMenu, fileMenu->addAction(tr("Load &ROM..."), this, SLOT(selectROM()), QKeySequence::Open),
|
||||||
|
"loadROM");
|
||||||
addControlledAction(fileMenu, fileMenu->addAction(tr("Load &BIOS..."), this, SLOT(selectBIOS())), "loadBIOS");
|
addControlledAction(fileMenu, fileMenu->addAction(tr("Load &BIOS..."), this, SLOT(selectBIOS())), "loadBIOS");
|
||||||
addControlledAction(fileMenu, fileMenu->addAction(tr("Load &patch..."), this, SLOT(selectPatch())), "loadPatch");
|
addControlledAction(fileMenu, fileMenu->addAction(tr("Load &patch..."), this, SLOT(selectPatch())), "loadPatch");
|
||||||
addControlledAction(fileMenu, fileMenu->addAction(tr("Boot BIOS"), m_controller, SLOT(bootBIOS())), "bootBIOS");
|
addControlledAction(fileMenu, fileMenu->addAction(tr("Boot BIOS"), m_controller, SLOT(bootBIOS())), "bootBIOS");
|
||||||
@ -733,7 +735,8 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||||||
connect(m_controller, &GameController::gamePaused, [this, pause]() {
|
connect(m_controller, &GameController::gamePaused, [this, pause]() {
|
||||||
pause->setChecked(true);
|
pause->setChecked(true);
|
||||||
|
|
||||||
QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, 1024, QImage::Format_RGB32);
|
QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), VIDEO_HORIZONTAL_PIXELS,
|
||||||
|
VIDEO_VERTICAL_PIXELS, 1024, QImage::Format_RGB32);
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
pixmap.convertFromImage(currentImage.rgbSwapped());
|
pixmap.convertFromImage(currentImage.rgbSwapped());
|
||||||
m_screenWidget->setPixmap(pixmap);
|
m_screenWidget->setPixmap(pixmap);
|
||||||
@ -1010,8 +1013,10 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
toolsMenu->addSeparator();
|
toolsMenu->addSeparator();
|
||||||
addControlledAction(toolsMenu, toolsMenu->addAction(tr("Settings..."), this, SLOT(openSettingsWindow())), "settings");
|
addControlledAction(toolsMenu, toolsMenu->addAction(tr("Settings..."), this, SLOT(openSettingsWindow())),
|
||||||
addControlledAction(toolsMenu, toolsMenu->addAction(tr("Edit shortcuts..."), this, SLOT(openShortcutWindow())), "shortcuts");
|
"settings");
|
||||||
|
addControlledAction(toolsMenu, toolsMenu->addAction(tr("Edit shortcuts..."), this, SLOT(openShortcutWindow())),
|
||||||
|
"shortcuts");
|
||||||
|
|
||||||
QAction* keymap = new QAction(tr("Remap keyboard..."), toolsMenu);
|
QAction* keymap = new QAction(tr("Remap keyboard..."), toolsMenu);
|
||||||
connect(keymap, SIGNAL(triggered()), this, SLOT(openKeymapWindow()));
|
connect(keymap, SIGNAL(triggered()), this, SLOT(openKeymapWindow()));
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
#ifdef QT_STATIC
|
#ifdef QT_STATIC
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin);
|
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||||
Q_IMPORT_PLUGIN (QWindowsAudioPlugin);
|
Q_IMPORT_PLUGIN(QWindowsAudioPlugin);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QGBA::GBAApp application(argc, argv);
|
QGBA::GBAApp application(argc, argv);
|
||||||
return application.exec();
|
return application.exec();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,6 @@ void GBASDLPauseAudio(struct GBASDLAudio* context) {
|
|||||||
UNUSED(context);
|
UNUSED(context);
|
||||||
SDL_PauseAudio(1);
|
SDL_PauseAudio(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASDLResumeAudio(struct GBASDLAudio* context) {
|
void GBASDLResumeAudio(struct GBASDLAudio* context) {
|
||||||
|
@ -65,7 +65,7 @@ bool GBASDLSWInit(struct SDLSoftwareRenderer* renderer) {
|
|||||||
pixman_format_code_t format = PIXMAN_x8b8g8r8;
|
pixman_format_code_t format = PIXMAN_x8b8g8r8;
|
||||||
#endif
|
#endif
|
||||||
renderer->pix = pixman_image_create_bits(format, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS,
|
renderer->pix = pixman_image_create_bits(format, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS,
|
||||||
renderer->d.outputBuffer, renderer->d.outputBufferStride * BYTES_PER_PIXEL);
|
renderer->d.outputBuffer, renderer->d.outputBufferStride * BYTES_PER_PIXEL);
|
||||||
renderer->screenpix = pixman_image_create_bits(format, renderer->viewportWidth, renderer->viewportHeight, surface->pixels, surface->pitch);
|
renderer->screenpix = pixman_image_create_bits(format, renderer->viewportWidth, renderer->viewportHeight, surface->pixels, surface->pitch);
|
||||||
|
|
||||||
pixman_transform_t transform;
|
pixman_transform_t transform;
|
||||||
@ -104,8 +104,8 @@ void GBASDLSWRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* rend
|
|||||||
#ifdef USE_PIXMAN
|
#ifdef USE_PIXMAN
|
||||||
if (renderer->ratio > 1) {
|
if (renderer->ratio > 1) {
|
||||||
pixman_image_composite32(PIXMAN_OP_SRC, renderer->pix, 0, renderer->screenpix,
|
pixman_image_composite32(PIXMAN_OP_SRC, renderer->pix, 0, renderer->screenpix,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
renderer->viewportWidth, renderer->viewportHeight);
|
renderer->viewportWidth, renderer->viewportHeight);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch (renderer->ratio) {
|
switch (renderer->ratio) {
|
||||||
|
@ -110,7 +110,6 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress)
|
|||||||
bindInfo.sin6_port = htons(port);
|
bindInfo.sin6_port = htons(port);
|
||||||
memcpy(bindInfo.sin6_addr.s6_addr, bindAddress->ipv6, sizeof(bindInfo.sin6_addr.s6_addr));
|
memcpy(bindInfo.sin6_addr.s6_addr, bindAddress->ipv6, sizeof(bindInfo.sin6_addr.s6_addr));
|
||||||
err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo));
|
err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo));
|
||||||
|
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
close(sock);
|
close(sock);
|
||||||
|
@ -70,8 +70,10 @@ struct VDir* VDirOpenZip(const char* path, int flags);
|
|||||||
struct VDir* VDirOpen7z(const char* path, int flags);
|
struct VDir* VDirOpen7z(const char* path, int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct VFile* VDirOptionalOpenFile(struct VDir* dir, const char* realPath, const char* prefix, const char* suffix, int mode);
|
struct VFile* VDirOptionalOpenFile(struct VDir* dir, const char* realPath, const char* prefix, const char* suffix,
|
||||||
struct VFile* VDirOptionalOpenIncrementFile(struct VDir* dir, const char* realPath, const char* prefix, const char* infix, const char* suffix, int mode);
|
int mode);
|
||||||
|
struct VFile* VDirOptionalOpenIncrementFile(struct VDir* dir, const char* realPath, const char* prefix,
|
||||||
|
const char* infix, const char* suffix, int mode);
|
||||||
|
|
||||||
ssize_t VFileReadline(struct VFile* vf, char* buffer, size_t size);
|
ssize_t VFileReadline(struct VFile* vf, char* buffer, size_t size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user