mirror of https://github.com/mgba-emu/mgba.git
All: Add clang-format options and run them
This commit is contained in:
parent
3ba13e9286
commit
908e61f415
|
@ -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,7 +42,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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,14 +63,16 @@ 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;
|
||||||
|
@ -123,24 +130,29 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
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) && \
|
||||||
|
(renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN)) { \
|
||||||
objwinPalette = renderer->variantPalette; \
|
objwinPalette = renderer->variantPalette; \
|
||||||
} \
|
} \
|
||||||
switch (background->index) { \
|
switch (background->index) { \
|
||||||
case 0: \
|
case 0: \
|
||||||
objwinForceEnable = GBAWindowControlIsBg0Enable(renderer->objwin.packed) && GBAWindowControlIsBg0Enable(renderer->currentWindow.packed); \
|
objwinForceEnable = GBAWindowControlIsBg0Enable(renderer->objwin.packed) && \
|
||||||
|
GBAWindowControlIsBg0Enable(renderer->currentWindow.packed); \
|
||||||
objwinOnly = !GBAWindowControlIsBg0Enable(renderer->objwin.packed); \
|
objwinOnly = !GBAWindowControlIsBg0Enable(renderer->objwin.packed); \
|
||||||
break; \
|
break; \
|
||||||
case 1: \
|
case 1: \
|
||||||
objwinForceEnable = GBAWindowControlIsBg1Enable(renderer->objwin.packed) && GBAWindowControlIsBg1Enable(renderer->currentWindow.packed); \
|
objwinForceEnable = GBAWindowControlIsBg1Enable(renderer->objwin.packed) && \
|
||||||
|
GBAWindowControlIsBg1Enable(renderer->currentWindow.packed); \
|
||||||
objwinOnly = !GBAWindowControlIsBg1Enable(renderer->objwin.packed); \
|
objwinOnly = !GBAWindowControlIsBg1Enable(renderer->objwin.packed); \
|
||||||
break; \
|
break; \
|
||||||
case 2: \
|
case 2: \
|
||||||
objwinForceEnable = GBAWindowControlIsBg2Enable(renderer->objwin.packed) && GBAWindowControlIsBg2Enable(renderer->currentWindow.packed); \
|
objwinForceEnable = GBAWindowControlIsBg2Enable(renderer->objwin.packed) && \
|
||||||
|
GBAWindowControlIsBg2Enable(renderer->currentWindow.packed); \
|
||||||
objwinOnly = !GBAWindowControlIsBg2Enable(renderer->objwin.packed); \
|
objwinOnly = !GBAWindowControlIsBg2Enable(renderer->objwin.packed); \
|
||||||
break; \
|
break; \
|
||||||
case 3: \
|
case 3: \
|
||||||
objwinForceEnable = GBAWindowControlIsBg3Enable(renderer->objwin.packed) && GBAWindowControlIsBg3Enable(renderer->currentWindow.packed); \
|
objwinForceEnable = GBAWindowControlIsBg3Enable(renderer->objwin.packed) && \
|
||||||
|
GBAWindowControlIsBg3Enable(renderer->currentWindow.packed); \
|
||||||
objwinOnly = !GBAWindowControlIsBg3Enable(renderer->objwin.packed); \
|
objwinOnly = !GBAWindowControlIsBg3Enable(renderer->objwin.packed); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
@ -163,14 +175,17 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
\
|
\
|
||||||
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 && \
|
||||||
|
GBAWindowControlIsBlendEnable(renderer->objwin.packed)); \
|
||||||
objwinFlags |= flags; \
|
objwinFlags |= flags; \
|
||||||
flags |= FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed)); \
|
flags |= FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA && \
|
||||||
|
GBAWindowControlIsBlendEnable(renderer->currentWindow.packed)); \
|
||||||
if (renderer->blda == 0x10 && renderer->bldb == 0) { \
|
if (renderer->blda == 0x10 && renderer->bldb == 0) { \
|
||||||
flags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
flags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
||||||
objwinFlags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
objwinFlags &= ~(FLAG_TARGET_1 | FLAG_TARGET_2); \
|
||||||
} \
|
} \
|
||||||
int variant = background->target1 && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed) && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); \
|
int variant = background->target1 && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed) && \
|
||||||
|
(renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); \
|
||||||
color_t* palette = renderer->normalPalette; \
|
color_t* palette = renderer->normalPalette; \
|
||||||
if (variant) { \
|
if (variant) { \
|
||||||
palette = renderer->variantPalette; \
|
palette = renderer->variantPalette; \
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,8 +106,7 @@ 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;
|
||||||
|
|
|
@ -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
|
||||||
|
@ -552,7 +552,8 @@ 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(
|
||||||
|
QMessageBox::Warning, tr("Unimplemented BIOS call"),
|
||||||
tr("This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience."),
|
tr("This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience."),
|
||||||
QMessageBox::Ok, this, Qt::Sheet);
|
QMessageBox::Ok, this, Qt::Sheet);
|
||||||
fail->setAttribute(Qt::WA_DeleteOnClose);
|
fail->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -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,8 +9,8 @@
|
||||||
#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
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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