Making arkanoid input support optional (as it hurts performance
This commit is contained in:
parent
482687539e
commit
831ad3908a
|
@ -22,7 +22,7 @@ jobs:
|
|||
- name: Installing apt packages
|
||||
run: sudo apt install libgtest-dev gcovr libtbb-dev libsdl2-dev libsdl2-image-dev
|
||||
- name: Run meson configuration
|
||||
run: meson setup build -DonlyOpenSource=true
|
||||
run: meson setup build -DonlyOpenSource=true -DenableArkanoidInputs=true
|
||||
- name: Building project
|
||||
run: ninja -C build
|
||||
- name: Running tests
|
||||
|
|
|
@ -26,3 +26,9 @@ option('onlyOpenSource',
|
|||
yield: true
|
||||
)
|
||||
|
||||
option('enableArkanoidInputs',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Build tests',
|
||||
yield: true
|
||||
)
|
|
@ -719,6 +719,7 @@ class Core : private Cpu
|
|||
|
||||
void setControllerType(controllerType_t type) { _controllerType = type; }
|
||||
|
||||
#ifdef _QUICKERNES_SUPPORT_ARKANOID_INPUTS
|
||||
int read_io(nes_addr_t addr)
|
||||
{
|
||||
if ((addr & 0xFFFE) == 0x4016)
|
||||
|
@ -761,10 +762,10 @@ class Core : private Cpu
|
|||
// latch 0 encodes fire
|
||||
uint8_t result = (input_state.arkanoid_fire & 1) * 2;
|
||||
|
||||
// latch 0 also encodes joypad 1
|
||||
// latch 0 also encodes input_state 1
|
||||
result += (input_state.joypad_latches[0] & 1) & 1;
|
||||
|
||||
// Advancing joypad latch
|
||||
// Advancing input_state latch
|
||||
input_state.joypad_latches[0] >>= 1;
|
||||
|
||||
return result;
|
||||
|
@ -792,6 +793,26 @@ class Core : private Cpu
|
|||
|
||||
return addr >> 8; // simulate open bus
|
||||
}
|
||||
#else
|
||||
int read_io(nes_addr_t addr)
|
||||
{
|
||||
if ((addr & 0xFFFE) == 0x4016)
|
||||
{
|
||||
// to do: to aid with recording, doesn't emulate transparent latch,
|
||||
// so a game that held strobe at 1 and read $4016 or $4017 would not get
|
||||
// the current A status as occurs on a NES
|
||||
if (input_state.w4016 & 1) return 0;
|
||||
const uint8_t result = input_state.joypad_latches[addr & 1] & 1;
|
||||
input_state.joypad_latches[addr & 1] >>= 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (addr == Apu::status_addr)
|
||||
return impl->apu.read_status(clock());
|
||||
|
||||
return addr >> 8; // simulate open bus
|
||||
}
|
||||
#endif
|
||||
|
||||
void write_io(nes_addr_t addr, int data)
|
||||
{
|
||||
|
|
|
@ -28,10 +28,17 @@ quickerNESSrc = quickerNESAPUSrc + quickerNESPPUSrc + [
|
|||
'core/cpu.cpp'
|
||||
]
|
||||
|
||||
quickerNESCompileArgs = [ ]
|
||||
|
||||
# Checking for arkanoid input support
|
||||
if get_option('enableArkanoidInputs') == true
|
||||
quickerNESCompileArgs += '-D_QUICKERNES_SUPPORT_ARKANOID_INPUTS'
|
||||
endif
|
||||
|
||||
# quickerNES Core Configuration
|
||||
|
||||
quickerNESDependency = declare_dependency(
|
||||
compile_args : [ ],
|
||||
compile_args : quickerNESCompileArgs,
|
||||
include_directories : include_directories(['.', '..']),
|
||||
sources : [ quickerNESSrc ],
|
||||
dependencies : [
|
||||
|
|
|
@ -92,6 +92,8 @@ if get_option('onlyOpenSource') == false
|
|||
args : [ testFile, '--cycleType', 'Full'],
|
||||
suite : [ testSuite ])
|
||||
|
||||
if get_option('enableArkanoidInputs') == true
|
||||
|
||||
testFile = 'arkanoid.arkNESController.test'
|
||||
testSuite = testFile.split('.')[0]
|
||||
testName = testFile.split('.')[1]
|
||||
|
@ -111,4 +113,6 @@ if get_option('onlyOpenSource') == false
|
|||
timeout: testTimeout,
|
||||
args : [ testFile, '--cycleType', 'Full'],
|
||||
suite : [ testSuite ])
|
||||
|
||||
endif
|
||||
endif
|
Loading…
Reference in New Issue