use platform.isConsole(), platform.isNaomi(), ...
This commit is contained in:
parent
965dea5fe6
commit
e5d517dad2
|
@ -371,7 +371,7 @@ void CheatManager::reset(const std::string& gameId)
|
|||
widescreen_cheat = nullptr;
|
||||
if (!config::WidescreenGameHacks)
|
||||
return;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
for (int i = 0; widescreen_cheats[i].game_id != nullptr; i++)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ settings_t settings;
|
|||
|
||||
static void loadSpecialSettings()
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
std::string prod_id(ip_meta.product_number, sizeof(ip_meta.product_number));
|
||||
prod_id = trim_trailing_ws(prod_id);
|
||||
|
@ -217,9 +217,7 @@ static void loadSpecialSettings()
|
|||
config::UseReios.override(false);
|
||||
}
|
||||
}
|
||||
else if (settings.platform.system == DC_PLATFORM_NAOMI
|
||||
|| settings.platform.system == DC_PLATFORM_NAOMI2
|
||||
|| settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
else if (settings.platform.isArcade())
|
||||
{
|
||||
NOTICE_LOG(BOOT, "Game ID is [%s]", naomi_game_id);
|
||||
if (!strcmp("SAMURAI SPIRITS 6", naomi_game_id))
|
||||
|
@ -459,7 +457,7 @@ void Emulator::loadGame(const char *path, LoadProgress *progress)
|
|||
config::Settings::instance().load(false);
|
||||
memset(&settings.network.md5, 0, sizeof(settings.network.md5));
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
if (settings.content.path.empty())
|
||||
{
|
||||
|
@ -500,9 +498,7 @@ void Emulator::loadGame(const char *path, LoadProgress *progress)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (settings.platform.system == DC_PLATFORM_NAOMI
|
||||
|| settings.platform.system == DC_PLATFORM_NAOMI2
|
||||
|| settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
else if (settings.platform.isArcade())
|
||||
{
|
||||
LoadRomFiles();
|
||||
naomi_cart_LoadRom(path, progress);
|
||||
|
@ -628,7 +624,7 @@ void Emulator::requestReset()
|
|||
void loadGameSpecificSettings()
|
||||
{
|
||||
char *reios_id;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
static char _disk_id[sizeof(ip_meta.product_number) + 1];
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ void asic_reg_Reset(bool hard)
|
|||
sb_rio_register(SB_ISTEXT_addr, RIO_WF, 0, &Write_SB_ISTEXT);
|
||||
sb_rio_register(SB_ISTERR_addr, RIO_WF, 0, &Write_SB_ISTERR);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi2())
|
||||
{
|
||||
sb_rio_register(SB_ISTNRM_addr, RIO_FUNC, &Read_SB_ISTNRM<true>, &Write_SB_ISTNRM<true>);
|
||||
|
||||
|
|
|
@ -757,7 +757,7 @@ void sb_Reset(bool hard)
|
|||
ModemReset();
|
||||
|
||||
asic_reg_Reset(hard);
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
gdrom_reg_Reset(hard);
|
||||
else
|
||||
naomi_reg_Reset(hard);
|
||||
|
|
|
@ -109,7 +109,7 @@ static void add_isp_to_nvmem(DCFlashChip *flash)
|
|||
|
||||
static void fixUpDCFlash()
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
static_cast<DCFlashChip*>(sys_nvmem)->Validate();
|
||||
|
||||
|
@ -172,7 +172,7 @@ static void fixUpDCFlash()
|
|||
static bool nvmem_load()
|
||||
{
|
||||
bool rc;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
rc = sys_nvmem->Load(getRomPrefix(), "%nvmem.bin", "nvram");
|
||||
else
|
||||
rc = sys_nvmem->Load(hostfs::getArcadeFlashPath() + ".nvmem");
|
||||
|
@ -182,7 +182,7 @@ static bool nvmem_load()
|
|||
if (config::GGPOEnable)
|
||||
sys_nvmem->digest(settings.network.md5.nvmem);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
if (settings.platform.isAtomiswave())
|
||||
{
|
||||
sys_rom->Load(hostfs::getArcadeFlashPath() + ".nvmem2");
|
||||
if (config::GGPOEnable)
|
||||
|
@ -195,7 +195,7 @@ static bool nvmem_load()
|
|||
bool LoadRomFiles()
|
||||
{
|
||||
nvmem_load();
|
||||
if (settings.platform.system != DC_PLATFORM_ATOMISWAVE)
|
||||
if (!settings.platform.isAtomiswave())
|
||||
{
|
||||
if (sys_rom->Load(getRomPrefix(), "%boot.bin;%boot.bin.bin;%bios.bin;%bios.bin.bin", "bootrom"))
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ bool LoadRomFiles()
|
|||
sys_rom->digest(settings.network.md5.bios);
|
||||
bios_loaded = true;
|
||||
}
|
||||
else if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
else if (settings.platform.isConsole())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -212,11 +212,11 @@ bool LoadRomFiles()
|
|||
|
||||
void SaveRomFiles()
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
sys_nvmem->Save(getRomPrefix(), "nvmem.bin", "nvmem");
|
||||
else
|
||||
sys_nvmem->Save(hostfs::getArcadeFlashPath() + ".nvmem");
|
||||
if (settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
if (settings.platform.isAtomiswave())
|
||||
((WritableChip *)sys_rom)->Save(hostfs::getArcadeFlashPath() + ".nvmem2");
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void MapleConfigMap::GetInput(PlainJoystickState* pjs)
|
|||
{
|
||||
const MapleInputState& inputState = mapleInputState[playerNum()];
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
pjs->kcode = inputState.kcode;
|
||||
pjs->joy[PJAI_X1] = GetBtFromSgn(inputState.fullAxes[PJAI_X1]);
|
||||
|
@ -79,7 +79,7 @@ void MapleConfigMap::GetInput(PlainJoystickState* pjs)
|
|||
pjs->trigger[PJTI_R] = inputState.halfAxes[PJTI_R];
|
||||
pjs->trigger[PJTI_L] = inputState.halfAxes[PJTI_L];
|
||||
}
|
||||
else if (settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
else if (settings.platform.isAtomiswave())
|
||||
{
|
||||
#ifdef LIBRETRO
|
||||
pjs->kcode = inputState.kcode;
|
||||
|
|
|
@ -1331,7 +1331,7 @@ maple_device* maple_Create(MapleDeviceType type)
|
|||
switch(type)
|
||||
{
|
||||
case MDT_SegaController:
|
||||
if (settings.platform.system != DC_PLATFORM_ATOMISWAVE)
|
||||
if (!settings.platform.isAtomiswave())
|
||||
rv = new maple_sega_controller();
|
||||
else
|
||||
rv = new maple_atomiswave_controller();
|
||||
|
@ -1358,7 +1358,7 @@ maple_device* maple_Create(MapleDeviceType type)
|
|||
break;
|
||||
|
||||
case MDT_LightGun:
|
||||
if (settings.platform.system != DC_PLATFORM_ATOMISWAVE)
|
||||
if (!settings.platform.isAtomiswave())
|
||||
rv = new maple_lightgun();
|
||||
else
|
||||
rv = new atomiswave_lightgun();
|
||||
|
|
|
@ -66,7 +66,7 @@ void maple_vblank()
|
|||
maple_ddt_pending_reset = false;
|
||||
}
|
||||
}
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
maple_handle_reconnect();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ const char *GetCurrentGameButtonName(DreamcastKey key)
|
|||
val >>= 1;
|
||||
}
|
||||
u32 arcade_key;
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi())
|
||||
{
|
||||
if (pos >= ARRAY_SIZE(naomi_button_mapping))
|
||||
return nullptr;
|
||||
|
|
|
@ -367,6 +367,10 @@ void naomi_process(u32 command, u32 offsetl, u32 parameterl, u32 parameterh)
|
|||
DEBUG_LOG(NAOMI, "Naomi process 0x%04X 0x%04X 0x%04X 0x%04X", command, offsetl, parameterl, parameterh);
|
||||
DEBUG_LOG(NAOMI, "Possible format 0 %d 0x%02X 0x%04X",command >> 15,(command & 0x7e00) >> 9, command & 0x1FF);
|
||||
DEBUG_LOG(NAOMI, "Possible format 1 0x%02X 0x%02X", (command & 0xFF00) >> 8,command & 0xFF);
|
||||
// command: param1 & 3f << 9 | param2
|
||||
// offsetl, paraml, paramh: params 3 4 5
|
||||
// HOLLY::SB_IML2EXT |= 8 when done
|
||||
|
||||
|
||||
u32 param=(command&0xFF);
|
||||
if (param==0xFF)
|
||||
|
@ -407,7 +411,7 @@ void WriteMem_naomi(u32 address, u32 data, u32 size)
|
|||
return;
|
||||
}
|
||||
if (address >= NAOMI_COMM2_CTRL_addr && address <= NAOMI_COMM2_STATUS1_addr
|
||||
&& (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_NAOMI2))
|
||||
&& settings.platform.isNaomi())
|
||||
m3comm.WriteMem(address, data, size);
|
||||
else
|
||||
CurrentCartridge->WriteMem(address, data, size);
|
||||
|
|
|
@ -150,7 +150,7 @@ static bool loadBios(const char *filename, Archive *child_archive, Archive *pare
|
|||
if (config::GGPOEnable)
|
||||
md5.getDigest(settings.network.md5.bios);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
if (settings.platform.isAtomiswave())
|
||||
// Reload the writeable portion of the FlashROM
|
||||
sys_rom->Reload();
|
||||
|
||||
|
|
|
@ -1437,7 +1437,7 @@ void vmem_map(u32 base)
|
|||
|
||||
void serialize(Serializer& ser)
|
||||
{
|
||||
if (settings.platform.system != DC_PLATFORM_NAOMI2)
|
||||
if (!settings.platform.isNaomi2())
|
||||
return;
|
||||
ser << reg10;
|
||||
ser << reg74;
|
||||
|
@ -1449,7 +1449,7 @@ void serialize(Serializer& ser)
|
|||
|
||||
void deserialize(Deserializer& deser)
|
||||
{
|
||||
if (settings.platform.system != DC_PLATFORM_NAOMI2)
|
||||
if (!settings.platform.isNaomi2())
|
||||
return;
|
||||
deser >> reg10;
|
||||
deser >> reg74;
|
||||
|
|
|
@ -285,7 +285,7 @@ void read_lightgun_position(int x, int y)
|
|||
|
||||
int rend_end_sch(int tag, int cycl, int jitt)
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi2())
|
||||
{
|
||||
asic_RaiseInterruptBothCLX(holly_RENDER_DONE);
|
||||
asic_RaiseInterruptBothCLX(holly_RENDER_DONE_isp);
|
||||
|
|
|
@ -223,7 +223,7 @@ static NOINLINE void DYNACALL ta_handle_cmd(u32 trans)
|
|||
ta_fsm_cl=dat->pcw.ListType;
|
||||
//printf("List %d ended\n",ta_fsm_cl);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi2())
|
||||
asic_RaiseInterruptBothCLX(ListEndInterrupt[ta_fsm_cl]);
|
||||
else
|
||||
asic_RaiseInterrupt(ListEndInterrupt[ta_fsm_cl]);
|
||||
|
|
|
@ -12,7 +12,7 @@ BSC_PDTRA_type BSC_PDTRA;
|
|||
void write_BSC_PCTRA(u32 addr, u32 data)
|
||||
{
|
||||
BSC_PCTRA.full = data;
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi())
|
||||
NaomiBoardIDWriteControl((u16)data);
|
||||
//else
|
||||
//printf("C:BSC_PCTRA = %08X\n",data);
|
||||
|
@ -23,13 +23,13 @@ void write_BSC_PDTRA(u32 addr, u32 data)
|
|||
BSC_PDTRA.full=(u16)data;
|
||||
//printf("D:BSC_PDTRA = %04x\n", (u16)data);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi())
|
||||
NaomiBoardIDWrite((u16)data);
|
||||
}
|
||||
|
||||
u32 read_BSC_PDTRA(u32 addr)
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi())
|
||||
{
|
||||
return NaomiBoardIDRead();
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ void GamepadDevice::load_system_mappings()
|
|||
{
|
||||
std::shared_ptr<GamepadDevice> gamepad = GetGamepad(i);
|
||||
if (!gamepad->find_mapping())
|
||||
gamepad->resetMappingToDefault(settings.platform.system != DC_PLATFORM_DREAMCAST, true);
|
||||
gamepad->resetMappingToDefault(settings.platform.isArcade(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -480,8 +480,8 @@ void KeyboardDeviceTemplate<Keycode>::keyboard_input(Keycode keycode, bool press
|
|||
// or the corresponding maple device (if any) isn't a keyboard
|
||||
else if (gui_is_open()
|
||||
|| port == (int)ARRAY_SIZE(kb_key)
|
||||
|| (settings.platform.system == DC_PLATFORM_DREAMCAST && config::MapleMainDevices[port] != MDT_Keyboard)
|
||||
|| ((settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_NAOMI2) && settings.input.JammaSetup != JVS::Keyboard)
|
||||
|| settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
|| (settings.platform.isConsole() && config::MapleMainDevices[port] != MDT_Keyboard)
|
||||
|| (settings.platform.isNaomi() && settings.input.JammaSetup != JVS::Keyboard)
|
||||
|| settings.platform.isAtomiswave())
|
||||
gamepad_btn_input(dc_keycode, pressed);
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ static bool save_game_state(unsigned char **buffer, int *len, int *checksum, int
|
|||
{
|
||||
verify(!sh4_cpu.IsCpuRunning());
|
||||
lastSavedFrame = frame;
|
||||
size_t allocSize = (settings.platform.system == DC_PLATFORM_NAOMI ? 20 : 10) * 1024 * 1024;
|
||||
size_t allocSize = (settings.platform.isNaomi() ? 20 : 10) * 1024 * 1024;
|
||||
*buffer = (unsigned char *)malloc(allocSize);
|
||||
if (*buffer == nullptr)
|
||||
{
|
||||
|
@ -471,7 +471,7 @@ void startSession(int localPort, int localPlayerNum)
|
|||
analogAxes = 0;
|
||||
NOTICE_LOG(NETWORK, "GGPO synctest session started");
|
||||
#else
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
analogAxes = config::GGPOAnalogAxes;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
void NetworkHandshake::init()
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI)
|
||||
if (settings.platform.isNaomi())
|
||||
SetNaomiNetworkConfig(-1);
|
||||
|
||||
if (config::GGPOEnable)
|
||||
|
|
|
@ -842,7 +842,7 @@ static void *pico_thread_func(void *)
|
|||
// Find the network ports for the current game
|
||||
const GamePortList *ports = nullptr;
|
||||
std::string gameId;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
gameId = std::string(ip_meta.product_number, sizeof(ip_meta.product_number));
|
||||
gameId = trim_trailing_ws(gameId);
|
||||
|
|
|
@ -652,7 +652,7 @@ static void reios_boot()
|
|||
reios_setup_state(0x8C010000);
|
||||
}
|
||||
else {
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
char bootfile[sizeof(ip_meta.boot_filename) + 1] = {0};
|
||||
memcpy(bootfile, ip_meta.boot_filename, sizeof(ip_meta.boot_filename));
|
||||
|
@ -661,7 +661,7 @@ static void reios_boot()
|
|||
reios_setup_state(0xac008300);
|
||||
}
|
||||
else {
|
||||
verify(settings.platform.system == DC_PLATFORM_NAOMI);
|
||||
verify(settings.platform.isNaomi());
|
||||
if (CurrentCartridge == NULL)
|
||||
{
|
||||
WARN_LOG(REIOS, "No cartridge loaded");
|
||||
|
|
|
@ -131,7 +131,7 @@ void DX11Overlay::draw(u32 width, u32 height, bool vmu, bool crosshair)
|
|||
{
|
||||
if (config::CrosshairColor[i] == 0)
|
||||
continue;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST
|
||||
if (settings.platform.isConsole()
|
||||
&& config::MapleMainDevices[i] != MDT_LightGun)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ void D3DOverlay::draw(u32 width, u32 height, bool vmu, bool crosshair)
|
|||
{
|
||||
if (config::CrosshairColor[i] == 0)
|
||||
continue;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST
|
||||
if (settings.platform.isConsole()
|
||||
&& config::MapleMainDevices[i] != MDT_LightGun)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1000,7 +1000,7 @@ struct OpenGL4Renderer : OpenGLRenderer
|
|||
void gl4DrawVmuTexture(u8 vmu_screen_number);
|
||||
void gl4DrawGunCrosshair(u8 port);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
for (int vmu_screen_number = 0 ; vmu_screen_number < 4 ; vmu_screen_number++)
|
||||
if (vmu_lcd_status[vmu_screen_number * 2])
|
||||
|
|
|
@ -1056,7 +1056,7 @@ void OSD_DRAW(bool clear_screen)
|
|||
void DrawVmuTexture(u8 vmu_screen_number);
|
||||
void DrawGunCrosshair(u8 port);
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
for (int vmu_screen_number = 0 ; vmu_screen_number < 4 ; vmu_screen_number++)
|
||||
if (vmu_lcd_status[vmu_screen_number * 2])
|
||||
|
@ -1162,7 +1162,7 @@ bool OpenGLRenderer::Process(TA_context* ctx)
|
|||
}
|
||||
|
||||
bool success;
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI2)
|
||||
if (settings.platform.isNaomi2())
|
||||
success = ta_parse_naomi2(ctx);
|
||||
else
|
||||
success = ta_parse_vdrc(ctx);
|
||||
|
|
|
@ -132,7 +132,7 @@ void OpenGLDriver::displayCrosshairs()
|
|||
{
|
||||
if (config::CrosshairColor[i] == 0)
|
||||
continue;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST && config::MapleMainDevices[i] != MDT_LightGun)
|
||||
if (settings.platform.isConsole() && config::MapleMainDevices[i] != MDT_LightGun)
|
||||
continue;
|
||||
|
||||
ImVec2 pos;
|
||||
|
|
|
@ -1222,7 +1222,7 @@ static void gui_display_settings()
|
|||
if (maple_devices_changed)
|
||||
{
|
||||
maple_devices_changed = false;
|
||||
if (game_started && settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (game_started && settings.platform.isConsole())
|
||||
{
|
||||
maple_ReconnectDevices();
|
||||
reset_vmus();
|
||||
|
|
|
@ -106,8 +106,8 @@ const std::vector<OSDVertex>& GetOSDVertices()
|
|||
DrawButton2(vjoy_pos[2], kcode[0] & DC_DPAD_RIGHT);
|
||||
DrawButton2(vjoy_pos[3], kcode[0] & DC_DPAD_DOWN);
|
||||
|
||||
DrawButton2(vjoy_pos[4], kcode[0] & (settings.platform.system == DC_PLATFORM_DREAMCAST ? DC_BTN_X : DC_BTN_C));
|
||||
DrawButton2(vjoy_pos[5], kcode[0] & (settings.platform.system == DC_PLATFORM_DREAMCAST ? DC_BTN_Y : DC_BTN_X));
|
||||
DrawButton2(vjoy_pos[4], kcode[0] & (settings.platform.isConsole() ? DC_BTN_X : DC_BTN_C));
|
||||
DrawButton2(vjoy_pos[5], kcode[0] & (settings.platform.isConsole() ? DC_BTN_Y : DC_BTN_X));
|
||||
DrawButton2(vjoy_pos[6], kcode[0] & DC_BTN_B);
|
||||
DrawButton2(vjoy_pos[7], kcode[0] & DC_BTN_A);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ static inline bool crosshairsNeeded()
|
|||
if (config::CrosshairColor[0] == 0 && config::CrosshairColor[1] == 0
|
||||
&& config::CrosshairColor[2] == 0 && config::CrosshairColor[3] == 0)
|
||||
return false;
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST
|
||||
if (settings.platform.isArcade()
|
||||
&& settings.input.JammaSetup != JVS::LightGun
|
||||
&& settings.input.JammaSetup != JVS::LightGunAsAnalog
|
||||
&& settings.input.JammaSetup != JVS::Mazan)
|
||||
|
|
|
@ -202,7 +202,7 @@ void VulkanOverlay::Draw(vk::CommandBuffer commandBuffer, vk::Extent2D viewport,
|
|||
{
|
||||
if (config::CrosshairColor[i] == 0)
|
||||
continue;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST && config::MapleMainDevices[i] != MDT_LightGun)
|
||||
if (settings.platform.isConsole() && config::MapleMainDevices[i] != MDT_LightGun)
|
||||
continue;
|
||||
|
||||
float x, y;
|
||||
|
|
|
@ -355,16 +355,16 @@ static void dc_deserialize_libretro(Deserializer& deser)
|
|||
|
||||
deser.skip<u32>(); // sys_nvmem->size
|
||||
deser.skip<u32>(); // sys_nvmem->mask
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
if (settings.platform.isArcade())
|
||||
sys_nvmem->Deserialize(deser);
|
||||
|
||||
deser.skip<u32>(); // sys_nvmem/sys_rom->size
|
||||
deser.skip<u32>(); // sys_nvmem/sys_rom->mask
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
{
|
||||
sys_nvmem->Deserialize(deser);
|
||||
}
|
||||
else if (settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
else if (settings.platform.isAtomiswave())
|
||||
{
|
||||
deser >> static_cast<DCFlashChip*>(sys_rom)->state;
|
||||
deser.deserialize(sys_rom->data, sys_rom->size);
|
||||
|
@ -579,7 +579,7 @@ static void dc_deserialize_libretro(Deserializer& deser)
|
|||
deser >> config::Cable.get();
|
||||
deser >> config::Region.get();
|
||||
|
||||
if (CurrentCartridge != nullptr && (settings.platform.system != DC_PLATFORM_ATOMISWAVE || deser.version() >= Deserializer::V10_LIBRETRO))
|
||||
if (CurrentCartridge != nullptr && (!settings.platform.isAtomiswave() || deser.version() >= Deserializer::V10_LIBRETRO))
|
||||
CurrentCartridge->Deserialize(deser);
|
||||
if (deser.version() >= Deserializer::V7_LIBRETRO)
|
||||
gd_hle_state.Deserialize(deser);
|
||||
|
|
|
@ -341,6 +341,13 @@ struct settings_t
|
|||
u32 aram_mask;
|
||||
u32 bios_size;
|
||||
u32 flash_size;
|
||||
|
||||
bool isNaomi1() const { return system == DC_PLATFORM_NAOMI; }
|
||||
bool isNaomi2() const { return system == DC_PLATFORM_NAOMI2; }
|
||||
bool isNaomi() const { return isNaomi1() || isNaomi2(); }
|
||||
bool isAtomiswave() const { return system == DC_PLATFORM_ATOMISWAVE; }
|
||||
bool isArcade() const { return !isConsole(); }
|
||||
bool isConsole() const { return system == DC_PLATFORM_DREAMCAST; }
|
||||
} platform;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
kcode = 0xffffffff;
|
||||
joyx = joyy = rt = lt = 0;
|
||||
}
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isArcade())
|
||||
{
|
||||
if (rt > 0)
|
||||
{
|
||||
|
|
|
@ -505,14 +505,14 @@ public:
|
|||
{
|
||||
case IOS_BTN_L2:
|
||||
gamepad_axis_input(IOS_AXIS_L2, pressed ? 0x7fff : 0);
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isArcade())
|
||||
GamepadDevice::gamepad_btn_input(IOS_BTN_L1, pressed); // Z, btn5
|
||||
return true;
|
||||
case IOS_BTN_R2:
|
||||
if (!pressed && maple_port() >= 0 && maple_port() <= 3)
|
||||
kcode[maple_port()] |= DC_DPAD2_UP | DC_BTN_D | DC_DPAD2_DOWN;
|
||||
gamepad_axis_input(IOS_AXIS_R2, pressed ? 0x7fff : 0);
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isArcade())
|
||||
GamepadDevice::gamepad_btn_input(IOS_BTN_Y, pressed); // Y, btn4
|
||||
return true;
|
||||
default:
|
||||
|
@ -527,7 +527,7 @@ public:
|
|||
gui_open_settings();
|
||||
return true;
|
||||
}
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST && maple_port() >= 0 && maple_port() <= 3)
|
||||
if (settings.platform.isArcade() && maple_port() >= 0 && maple_port() <= 3)
|
||||
{
|
||||
u32& keycode = kcode[maple_port()];
|
||||
if ((buttonState & (1 << IOS_BTN_R2)) != 0)
|
||||
|
|
|
@ -358,9 +358,8 @@ static bool set_variable_visibility(void)
|
|||
bool platformWasDreamcast = platformIsDreamcast;
|
||||
bool platformWasArcade = platformIsArcade;
|
||||
|
||||
platformIsDreamcast = (settings.platform.system == DC_PLATFORM_DREAMCAST);
|
||||
platformIsArcade = (settings.platform.system == DC_PLATFORM_NAOMI) ||
|
||||
(settings.platform.system == DC_PLATFORM_ATOMISWAVE);
|
||||
platformIsDreamcast = settings.platform.isConsole();
|
||||
platformIsArcade = settings.platform.isArcade();
|
||||
|
||||
// Show/hide platform-dependent options
|
||||
if (first_run || (platformIsDreamcast != platformWasDreamcast) || (platformIsArcade != platformWasArcade))
|
||||
|
@ -626,7 +625,7 @@ static void update_variables(bool first_startup)
|
|||
per_content_vmus = 2;
|
||||
}
|
||||
if (!first_startup && per_content_vmus != previous_per_content_vmus
|
||||
&& settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
&& settings.platform.isConsole())
|
||||
{
|
||||
// Recreate the VMUs so that the save location is taken into account.
|
||||
// Don't do this at startup because we don't know the system type yet
|
||||
|
@ -754,7 +753,7 @@ static void update_variables(bool first_startup)
|
|||
var.key = CORE_OPTION_NAME "_enable_purupuru";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
if (enable_purupuru != (strcmp("enabled", var.value) == 0) && settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (enable_purupuru != (strcmp("enabled", var.value) == 0) && settings.platform.isConsole())
|
||||
{
|
||||
enable_purupuru = strcmp("enabled", var.value) == 0;
|
||||
for (int i = 0; i < MAPLE_PORTS; i++) {
|
||||
|
@ -1224,6 +1223,7 @@ static uint32_t map_gamepad_button(unsigned device, unsigned id)
|
|||
break;
|
||||
|
||||
case DC_PLATFORM_NAOMI:
|
||||
case DC_PLATFORM_NAOMI2:
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
|
@ -1263,7 +1263,9 @@ static uint32_t map_gamepad_button(unsigned device, unsigned id)
|
|||
return 0;
|
||||
uint32_t mapped = joymap[id];
|
||||
// Hack to bind Button 9 instead of Service when not used
|
||||
if (id == RETRO_DEVICE_ID_JOYPAD_R3 && device == RETRO_DEVICE_JOYPAD && settings.platform.system == DC_PLATFORM_NAOMI && !allow_service_buttons)
|
||||
if (id == RETRO_DEVICE_ID_JOYPAD_R3 && device == RETRO_DEVICE_JOYPAD
|
||||
&& settings.platform.isNaomi()
|
||||
&& !allow_service_buttons)
|
||||
mapped = NAOMI_BTN8_KEY;
|
||||
return mapped;
|
||||
}
|
||||
|
@ -1295,7 +1297,7 @@ static void set_input_descriptors()
|
|||
{
|
||||
struct retro_input_descriptor desc[22 * 4 + 1];
|
||||
int descriptor_index = 0;
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
if (settings.platform.isArcade())
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -1763,12 +1765,12 @@ bool retro_load_game(const struct retro_game_info *game)
|
|||
|
||||
if (game->path[0] == '\0')
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
boot_to_bios = true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isArcade())
|
||||
boot_to_bios = false;
|
||||
|
||||
if (boot_to_bios)
|
||||
|
@ -1854,7 +1856,7 @@ bool retro_load_game(const struct retro_game_info *game)
|
|||
if (!foundRenderApi)
|
||||
return false;
|
||||
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isArcade())
|
||||
{
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir)
|
||||
&& dir != nullptr
|
||||
|
@ -2039,7 +2041,7 @@ void retro_set_controller_port_device(unsigned in_port, unsigned device)
|
|||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
config::MapleMainDevices[in_port] = MDT_SegaController;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = MDT_SegaVMU;
|
||||
config::MapleExpansionDevices[in_port][1] = enable_purupuru ? MDT_PurupuruPack : MDT_SegaVMU;
|
||||
}
|
||||
|
@ -2047,42 +2049,42 @@ void retro_set_controller_port_device(unsigned in_port, unsigned device)
|
|||
case RETRO_DEVICE_TWINSTICK:
|
||||
case RETRO_DEVICE_TWINSTICK_SATURN:
|
||||
config::MapleMainDevices[in_port] = MDT_TwinStick;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = enable_purupuru ? MDT_PurupuruPack : MDT_SegaVMU;
|
||||
config::MapleExpansionDevices[in_port][1] = MDT_None;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_ASCIISTICK:
|
||||
config::MapleMainDevices[in_port] = MDT_AsciiStick;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = enable_purupuru ? MDT_PurupuruPack : MDT_SegaVMU;
|
||||
config::MapleExpansionDevices[in_port][1] = MDT_None;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
config::MapleMainDevices[in_port] = MDT_Keyboard;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = MDT_None;
|
||||
config::MapleExpansionDevices[in_port][1] = MDT_None;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
config::MapleMainDevices[in_port] = MDT_Mouse;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = MDT_None;
|
||||
config::MapleExpansionDevices[in_port][1] = MDT_None;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
config::MapleMainDevices[in_port] = MDT_LightGun;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = enable_purupuru ? MDT_PurupuruPack : MDT_SegaVMU;
|
||||
config::MapleExpansionDevices[in_port][1] = MDT_None;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
config::MapleMainDevices[in_port] = MDT_None;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST) {
|
||||
if (settings.platform.isConsole()) {
|
||||
config::MapleExpansionDevices[in_port][0] = MDT_None;
|
||||
config::MapleExpansionDevices[in_port][1] = MDT_None;
|
||||
}
|
||||
|
@ -2098,7 +2100,7 @@ static void refresh_devices(bool first_startup)
|
|||
|
||||
if (!first_startup)
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
if (settings.platform.isConsole())
|
||||
maple_ReconnectDevices();
|
||||
|
||||
if (rumble.set_rumble_state)
|
||||
|
@ -2337,10 +2339,10 @@ static void UpdateInputStateNaomi(u32 port)
|
|||
if (input_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_RELOAD))
|
||||
{
|
||||
force_offscreen = true;
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI)
|
||||
kcode[port] &= ~NAOMI_BTN0_KEY;
|
||||
else
|
||||
if (settings.platform.isAtomiswave())
|
||||
kcode[port] &= ~AWAVE_TRIGGER_KEY;
|
||||
else
|
||||
kcode[port] &= ~NAOMI_BTN0_KEY;
|
||||
}
|
||||
|
||||
if (force_offscreen || input_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN))
|
||||
|
@ -2351,7 +2353,7 @@ static void UpdateInputStateNaomi(u32 port)
|
|||
|
||||
if (input_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER) || input_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_RELOAD))
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI)
|
||||
if (settings.platform.isNaomi())
|
||||
kcode[port] &= ~NAOMI_BTN1_KEY;
|
||||
}
|
||||
}
|
||||
|
@ -2385,7 +2387,8 @@ static void UpdateInputStateNaomi(u32 port)
|
|||
setDeviceButtonStateFromBitmap(ret, port, RETRO_DEVICE_JOYPAD, id);
|
||||
break;
|
||||
case RETRO_DEVICE_ID_JOYPAD_R3:
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || allow_service_buttons)
|
||||
if (settings.platform.isNaomi()
|
||||
|| allow_service_buttons)
|
||||
setDeviceButtonStateFromBitmap(ret, port, RETRO_DEVICE_JOYPAD, id);
|
||||
break;
|
||||
default:
|
||||
|
@ -2444,20 +2447,20 @@ static void UpdateInputStateNaomi(u32 port)
|
|||
}
|
||||
|
||||
// Avoid Left+Right or Up+Down buttons being pressed together as this crashes some games
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI)
|
||||
{
|
||||
if ((kcode[port] & (NAOMI_UP_KEY|NAOMI_DOWN_KEY)) == 0)
|
||||
kcode[port] |= NAOMI_UP_KEY|NAOMI_DOWN_KEY;
|
||||
if ((kcode[port] & (NAOMI_LEFT_KEY|NAOMI_RIGHT_KEY)) == 0)
|
||||
kcode[port] |= NAOMI_LEFT_KEY|NAOMI_RIGHT_KEY;
|
||||
}
|
||||
else
|
||||
if (settings.platform.isAtomiswave())
|
||||
{
|
||||
if ((kcode[port] & (AWAVE_UP_KEY|AWAVE_DOWN_KEY)) == 0)
|
||||
kcode[port] |= AWAVE_UP_KEY|AWAVE_DOWN_KEY;
|
||||
if ((kcode[port] & (AWAVE_LEFT_KEY|AWAVE_RIGHT_KEY)) == 0)
|
||||
kcode[port] |= AWAVE_LEFT_KEY|AWAVE_RIGHT_KEY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((kcode[port] & (NAOMI_UP_KEY|NAOMI_DOWN_KEY)) == 0)
|
||||
kcode[port] |= NAOMI_UP_KEY|NAOMI_DOWN_KEY;
|
||||
if ((kcode[port] & (NAOMI_LEFT_KEY|NAOMI_RIGHT_KEY)) == 0)
|
||||
kcode[port] |= NAOMI_LEFT_KEY|NAOMI_RIGHT_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateInputState(u32 port)
|
||||
|
@ -2465,7 +2468,7 @@ static void UpdateInputState(u32 port)
|
|||
if (gl_ctx_resetting)
|
||||
return;
|
||||
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
if (settings.platform.isArcade())
|
||||
{
|
||||
UpdateInputStateNaomi(port);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue