Merge remote-tracking branch 'origin/master' into dev

# Conflicts:
#	core/hw/holly/sb_mem.cpp
#	core/hw/naomi/naomi.cpp
#	core/hw/naomi/naomi_flashrom.cpp
#	core/hw/pvr/ta_ctx.h
#	core/rend/gui.cpp
This commit is contained in:
Flyinghead 2023-01-27 15:41:45 +01:00
commit 99d5266aa0
126 changed files with 572 additions and 389 deletions

View File

@ -22,6 +22,12 @@
CORE_ARGS: -DLIBRETRO=ON -G Xcode -DCMAKE_BUILD_TYPE=Release CORE_ARGS: -DLIBRETRO=ON -G Xcode -DCMAKE_BUILD_TYPE=Release
EXTRA_PATH: Release EXTRA_PATH: Release
.core-defs-osx-arm64:
extends: .core-defs
variables:
CORE_ARGS: -DLIBRETRO=ON -G Xcode -DCMAKE_BUILD_TYPE=Release
EXTRA_PATH: Release
.core-defs-android: .core-defs-android:
extends: .core-defs extends: .core-defs
script: script:
@ -43,6 +49,10 @@ include:
- project: 'libretro-infrastructure/ci-templates' - project: 'libretro-infrastructure/ci-templates'
file: 'osx-cmake-x86.yml' file: 'osx-cmake-x86.yml'
# MacOS arm64
- project: 'libretro-infrastructure/ci-templates'
file: 'osx-cmake-arm64.yml'
# Linux # Linux
- project: 'libretro-infrastructure/ci-templates' - project: 'libretro-infrastructure/ci-templates'
file: '/linux-cmake.yml' file: '/linux-cmake.yml'
@ -98,6 +108,12 @@ libretro-build-osx-x64:
- .libretro-osx-cmake-x86 - .libretro-osx-cmake-x86
- .core-defs-osx-x64 - .core-defs-osx-x64
# MacOS arm 64-bit
libretro-build-osx-arm64:
extends:
- .libretro-osx-cmake-arm64
- .core-defs-osx-arm64
################################### CELLULAR ################################# ################################### CELLULAR #################################
# Android ARMv7a # Android ARMv7a
android-armeabi-v7a: android-armeabi-v7a:

View File

@ -168,7 +168,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
LINK_FLAGS_RELEASE -s) LINK_FLAGS_RELEASE -s)
if(MSVC) if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /GR- /GS-) target_compile_options(${PROJECT_NAME} PRIVATE /GR /GS-)
if(WINDOWS_STORE) if(WINDOWS_STORE)
target_compile_options(${PROJECT_NAME} PRIVATE /ZW) target_compile_options(${PROJECT_NAME} PRIVATE /ZW)
endif() endif()

View File

@ -25,6 +25,7 @@
#include "reios/reios.h" #include "reios/reios.h"
#include "cfg/cfg.h" #include "cfg/cfg.h"
#include "cfg/ini.h" #include "cfg/ini.h"
#include "cfg/option.h"
#include "emulator.h" #include "emulator.h"
const WidescreenCheat CheatManager::widescreen_cheats[] = const WidescreenCheat CheatManager::widescreen_cheats[] =

@ -1 +1 @@
Subproject commit d2657e1267d2ce9399bcc6b9c5b01b465db057b1 Subproject commit 4c3d5fce1a4fef4decfbfeaf20f3746ecd209775

View File

@ -24,6 +24,7 @@
#include "imgread/common.h" #include "imgread/common.h"
#include "hw/naomi/naomi_cart.h" #include "hw/naomi/naomi_cart.h"
#include "reios/reios.h" #include "reios/reios.h"
#include "hw/sh4/modules/mmu.h"
#include "hw/sh4/sh4_if.h" #include "hw/sh4/sh4_if.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
@ -32,7 +33,6 @@
#include "oslib/audiostream.h" #include "oslib/audiostream.h"
#include "debug/gdb_server.h" #include "debug/gdb_server.h"
#include "hw/pvr/Renderer_if.h" #include "hw/pvr/Renderer_if.h"
#include "rend/CustomTexture.h"
#include "hw/arm7/arm7_rec.h" #include "hw/arm7/arm7_rec.h"
#include "network/ggpo.h" #include "network/ggpo.h"
#include "hw/mem/mem_watch.h" #include "hw/mem/mem_watch.h"
@ -209,7 +209,8 @@ static void loadSpecialSettings()
|| prod_id == "T40505D 50" // Railroad Tycoon 2 (EU) || prod_id == "T40505D 50" // Railroad Tycoon 2 (EU)
|| prod_id == "T18702M" // Miss Moonlight || prod_id == "T18702M" // Miss Moonlight
|| prod_id == "T0019M" // KenJu Atomiswave DC Conversion || prod_id == "T0019M" // KenJu Atomiswave DC Conversion
|| prod_id == "T0020M") // Force Five Atomiswave DC Conversion || prod_id == "T0020M" // Force Five Atomiswave DC Conversion
|| prod_id == "HDR-0187") // Fushigi no Dungeon - Fuurai no Shiren Gaiden - Onna Kenshi Asuka Kenzan!
{ {
NOTICE_LOG(BOOT, "Forcing real BIOS"); NOTICE_LOG(BOOT, "Forcing real BIOS");
config::UseReios.override(false); config::UseReios.override(false);

View File

@ -20,14 +20,13 @@
*/ */
#pragma once #pragma once
#include "types.h" #include "types.h"
#include <atomic> #include <atomic>
#include <map>
#include <vector>
#include <future> #include <future>
#include <string> #include <map>
#include <memory>
#include <utility>
#include <mutex> #include <mutex>
#include <utility>
#include <vector>
void loadGameSpecificSettings(); void loadGameSpecificSettings();
void SaveSettings(); void SaveSettings();

View File

@ -13,6 +13,7 @@
#include "profiler/dc_profiler.h" #include "profiler/dc_profiler.h"
#include "hw/sh4/dyna/blockmanager.h" #include "hw/sh4/dyna/blockmanager.h"
#include "hw/arm7/arm7.h" #include "hw/arm7/arm7.h"
#include "cfg/option.h"
#include <ctime> #include <ctime>

View File

@ -27,7 +27,6 @@
#include "hw/gdrom/gdrom_if.h" #include "hw/gdrom/gdrom_if.h"
#include "cfg/option.h" #include "cfg/option.h"
#include "serialize.h" #include "serialize.h"
#include "hw/hwreg.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>

View File

@ -340,7 +340,7 @@ static ArmOp decodeArmOp(u32 opcode, u32 arm_pc)
{ {
// LDR/STR w pc-based offset and write-back // LDR/STR w pc-based offset and write-back
op.flags |= ArmOp::OP_SETS_PC; op.flags |= ArmOp::OP_SETS_PC;
// TODO not supported // Invalid: Write-back must not be specified if R15 is used as the base register
op.op_type = ArmOp::FALLBACK; op.op_type = ArmOp::FALLBACK;
op.arg[0] = ArmOp::Operand(opcode); op.arg[0] = ArmOp::Operand(opcode);
op.arg[1] = ArmOp::Operand(); op.arg[1] = ArmOp::Operand();
@ -368,8 +368,13 @@ static ArmOp decodeArmOp(u32 opcode, u32 arm_pc)
op.arg[1].shift_value = bits.shift_imm; op.arg[1].shift_value = bits.shift_imm;
if (op.arg[1].getReg().armreg == RN_PC) if (op.arg[1].getReg().armreg == RN_PC)
{ {
verify(op.arg[1].shift_value == 0 && op.arg[1].shift_type == ArmOp::LSL); // Invalid: r15 cannot be used as the offset register
op.arg[1] = ArmOp::Operand(arm_pc + 8); op.op_type = ArmOp::FALLBACK;
op.arg[0] = ArmOp::Operand(opcode);
op.arg[1] = ArmOp::Operand();
op.arg[2] = ArmOp::Operand();
op.cycles = 0;
return op;
} }
if (op.arg[1].shift_type == ArmOp::RRX && op.arg[1].shift_value == 0) if (op.arg[1].shift_type == ArmOp::RRX && op.arg[1].shift_value == 0)
op.flags |= ArmOp::OP_READS_FLAGS; op.flags |= ArmOp::OP_READS_FLAGS;

View File

@ -17,10 +17,10 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include "types.h"
#include <climits> #include <climits>
#include <cinttypes> #include <cinttypes>
#include "types.h"
#include "hw/sh4/sh4_sched.h"
typedef u8 uint8_t; typedef u8 uint8_t;
typedef u16 uint16_t; typedef u16 uint16_t;

View File

@ -5,11 +5,13 @@
#include "gdromv3.h" #include "gdromv3.h"
#include "gdrom_if.h" #include "gdrom_if.h"
#include "cfg/option.h"
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "hw/holly/sb.h" #include "hw/holly/sb.h"
#include "hw/sh4/modules/dmac.h" #include "hw/sh4/modules/dmac.h"
#include "hw/sh4/sh4_interpreter.h" #include "hw/sh4/sh4_interpreter.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_mmr.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include "imgread/common.h" #include "imgread/common.h"
#include "serialize.h" #include "serialize.h"

View File

@ -4,7 +4,6 @@
#include "hw/pvr/spg.h" #include "hw/pvr/spg.h"
#include "oslib/audiostream.h" #include "oslib/audiostream.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
#include "cfg/option.h"
#include "hw/aica/sgc_if.h" #include "hw/aica/sgc_if.h"
#include <zlib.h> #include <zlib.h>

View File

@ -6,7 +6,6 @@
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include "network/ggpo.h" #include "network/ggpo.h"
#include "input/gamepad_device.h"
enum MaplePattern enum MaplePattern
{ {
@ -162,12 +161,9 @@ static void maple_DoDma()
#else #else
if (GetMemPtr(header_2, 1) == nullptr) if (GetMemPtr(header_2, 1) == nullptr)
{ {
WARN_LOG(MAPLE, "DMA Error: destination not in system ram: %x", header_2); INFO_LOG(MAPLE, "DMA Error: destination not in system ram: %x", header_2);
#endif #endif
asic_RaiseInterrupt(holly_MAPLE_OVERRUN); header_2 = 0;
SB_MDST = 0;
mapleDmaOut.clear();
return;
} }
u32* p_data = (u32 *)GetMemPtr(addr + 8, plen * sizeof(u32)); u32* p_data = (u32 *)GetMemPtr(addr + 8, plen * sizeof(u32));
@ -274,6 +270,11 @@ static int maple_schd(int tag, int c, int j)
{ {
for (const auto& pair : mapleDmaOut) for (const auto& pair : mapleDmaOut)
{ {
if (pair.first == 0)
{
asic_RaiseInterrupt(holly_MAPLE_OVERRUN);
continue;
}
size_t size = pair.second.size() * sizeof(u32); size_t size = pair.second.size() * sizeof(u32);
u32 *p = (u32 *)GetMemPtr(pair.first, size); u32 *p = (u32 *)GetMemPtr(pair.first, size);
memcpy(p, pair.second.data(), size); memcpy(p, pair.second.data(), size);

View File

@ -16,8 +16,6 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with flycast. If not, see <https://www.gnu.org/licenses/>. along with flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <array>
#include <memory>
#include "maple_devs.h" #include "maple_devs.h"
#include "hw/naomi/naomi_cart.h" #include "hw/naomi/naomi_cart.h"
#include <xxhash.h> #include <xxhash.h>
@ -26,6 +24,10 @@
#include "cfg/option.h" #include "cfg/option.h"
#include "network/output.h" #include "network/output.h"
#include <algorithm>
#include <array>
#include <memory>
#define LOGJVS(...) DEBUG_LOG(JVS, __VA_ARGS__) #define LOGJVS(...) DEBUG_LOG(JVS, __VA_ARGS__)
u8 *EEPROM; u8 *EEPROM;

View File

@ -24,7 +24,6 @@
#include "hw/pvr/pvr_mem.h" #include "hw/pvr/pvr_mem.h"
#include "hw/pvr/elan.h" #include "hw/pvr/elan.h"
#include "rend/TexCache.h" #include "rend/TexCache.h"
#include <array>
#include <unordered_map> #include <unordered_map>
namespace memwatch namespace memwatch

View File

@ -25,10 +25,13 @@
#include "modem_regs.h" #include "modem_regs.h"
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include "oslib/oslib.h"
#include "network/picoppp.h" #include "network/picoppp.h"
#include "serialize.h" #include "serialize.h"
#ifndef NDEBUG
#include "oslib/oslib.h"
#endif
#define MODEM_COUNTRY_RES 0 #define MODEM_COUNTRY_RES 0
#define MODEM_COUNTRY_JAP 1 #define MODEM_COUNTRY_JAP 1
#define MODEM_COUNTRY_USA 2 #define MODEM_COUNTRY_USA 2
@ -532,7 +535,6 @@ static void ModemNormalWrite(u32 reg, u32 data)
case 0x11: case 0x11:
LOG("PARSL = %d", modem_regs.reg11.PARSL); LOG("PARSL = %d", modem_regs.reg11.PARSL);
die("PARSL");
break; break;
case 0x14: // ABCODE case 0x14: // ABCODE

View File

@ -50,12 +50,19 @@ void M4Cartridge::device_start()
{ {
if (m4id == 0) if (m4id == 0)
{ {
INFO_LOG(COMMON, "Warning: M4 ID not provided\n"); INFO_LOG(NAOMI, "Warning: M4 ID not provided\n");
m4id = 0x5504; m4id = 0x5504;
} }
subkey1 = (m_key_data[0x5e2] << 8) | m_key_data[0x5e0]; if (m_key_data != nullptr)
subkey2 = (m_key_data[0x5e6] << 8) | m_key_data[0x5e4]; {
subkey1 = (m_key_data[0x5e2] << 8) | m_key_data[0x5e0];
subkey2 = (m_key_data[0x5e6] << 8) | m_key_data[0x5e4];
}
else
{
WARN_LOG(NAOMI, "Missing M4 key");
}
enc_init(); enc_init();
} }

View File

@ -62,8 +62,9 @@ private:
static const u8 k_sboxes[4][16]; static const u8 k_sboxes[4][16];
u16 m4id; u16 m4id;
u8 *m_key_data = NULL; // 2048 bytes u8 *m_key_data = nullptr; // 2048 bytes
u16 subkey1, subkey2; u16 subkey1 = 0;
u16 subkey2 = 0;
u16 one_round[0x10000]; u16 one_round[0x10000];
u8 buffer[32768]; u8 buffer[32768];

View File

@ -2,14 +2,13 @@
This file is a mix of my code, Zezu's, and duno wtf-else (most likely ElSemi's ?) This file is a mix of my code, Zezu's, and duno wtf-else (most likely ElSemi's ?)
*/ */
#include "types.h" #include "types.h"
#include "cfg/cfg.h"
#include "hw/holly/sb.h" #include "hw/holly/sb.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "hw/maple/maple_cfg.h" #include "hw/maple/maple_cfg.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include "hw/sh4/modules/dmac.h"
#include "hw/aica/aica_if.h" #include "hw/aica/aica_if.h"
#include "hw/hwreg.h"
#include "naomi.h" #include "naomi.h"
#include "naomi_cart.h" #include "naomi_cart.h"
@ -18,6 +17,8 @@
#include "serialize.h" #include "serialize.h"
#include "network/output.h" #include "network/output.h"
#include <algorithm>
static NaomiM3Comm m3comm; static NaomiM3Comm m3comm;
Multiboard *multiboard; Multiboard *multiboard;

View File

@ -1,10 +1,11 @@
#pragma once #pragma once
#include <algorithm>
#include <string>
#include "types.h" #include "types.h"
#include "emulator.h" #include "emulator.h"
#include <string>
#include <vector>
struct RomBootID struct RomBootID
{ {
char boardName[16]; char boardName[16];

View File

@ -30,6 +30,8 @@
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "network/naomi_network.h" #include "network/naomi_network.h"
#include "emulator.h" #include "emulator.h"
#include "rend/gui.h"
#include <chrono> #include <chrono>
#include <memory> #include <memory>

View File

@ -1,12 +1,12 @@
#include "Renderer_if.h" #include "Renderer_if.h"
#include "spg.h" #include "spg.h"
#include "hw/pvr/pvr_mem.h"
#include "rend/TexCache.h" #include "rend/TexCache.h"
#include "rend/transform_matrix.h" #include "rend/transform_matrix.h"
#include "cfg/option.h" #include "cfg/option.h"
#include "emulator.h" #include "emulator.h"
#include "serialize.h" #include "serialize.h"
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "hw/sh4/sh4_if.h"
#include "profiler/fc_profiler.h" #include "profiler/fc_profiler.h"
#include <mutex> #include <mutex>

View File

@ -55,16 +55,14 @@
#include "ta_ctx.h" #include "ta_ctx.h"
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "hw/holly/sb.h" #include "hw/holly/sb.h"
#include "hw/pvr/Renderer_if.h"
#include "hw/sh4/sh4_sched.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "emulator.h" #include "hw/sh4/sh4_mmr.h"
#include "serialize.h" #include "serialize.h"
#include "elan_struct.h" #include "elan_struct.h"
#include "network/ggpo.h" #include "network/ggpo.h"
#include "cfg/option.h"
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
namespace elan { namespace elan {

View File

@ -9,6 +9,7 @@
#include "hw/holly/sb.h" #include "hw/holly/sb.h"
#include "hw/sh4/modules/dmac.h" #include "hw/sh4/modules/dmac.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_mmr.h"
static void RegWrite_SB_C2DST(u32 addr, u32 data) static void RegWrite_SB_C2DST(u32 addr, u32 data)
{ {

View File

@ -3,12 +3,15 @@
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "hw/holly/sb.h" #include "hw/holly/sb.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include "input/gamepad_device.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
#include "rend/TexCache.h"
#include "hw/maple/maple_if.h" #include "hw/maple/maple_if.h"
#include "serialize.h" #include "serialize.h"
#include "network/ggpo.h" #include "network/ggpo.h"
#include "hw/pvr/Renderer_if.h"
#ifdef TEST_AUTOMATION
#include "input/gamepad_device.h"
#endif
//SPG emulation; Scanline/Raster beam registers & interrupts //SPG emulation; Scanline/Raster beam registers & interrupts
@ -273,9 +276,9 @@ void spg_Reset(bool hard)
void scheduleRenderDone(TA_context *cntx) void scheduleRenderDone(TA_context *cntx)
{ {
if (cntx) int cycles = 4096;
if (cntx != nullptr)
{ {
int cycles;
if (settings.platform.isNaomi2()) { if (settings.platform.isNaomi2()) {
cycles = 1500000; cycles = 1500000;
} }
@ -284,12 +287,10 @@ void scheduleRenderDone(TA_context *cntx)
int size = 0; int size = 0;
for (TA_context *c = cntx; c != nullptr; c = c->nextContext) for (TA_context *c = cntx; c != nullptr; c = c->nextContext)
size += c->tad.thd_data - c->tad.thd_root; size += c->tad.thd_data - c->tad.thd_root;
cycles = std::min(200000 + size * 3, 1500000); cycles = std::min(550000 + size * 100, 1500000);
} }
sh4_sched_request(render_end_schid, cycles);
} }
else sh4_sched_request(render_end_schid, cycles);
sh4_sched_request(render_end_schid, 4096);
} }
void spg_Serialize(Serializer& ser) void spg_Serialize(Serializer& ser)

View File

@ -3,6 +3,10 @@
#include "cfg/option.h" #include "cfg/option.h"
#include "Renderer_if.h" #include "Renderer_if.h"
#include "serialize.h" #include "serialize.h"
#include "stdclass.h"
#include <mutex>
#include <vector>
extern u32 fskip; extern u32 fskip;
static int RenderCount; static int RenderCount;

View File

@ -2,9 +2,11 @@
#include "types.h" #include "types.h"
#include "ta_structs.h" #include "ta_structs.h"
#include "pvr_regs.h" #include "pvr_regs.h"
#include "stdclass.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
#include <algorithm>
#include <vector>
class BaseTextureCacheData; class BaseTextureCacheData;
struct N2LightModel; struct N2LightModel;

View File

@ -11,7 +11,7 @@
#include "cfg/option.h" #include "cfg/option.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <utility>
#define TACALL DYNACALL #define TACALL DYNACALL
#ifdef NDEBUG #ifdef NDEBUG

View File

@ -13,6 +13,7 @@
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_opcode_list.h" #include "hw/sh4/sh4_opcode_list.h"
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include "hw/sh4/modules/mmu.h"
#if defined(__unix__) && defined(DYNA_OPROF) #if defined(__unix__) && defined(DYNA_OPROF)

View File

@ -7,10 +7,8 @@
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/modules/mmu.h" #include "hw/sh4/modules/mmu.h"
#include "cfg/option.h"
#include <ctime> #include <ctime>
#include <cfloat>
#include "blockmanager.h" #include "blockmanager.h"
#include "ngen.h" #include "ngen.h"
@ -267,14 +265,17 @@ DynarecCodeEntryPtr DYNACALL rdv_BlockCheckFail(u32 addr)
if (mmu_enabled()) if (mmu_enabled())
{ {
RuntimeBlockInfoPtr block = bm_GetBlock(addr); RuntimeBlockInfoPtr block = bm_GetBlock(addr);
blockcheck_failures = block->blockcheck_failures + 1; if (block)
if (blockcheck_failures > 5)
{ {
bool inserted = smc_hotspots.insert(addr).second; blockcheck_failures = block->blockcheck_failures + 1;
if (inserted) if (blockcheck_failures > 5)
DEBUG_LOG(DYNAREC, "rdv_BlockCheckFail SMC hotspot @ %08x fails %d", addr, blockcheck_failures); {
bool inserted = smc_hotspots.insert(addr).second;
if (inserted)
DEBUG_LOG(DYNAREC, "rdv_BlockCheckFail SMC hotspot @ %08x fails %d", addr, blockcheck_failures);
}
bm_DiscardBlock(block.get());
} }
bm_DiscardBlock(block.get());
} }
else else
{ {

View File

@ -2,6 +2,7 @@
#include "types.h" #include "types.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_mmr.h"
#include "ngen.h" #include "ngen.h"
#include "hw/sh4/sh4_core.h" #include "hw/sh4/sh4_core.h"

View File

@ -21,7 +21,6 @@
#include <cstdio> #include <cstdio>
#include <set> #include <set>
#include <map> #include <map>
#include <cmath>
#include "types.h" #include "types.h"
#include "decoder.h" #include "decoder.h"
#include "hw/sh4/modules/mmu.h" #include "hw/sh4/modules/mmu.h"

View File

@ -19,13 +19,15 @@
along with reicast. If not, see <https://www.gnu.org/licenses/>. along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <map>
#include <deque>
#include "types.h" #include "types.h"
#include "decoder.h" #include "decoder.h"
#include "hw/sh4/modules/mmu.h" #include "hw/sh4/modules/mmu.h"
#include "ssa.h" #include "ssa.h"
#include <deque>
#include <map>
#include <vector>
#define ssa_printf(...) DEBUG_LOG(DYNAREC, __VA_ARGS__) #define ssa_printf(...) DEBUG_LOG(DYNAREC, __VA_ARGS__)
template<typename nreg_t, typename nregf_t, bool AllocVec2 = false> template<typename nreg_t, typename nregf_t, bool AllocVec2 = false>

View File

@ -10,7 +10,6 @@
#include "../sh4_interrupts.h" #include "../sh4_interrupts.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "../sh4_sched.h" #include "../sh4_sched.h"
#include "hw/holly/sb.h"
#include "../sh4_cache.h" #include "../sh4_cache.h"
#include "debug/gdb_server.h" #include "debug/gdb_server.h"

View File

@ -9,9 +9,14 @@
#include "hw/sh4/sh4_mmr.h" #include "hw/sh4/sh4_mmr.h"
#include "hw/sh4/sh4_core.h" #include "hw/sh4/sh4_core.h"
#include "hw/sh4/modules/ccn.h" #include "hw/sh4/modules/ccn.h"
#include "hw/sh4/modules/mmu.h"
#include "hw/sh4/sh4_interrupts.h" #include "hw/sh4/sh4_interrupts.h"
#include "hw/sh4/sh4_cache.h"
#include "debug/gdb_server.h" #include "debug/gdb_server.h"
#include "hw/sh4/dyna/decoder.h"
#ifdef STRICT_MODE
#include "hw/sh4/sh4_cache.h"
#endif
#define iNimp cpu_iNimp #define iNimp cpu_iNimp

View File

@ -1,4 +1,4 @@
#include "types.h" #include "hw/hwreg.h"
#include "hw/sh4/sh4_mmr.h" #include "hw/sh4/sh4_mmr.h"
//Init term res //Init term res

View File

@ -25,8 +25,6 @@
#ifdef FAST_MMU #ifdef FAST_MMU
#include "hw/mem/_vmem.h" #include "hw/mem/_vmem.h"
#include "ccn.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
extern TLB_Entry UTLB[64]; extern TLB_Entry UTLB[64];

View File

@ -1,4 +1,5 @@
#include "mmu.h" #include "mmu.h"
#include "hw/mem/_vmem.h"
#include "hw/sh4/sh4_if.h" #include "hw/sh4/sh4_if.h"
#include "hw/sh4/sh4_interrupts.h" #include "hw/sh4/sh4_interrupts.h"
#include "hw/sh4/sh4_core.h" #include "hw/sh4/sh4_core.h"
@ -20,15 +21,11 @@ This is mostly hacked-on as the core was never meant to have mmu support
There are two modes, one with 'full' mmu emulation (for wince/bleem/wtfever) There are two modes, one with 'full' mmu emulation (for wince/bleem/wtfever)
and a fast-hack mode for 1mb sqremaps (for katana) and a fast-hack mode for 1mb sqremaps (for katana)
*/ */
#include "mmu.h" #ifndef FAST_MMU
#include "hw/sh4/sh4_if.h"
#include "ccn.h" #include "ccn.h"
#include "hw/sh4/sh4_interrupts.h" #endif
#include "hw/sh4/sh4_if.h"
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/mem/_vmem.h"
//#define TRACE_WINCE_SYSCALLS //#define TRACE_WINCE_SYSCALLS
#ifdef TRACE_WINCE_SYSCALLS #ifdef TRACE_WINCE_SYSCALLS

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "types.h" #include "types.h"
#include "hw/sh4/sh4_mmr.h" #include "hw/sh4/sh4_mmr.h"
#include "hw/mem/_vmem.h"
#include "cfg/option.h" #include "cfg/option.h"
#include "hw/sh4/dyna/ngen.h" #include "hw/sh4/dyna/ngen.h"

View File

@ -1,7 +1,7 @@
/* /*
The rtc isn't working on dreamcast I'm told The rtc isn't working on dreamcast I'm told
*/ */
#include "types.h" #include "hw/hwreg.h"
#include "hw/sh4/sh4_mmr.h" #include "hw/sh4/sh4_mmr.h"
//Init term res //Init term res

View File

@ -1,6 +1,6 @@
//ubc is disabled on dreamcast and can't be used ... but kos-debug uses it !... //ubc is disabled on dreamcast and can't be used ... but kos-debug uses it !...
#include "types.h" #include "hw/hwreg.h"
#include "hw/sh4/sh4_mmr.h" #include "hw/sh4/sh4_mmr.h"
//Init term res //Init term res

View File

@ -16,9 +16,9 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>. along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifdef TRACE_WINCE_SYSCALLS
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#ifdef TRACE_WINCE_SYSCALLS
#define PUserKData 0x00005800 #define PUserKData 0x00005800
#define SYSHANDLE_OFFSET 0x004 #define SYSHANDLE_OFFSET 0x004
#define SYS_HANDLE_BASE 64 #define SYS_HANDLE_BASE 64

View File

@ -9,9 +9,13 @@
#include "sh4_mmr.h" #include "sh4_mmr.h"
#include "hw/pvr/elan.h" #include "hw/pvr/elan.h"
#include "hw/pvr/pvr_mem.h" #include "hw/pvr/pvr_mem.h"
#include "hw/sh4/sh4_core.h" #include "cfg/option.h"
#include "hw/mem/_vmem.h" #include "hw/mem/_vmem.h"
#include "hw/sh4/modules/mmu.h"
#ifdef STRICT_MODE
#include "sh4_cache.h" #include "sh4_cache.h"
#endif
//main system mem //main system mem
VArray2 mem_b; VArray2 mem_b;

View File

@ -6,7 +6,7 @@
extern VArray2 mem_b; extern VArray2 mem_b;
#include "hw/mem/_vmem.h" #include "hw/mem/_vmem.h"
#include "modules/mmu.h" #include "sh4_if.h"
#ifdef _MSC_VER #ifdef _MSC_VER
typedef u8 (DYNACALL *ReadMem8Func)(u32 addr); typedef u8 (DYNACALL *ReadMem8Func)(u32 addr);

View File

@ -1,7 +1,6 @@
/* /*
Sh4 internal register routing (P4 & 'area 7') Sh4 internal register routing (P4 & 'area 7')
*/ */
#include <array>
#include "types.h" #include "types.h"
#include "sh4_mmr.h" #include "sh4_mmr.h"
@ -11,6 +10,9 @@
#include "modules/modules.h" #include "modules/modules.h"
#include "sh4_cache.h" #include "sh4_cache.h"
#include <array>
#include <map>
//64bytes of sq // now on context ~ //64bytes of sq // now on context ~
std::array<u8, OnChipRAM_SIZE> OnChipRAM; std::array<u8, OnChipRAM_SIZE> OnChipRAM;

View File

@ -1,8 +1,10 @@
#include "types.h" #include "types.h"
#include "sh4_interrupts.h" #include "sh4_if.h"
#include "sh4_core.h"
#include "sh4_sched.h" #include "sh4_sched.h"
#include <algorithm>
#include <vector>
//sh4 scheduler //sh4 scheduler
/* /*

View File

@ -24,11 +24,10 @@
#include "emulator.h" #include "emulator.h"
#include "hw/maple/maple_devs.h" #include "hw/maple/maple_devs.h"
#include "hw/naomi/card_reader.h" #include "hw/naomi/card_reader.h"
#include "stdclass.h"
#include <algorithm> #include <algorithm>
#include <climits> #include <mutex>
#include <fstream> #include <vector>
#define MAPLE_PORT_CFG_PREFIX "maple_" #define MAPLE_PORT_CFG_PREFIX "maple_"
@ -49,6 +48,7 @@ std::mutex GamepadDevice::_gamepads_mutex;
#ifdef TEST_AUTOMATION #ifdef TEST_AUTOMATION
#include "hw/sh4/sh4_sched.h" #include "hw/sh4/sh4_sched.h"
#include <cstdio>
static FILE *record_input; static FILE *record_input;
#endif #endif

View File

@ -18,6 +18,7 @@
*/ */
#pragma once #pragma once
#include "types.h" #include "types.h"
#include "cfg/option.h"
#include "gamepad_device.h" #include "gamepad_device.h"
#include "rend/gui.h" #include "rend/gui.h"
#include <memory> #include <memory>

View File

@ -17,6 +17,7 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "mouse.h" #include "mouse.h"
#include "cfg/option.h"
#include "rend/gui.h" #include "rend/gui.h"
// Mouse buttons // Mouse buttons

View File

@ -4,16 +4,17 @@
#include "types.h" #include "types.h"
#if defined(__unix__) || defined(__SWITCH__) #if defined(__unix__) || defined(__SWITCH__)
#include "hw/sh4/dyna/blockmanager.h"
#include "log/LogManager.h" #include "log/LogManager.h"
#include "emulator.h" #include "emulator.h"
#include "rend/mainui.h" #include "rend/mainui.h"
#include "oslib/directory.h" #include "oslib/directory.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
#include "stdclass.h"
#include <cstdarg>
#include <csignal> #include <csignal>
#include <string>
#include <unistd.h> #include <unistd.h>
#include <vector>
#if defined(__SWITCH__) #if defined(__SWITCH__)
#include "nswitch.h" #include "nswitch.h"

View File

@ -10,6 +10,8 @@
#include <sys/time.h> #include <sys/time.h>
#if defined(__linux__) && !defined(__ANDROID__) #if defined(__linux__) && !defined(__ANDROID__)
#include <sys/personality.h> #include <sys/personality.h>
#endif
#if !defined(TARGET_BSD) && !defined(__ANDROID__) && defined(TARGET_VIDEOCORE)
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
#include <unistd.h> #include <unistd.h>

View File

@ -71,20 +71,22 @@ static void getLocalInput(MapleInputState inputState[4])
#include "emulator.h" #include "emulator.h"
#include "rend/gui.h" #include "rend/gui.h"
#include "hw/mem/mem_watch.h" #include "hw/mem/mem_watch.h"
#include "hw/sh4/sh4_sched.h"
#include <string.h> #include <string.h>
#include <chrono> #include <chrono>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
#include <numeric> #include <numeric>
#include <xxhash.h>
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "miniupnp.h" #include "miniupnp.h"
#include "hw/naomi/naomi_cart.h" #include "hw/naomi/naomi_cart.h"
//#define SYNC_TEST 1 //#define SYNC_TEST 1
#ifdef SYNC_TEST
#include <xxhash.h>
#endif
namespace ggpo namespace ggpo
{ {
using namespace std::chrono; using namespace std::chrono;

View File

@ -20,9 +20,11 @@
#ifndef FEAT_NO_MINIUPNPC #ifndef FEAT_NO_MINIUPNPC
#include <miniupnpc.h> #include <miniupnpc.h>
#include <upnpcommands.h> #include <upnpcommands.h>
#include "types.h" #include "log/Log.h"
#include "miniupnp.h" #include "miniupnp.h"
#include <string>
#ifndef UPNP_LOCAL_PORT_ANY #ifndef UPNP_LOCAL_PORT_ANY
#define UPNP_LOCAL_PORT_ANY 0 #define UPNP_LOCAL_PORT_ANY 0
#endif #endif

View File

@ -17,11 +17,14 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <vector>
#include <utility>
#ifndef FEAT_NO_MINIUPNPC #ifndef FEAT_NO_MINIUPNPC
#include <miniupnpc.h> #include <miniupnpc.h>
#include <cstring>
#include <string>
#include <utility>
#include <vector>
class MiniUPnP class MiniUPnP
{ {
public: public:

View File

@ -20,6 +20,8 @@
#include "hw/naomi/naomi_cart.h" #include "hw/naomi/naomi_cart.h"
#include "hw/naomi/naomi_flashrom.h" #include "hw/naomi/naomi_flashrom.h"
#include "cfg/option.h" #include "cfg/option.h"
#include "rend/gui.h"
#include <chrono> #include <chrono>
#include <thread> #include <thread>

View File

@ -20,11 +20,13 @@
#include "types.h" #include "types.h"
#include "net_platform.h" #include "net_platform.h"
#include "miniupnp.h" #include "miniupnp.h"
#include "rend/gui.h"
#include "cfg/option.h" #include "cfg/option.h"
#include "emulator.h" #include "emulator.h"
#include <algorithm>
#include <atomic> #include <atomic>
#include <future> #include <future>
#include <vector>
class NaomiNetwork class NaomiNetwork
{ {

View File

@ -24,7 +24,10 @@
#endif #endif
#include "stdclass.h" #include "stdclass.h"
#ifdef BBA_PCAPNG_DUMP
#include "oslib/oslib.h" #include "oslib/oslib.h"
#endif
#ifdef __MINGW32__ #ifdef __MINGW32__
#define _POSIX_SOURCE #define _POSIX_SOURCE
@ -43,7 +46,6 @@ extern "C" {
#include "net_platform.h" #include "net_platform.h"
#include "types.h" #include "types.h"
#include "cfg/cfg.h"
#include "picoppp.h" #include "picoppp.h"
#include "miniupnp.h" #include "miniupnp.h"
#include "reios/reios.h" #include "reios/reios.h"
@ -908,7 +910,8 @@ static void *pico_thread_func(void *)
memcpy(&dnsaddr.addr, &addr, sizeof(addr)); memcpy(&dnsaddr.addr, &addr, sizeof(addr));
// Create ppp/eth device // Create ppp/eth device
if (!config::EmulateBBA) const bool usingPPP = !config::EmulateBBA;
if (usingPPP)
{ {
// PPP // PPP
pico_dev = pico_ppp_create(); pico_dev = pico_ppp_create();
@ -1054,7 +1057,7 @@ static void *pico_thread_func(void *)
if (pico_dev) if (pico_dev)
{ {
if (!config::EmulateBBA) if (usingPPP)
{ {
pico_ppp_destroy(pico_dev); pico_ppp_destroy(pico_dev);
} }

View File

@ -108,17 +108,17 @@ void dc_savestate(int index)
std::string filename = hostfs::getSavestatePath(index, true); std::string filename = hostfs::getSavestatePath(index, true);
#if 0 #if 0
FILE *f = nowide::fopen(filename.c_str(), "wb") ; FILE *f = nowide::fopen(filename.c_str(), "wb");
if ( f == NULL ) if ( f == NULL )
{ {
WARN_LOG(SAVESTATE, "Failed to save state - could not open %s for writing", filename.c_str()) ; WARN_LOG(SAVESTATE, "Failed to save state - could not open %s for writing", filename.c_str());
gui_display_notification("Cannot open save file", 2000); gui_display_notification("Cannot open save file", 2000);
free(data); free(data);
return; return;
} }
std::fwrite(data, 1, ser.size(), f) ; std::fwrite(data, 1, ser.size(), f);
std::fclose(f); std::fclose(f);
#else #else
RZipFile zipFile; RZipFile zipFile;
@ -141,7 +141,7 @@ void dc_savestate(int index)
#endif #endif
free(data); free(data);
INFO_LOG(SAVESTATE, "Saved state to %s size %d", filename.c_str(), (int)ser.size()) ; NOTICE_LOG(SAVESTATE, "Saved state to %s size %d", filename.c_str(), (int)ser.size());
gui_display_notification("State saved", 1000); gui_display_notification("State saved", 1000);
} }
@ -169,11 +169,11 @@ void dc_loadstate(int index)
} }
else else
{ {
f = nowide::fopen(filename.c_str(), "rb") ; f = nowide::fopen(filename.c_str(), "rb");
if ( f == NULL ) if ( f == NULL )
{ {
WARN_LOG(SAVESTATE, "Failed to load state - could not open %s for reading", filename.c_str()) ; WARN_LOG(SAVESTATE, "Failed to load state - could not open %s for reading", filename.c_str());
gui_display_notification("Save state not found", 2000); gui_display_notification("Save state not found", 2000);
return; return;
} }
@ -185,9 +185,9 @@ void dc_loadstate(int index)
std::fseek(f, 0, SEEK_SET); std::fseek(f, 0, SEEK_SET);
} }
void *data = malloc(total_size); void *data = malloc(total_size);
if ( data == NULL ) if (data == nullptr)
{ {
WARN_LOG(SAVESTATE, "Failed to load state - could not malloc %d bytes", total_size) ; WARN_LOG(SAVESTATE, "Failed to load state - could not malloc %d bytes", total_size);
gui_display_notification("Failed to load state - memory full", 2000); gui_display_notification("Failed to load state - memory full", 2000);
if (f != nullptr) if (f != nullptr)
std::fclose(f); std::fclose(f);
@ -204,7 +204,7 @@ void dc_loadstate(int index)
} }
else else
{ {
read_size = fread(data, 1, total_size, f) ; read_size = fread(data, 1, total_size, f);
std::fclose(f); std::fclose(f);
} }
if (read_size != total_size) if (read_size != total_size)
@ -218,6 +218,7 @@ void dc_loadstate(int index)
try { try {
Deserializer deser(data, total_size); Deserializer deser(data, total_size);
dc_loadstate(deser); dc_loadstate(deser);
NOTICE_LOG(SAVESTATE, "Loaded state ver %d from %s size %d", deser.version(), filename.c_str(), total_size);
if (deser.size() != total_size) if (deser.size() != total_size)
WARN_LOG(SAVESTATE, "Savestate size %d but only %d bytes used", total_size, (int)deser.size()); WARN_LOG(SAVESTATE, "Savestate size %d but only %d bytes used", total_size, (int)deser.size());
} catch (const Deserializer::Exception& e) { } catch (const Deserializer::Exception& e) {
@ -226,7 +227,6 @@ void dc_loadstate(int index)
free(data); free(data);
EventManager::event(Event::LoadState); EventManager::event(Event::LoadState);
INFO_LOG(SAVESTATE, "Loaded state from %s size %d", filename.c_str(), total_size) ;
} }
#endif #endif

View File

@ -2,6 +2,7 @@
#include "audiostream.h" #include "audiostream.h"
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#include "cfg/cfg.h" #include "cfg/cfg.h"
#include "cfg/option.h"
class AlsaAudioBackend : public AudioBackend class AlsaAudioBackend : public AudioBackend
{ {

View File

@ -13,6 +13,7 @@
*/ */
#if defined(__APPLE__) #if defined(__APPLE__)
#include "audiostream.h" #include "audiostream.h"
#include "cfg/option.h"
#include "stdclass.h" #include "stdclass.h"
#include <atomic> #include <atomic>

View File

@ -1,6 +1,7 @@
#include "build.h" #include "build.h"
#if defined(_WIN32) && !defined(TARGET_UWP) #if defined(_WIN32) && !defined(TARGET_UWP)
#include "audiostream.h" #include "audiostream.h"
#include "cfg/option.h"
#include <initguid.h> #include <initguid.h>
#include <dsound.h> #include <dsound.h>
#include <vector> #include <vector>

View File

@ -18,6 +18,7 @@
*/ */
#ifdef USE_OBOE #ifdef USE_OBOE
#include "audiostream.h" #include "audiostream.h"
#include "cfg/option.h"
#include <oboe/Oboe.h> #include <oboe/Oboe.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>

View File

@ -1,5 +1,6 @@
#if USE_OMX #if USE_OMX
#include "audiostream.h" #include "audiostream.h"
#include "cfg/option.h"
#include <IL/OMX_Broadcom.h> #include <IL/OMX_Broadcom.h>
#include <unistd.h> #include <unistd.h>

View File

@ -1,5 +1,6 @@
#ifdef USE_PULSEAUDIO #ifdef USE_PULSEAUDIO
#include "audiostream.h" #include "audiostream.h"
#include "cfg/option.h"
#include <pulse/pulseaudio.h> #include <pulse/pulseaudio.h>
class PulseAudioBackend : public AudioBackend class PulseAudioBackend : public AudioBackend

View File

@ -2,10 +2,12 @@
#include <SDL.h> #include <SDL.h>
#include "audiostream.h" #include "audiostream.h"
#include "cfg/option.h"
#include "stdclass.h" #include "stdclass.h"
#include <mutex> #include <algorithm>
#include <atomic> #include <atomic>
#include <mutex>
class SDLAudioBackend : AudioBackend class SDLAudioBackend : AudioBackend
{ {

View File

@ -1,5 +1,5 @@
#include "audiostream.h" #include "audiostream.h"
#include <memory> #include "cfg/option.h"
struct SoundFrame { s16 l; s16 r; }; struct SoundFrame { s16 l; s16 r; };

View File

@ -1,9 +1,10 @@
#pragma once #pragma once
#include "types.h" #include "types.h"
#include "cfg/option.h"
#include <vector>
#include <algorithm> #include <algorithm>
#include <atomic> #include <atomic>
#include <string>
#include <vector>
class AudioBackend class AudioBackend
{ {

View File

@ -220,7 +220,7 @@ void uploadCrashes(const std::string& directory)
NOTICE_LOG(COMMON, "Uploading minidump %s", line); NOTICE_LOG(COMMON, "Uploading minidump %s", line);
std::vector<http::PostField> fields; std::vector<http::PostField> fields;
fields.emplace_back("upload_file_minidump", dmpfile, "application/octet-stream"); fields.emplace_back("upload_file_minidump", dmpfile, "application/octet-stream");
fields.emplace_back("flycast_version", std::string(GIT_VERSION)); fields.emplace_back("sentry[release]", std::string(GIT_VERSION));
if (file_exists(logfile)) if (file_exists(logfile))
fields.emplace_back("flycast_log", logfile, "text/plain"); fields.emplace_back("flycast_log", logfile, "text/plain");
// TODO config, gpu/driver, ... // TODO config, gpu/driver, ...

View File

@ -11,7 +11,6 @@ using namespace Xbyak::util;
#include "types.h" #include "types.h"
#include "hw/sh4/sh4_opcode_list.h" #include "hw/sh4/sh4_opcode_list.h"
#include "hw/sh4/dyna/ngen.h" #include "hw/sh4/dyna/ngen.h"
#include "hw/sh4/modules/ccn.h"
#include "hw/sh4/modules/mmu.h" #include "hw/sh4/modules/mmu.h"
#include "hw/sh4/sh4_interrupts.h" #include "hw/sh4/sh4_interrupts.h"

View File

@ -7,7 +7,8 @@
*/ */
#include "descrambl.h" #include "descrambl.h"
#include <algorithm>
#include <utility>
#define MAXCHUNK (2048*1024) #define MAXCHUNK (2048*1024)

View File

@ -16,6 +16,7 @@
#include "hw/holly/holly_intc.h" #include "hw/holly/holly_intc.h"
#include "reios.h" #include "reios.h"
#include "imgread/common.h" #include "imgread/common.h"
#include "hw/sh4/modules/mmu.h"
#include <algorithm> #include <algorithm>
@ -716,7 +717,7 @@ void gdrom_hle_op()
// r4 = request id // r4 = request id
// //
// Returns: GDC_OK, GDC_ERR // Returns: GDC_OK, GDC_ERR
WARN_LOG(REIOS, "GDROM: HLE GDROM_ABORT_COMMAND req id%x", r[4]); INFO_LOG(REIOS, "GDROM: HLE GDROM_ABORT_COMMAND req id%x", r[4]);
if (r[4] == gd_hle_state.last_request_id if (r[4] == gd_hle_state.last_request_id
&& (gd_hle_state.status == GDC_CONTINUE || gd_hle_state.status == GDC_BUSY || gd_hle_state.status == GDC_COMPLETE)) && (gd_hle_state.status == GDC_CONTINUE || gd_hle_state.status == GDC_BUSY || gd_hle_state.status == GDC_COMPLETE))
{ {

View File

@ -18,7 +18,6 @@
#include "hw/sh4/sh4_core.h" #include "hw/sh4/sh4_core.h"
#undef r #undef r
#include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mem.h"
#include "hw/holly/sb_mem.h"
#include "hw/holly/sb.h" #include "hw/holly/sb.h"
#include "hw/naomi/naomi_cart.h" #include "hw/naomi/naomi_cart.h"
#include "font.h" #include "font.h"
@ -28,6 +27,7 @@
#include "imgread/common.h" #include "imgread/common.h"
#include "imgread/isofs.h" #include "imgread/isofs.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
#include "hw/sh4/sh4_mmr.h"
#include <map> #include <map>
@ -69,11 +69,6 @@ static bool reios_locate_bootfile(const char* bootfile)
return false; return false;
} }
reios_pre_init(); reios_pre_init();
if (ip_meta.wince == '1' && descrambl)
{
ERROR_LOG(REIOS, "Unsupported CDI: wince == '1'");
return false;
}
// Load IP.BIN bootstrap // Load IP.BIN bootstrap
libGDR_ReadSector(GetMemPtr(0x8c008000, 0), base_fad, 16, 2048); libGDR_ReadSector(GetMemPtr(0x8c008000, 0), base_fad, 16, 2048);
@ -95,7 +90,7 @@ static bool reios_locate_bootfile(const char* bootfile)
u32 offset = 0; u32 offset = 0;
u32 size = bootFile->getSize(); u32 size = bootFile->getSize();
if (ip_meta.wince == '1') if (ip_meta.wince == '1' && !descrambl)
{ {
bootFile->read(GetMemPtr(0x8ce01000, 2048), 2048); bootFile->read(GetMemPtr(0x8ce01000, 2048), 2048);
offset = 2048; offset = 2048;
@ -394,6 +389,9 @@ static void reios_setup_state(u32 boot_addr)
aicaWriteReg(SCILV1_addr, (u8)0x50); aicaWriteReg(SCILV1_addr, (u8)0x50);
aicaWriteReg(SCILV2_addr, (u8)0x08); aicaWriteReg(SCILV2_addr, (u8)0x08);
// KOS seems to expect this
DMAC_DMAOR.full = 0x8201;
// WinCE needs this to detect PAL // WinCE needs this to detect PAL
if (config::Broadcast == 1) if (config::Broadcast == 1)
BSC_PDTRA.full = 4; BSC_PDTRA.full = 4;

View File

@ -16,8 +16,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>. along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "TexCache.h"
#include "CustomTexture.h" #include "CustomTexture.h"
#include "cfg/cfg.h"
#include "oslib/directory.h" #include "oslib/directory.h"
#include "cfg/option.h" #include "cfg/option.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
@ -182,6 +182,11 @@ void CustomTexture::DumpTexture(u32 hash, int w, int h, TextureType textype, voi
u16 *src = (u16 *)src_buffer; u16 *src = (u16 *)src_buffer;
u8 *dst_buffer = (u8 *)malloc(w * h * 4); // 32-bit per pixel u8 *dst_buffer = (u8 *)malloc(w * h * 4); // 32-bit per pixel
if (dst_buffer == nullptr)
{
ERROR_LOG(RENDERER, "Dump texture: out of memory");
return;
}
u8 *dst = dst_buffer; u8 *dst = dst_buffer;
for (int y = 0; y < h; y++) for (int y = 0; y < h; y++)

View File

@ -3,7 +3,6 @@
#include "deps/xbrz/xbrz.h" #include "deps/xbrz/xbrz.h"
#include "hw/pvr/pvr_mem.h" #include "hw/pvr/pvr_mem.h"
#include "hw/mem/_vmem.h" #include "hw/mem/_vmem.h"
#include "hw/sh4/modules/mmu.h"
#include <algorithm> #include <algorithm>
#include <mutex> #include <mutex>

View File

@ -6,8 +6,10 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <atomic> #include <atomic>
#include <memory> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector>
#include <utility>
extern const u8 *vq_codebook; extern const u8 *vq_codebook;
extern u32 palette_index; extern u32 palette_index;
@ -697,6 +699,9 @@ public:
static void SetDirectXColorOrder(bool enabled); static void SetDirectXColorOrder(bool enabled);
}; };
// TODO Split the texture cache in a separate header
#include "CustomTexture.h"
template<typename Texture> template<typename Texture>
class BaseTextureCache class BaseTextureCache
{ {
@ -785,6 +790,7 @@ public:
void Clear() void Clear()
{ {
custom_texture.Terminate();
for (auto& pair : cache) for (auto& pair : cache)
pair.second.Delete(); pair.second.Delete();

View File

@ -19,10 +19,13 @@
#pragma once #pragma once
#include "scraper.h" #include "scraper.h"
#include "stdclass.h" #include "stdclass.h"
#include <unordered_map>
#include <memory>
#include <future> #include <future>
#include <memory>
#include <mutex> #include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
struct GameMedia; struct GameMedia;

View File

@ -16,10 +16,13 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <map>
#include "scraper.h" #include "scraper.h"
#include "json.hpp" #include "json.hpp"
#include <map>
#include <string>
#include <vector>
using namespace nlohmann; using namespace nlohmann;
class TheGamesDb : public Scraper class TheGamesDb : public Scraper

View File

@ -17,13 +17,13 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <string>
#include <memory>
#include <vector>
#include "types.h" #include "types.h"
#include "json.hpp" #include "json.hpp"
#include <string>
#include <vector>
using namespace nlohmann; using namespace nlohmann;
struct GameBoxart struct GameBoxart

View File

@ -22,6 +22,7 @@
#include "hw/pvr/pvr_mem.h" #include "hw/pvr/pvr_mem.h"
#include "rend/gui.h" #include "rend/gui.h"
#include "rend/tileclip.h" #include "rend/tileclip.h"
#include "rend/sorter.h"
const D3D11_INPUT_ELEMENT_DESC MainLayout[] const D3D11_INPUT_ELEMENT_DESC MainLayout[]
{ {
@ -41,6 +42,11 @@ bool DX11Renderer::Init()
NOTICE_LOG(RENDERER, "DX11 renderer initializing"); NOTICE_LOG(RENDERER, "DX11 renderer initializing");
device = theDX11Context.getDevice(); device = theDX11Context.getDevice();
deviceContext = theDX11Context.getDeviceContext(); deviceContext = theDX11Context.getDeviceContext();
if (!device || !deviceContext)
{
WARN_LOG(RENDERER, "Null device or device context. Aborting");
return false;
}
shaders = &theDX11Context.getShaders(); shaders = &theDX11Context.getShaders();
samplers = &theDX11Context.getSamplers(); samplers = &theDX11Context.getSamplers();

View File

@ -25,7 +25,6 @@
#include "dx11_quad.h" #include "dx11_quad.h"
#include "dx11_texture.h" #include "dx11_texture.h"
#include "dx11_shaders.h" #include "dx11_shaders.h"
#include "rend/sorter.h"
#include "dx11_renderstate.h" #include "dx11_renderstate.h"
#include "dx11_naomi2.h" #include "dx11_naomi2.h"
#ifndef LIBRETRO #ifndef LIBRETRO

View File

@ -141,8 +141,11 @@ bool DX11Context::init(bool keepCurrentWindow)
hr = dxgiFactory->CreateSwapChain(pDevice, &desc, &swapchain.get()); hr = dxgiFactory->CreateSwapChain(pDevice, &desc, &swapchain.get());
} }
if (FAILED(hr)) if (FAILED(hr)) {
WARN_LOG(RENDERER, "D3D11 swap chain creation failed: %x", hr);
pDevice.reset();
return false; return false;
}
#ifndef TARGET_UWP #ifndef TARGET_UWP
// Prevent DXGI from monitoring our message queue for ALT+Enter // Prevent DXGI from monitoring our message queue for ALT+Enter
@ -193,7 +196,11 @@ void DX11Context::Present()
frameRendered = false; frameRendered = false;
bool swapOnVSync = !settings.input.fastForwardMode && config::VSync; bool swapOnVSync = !settings.input.fastForwardMode && config::VSync;
HRESULT hr; HRESULT hr;
if (swapOnVSync) if (!swapchain)
{
hr = DXGI_ERROR_DEVICE_RESET;
}
else if (swapOnVSync)
{ {
int swapInterval = std::min(4, std::max(1, (int)(settings.display.refreshRate / 60))); int swapInterval = std::min(4, std::max(1, (int)(settings.display.refreshRate / 60)));
hr = swapchain->Present(swapInterval, 0); hr = swapchain->Present(swapInterval, 0);
@ -213,25 +220,27 @@ void DX11Context::Present()
void DX11Context::EndImGuiFrame() void DX11Context::EndImGuiFrame()
{ {
verify((bool)pDevice); if (pDevice && pDeviceContext && renderTargetView)
if (!overlayOnly)
{ {
pDeviceContext->OMSetRenderTargets(1, &renderTargetView.get(), nullptr); if (!overlayOnly)
const FLOAT black[4] { 0.f, 0.f, 0.f, 1.f }; {
pDeviceContext->ClearRenderTargetView(renderTargetView, black); pDeviceContext->OMSetRenderTargets(1, &renderTargetView.get(), nullptr);
if (renderer != nullptr) const FLOAT black[4] { 0.f, 0.f, 0.f, 1.f };
renderer->RenderLastFrame(); pDeviceContext->ClearRenderTargetView(renderTargetView, black);
if (renderer != nullptr)
renderer->RenderLastFrame();
}
if (overlayOnly)
{
if (crosshairsNeeded() || config::FloatVMUs)
overlay.draw(settings.display.width, settings.display.height, config::FloatVMUs, true);
}
else
{
overlay.draw(settings.display.width, settings.display.height, true, false);
}
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
} }
if (overlayOnly)
{
if (crosshairsNeeded() || config::FloatVMUs)
overlay.draw(settings.display.width, settings.display.height, config::FloatVMUs, true);
}
else
{
overlay.draw(settings.display.width, settings.display.height, true, false);
}
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
frameRendered = true; frameRendered = true;
} }
@ -293,6 +302,7 @@ void DX11Context::resize()
swapchain->GetDesc(&desc); swapchain->GetDesc(&desc);
settings.display.width = desc.BufferDesc.Width; settings.display.width = desc.BufferDesc.Width;
settings.display.height = desc.BufferDesc.Height; settings.display.height = desc.BufferDesc.Height;
NOTICE_LOG(RENDERER, "Swapchain resized: %d x %d", desc.BufferDesc.Width, desc.BufferDesc.Height);
} }
} }
// TODO minimized window // TODO minimized window
@ -300,10 +310,23 @@ void DX11Context::resize()
void DX11Context::handleDeviceLost() void DX11Context::handleDeviceLost()
{ {
if (pDevice)
{
HRESULT hr = pDevice->GetDeviceRemovedReason();
WARN_LOG(RENDERER, "Device removed reason: %x", hr);
}
rend_term_renderer(); rend_term_renderer();
term(); term();
init(true); if (init(true))
rend_init_renderer(); {
rend_init_renderer();
}
else
{
Renderer* rend_norend();
renderer = rend_norend();
renderer->Init();
}
} }
#endif // !LIBRETRO #endif // !LIBRETRO

View File

@ -22,10 +22,8 @@
#include "../dx11context.h" #include "../dx11context.h"
#include "../dx11_renderer.h" #include "../dx11_renderer.h"
#include "rend/transform_matrix.h" #include "rend/transform_matrix.h"
#include "../dx11_quad.h"
#include "../dx11_texture.h" #include "../dx11_texture.h"
#include "dx11_oitshaders.h" #include "dx11_oitshaders.h"
#include "rend/sorter.h"
#include "../dx11_renderstate.h" #include "../dx11_renderstate.h"
#include "dx11_oitbuffers.h" #include "dx11_oitbuffers.h"
#include "dx11_oitshaders.h" #include "dx11_oitshaders.h"

View File

@ -20,6 +20,7 @@
#include "rend/osd.h" #include "rend/osd.h"
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtx/transform.hpp> #include <glm/gtx/transform.hpp>
#include <tuple>
void D3DOverlay::drawQuad(const RECT& rect, D3DCOLOR color) void D3DOverlay::drawQuad(const RECT& rect, D3DCOLOR color)
{ {

View File

@ -65,7 +65,13 @@ public:
{ {
ComPtr<IDirect3DTexture9>& texture = textures[name]; ComPtr<IDirect3DTexture9>& texture = textures[name];
texture.reset(); texture.reset();
theDXContext.getDevice()->CreateTexture(width, height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture.get(), 0); HRESULT hr = theDXContext.getDevice()->CreateTexture(width, height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture.get(), 0);
if (FAILED(hr) || !texture)
{
WARN_LOG(RENDERER, "CreateTexture failed (%d x %d): error %x", width, height, hr);
textures.erase(name);
return ImTextureID();
}
width *= 4; width *= 4;

View File

@ -17,6 +17,7 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "gl4naomi2.h" #include "gl4naomi2.h"
#include "rend/gl4/gl4.h"
extern const char *N2VertexShader; extern const char *N2VertexShader;
extern const char *N2ColorShader; extern const char *N2ColorShader;

View File

@ -18,7 +18,6 @@
*/ */
#pragma once #pragma once
#include "gl4.h" #include "gl4.h"
#include "rend/gles/naomi2.h"
class N2Vertex4Source : public OpenGl4Source class N2Vertex4Source : public OpenGl4Source
{ {

View File

@ -18,9 +18,9 @@
*/ */
#include "gl4.h" #include "gl4.h"
#include "rend/gles/glcache.h" #include "rend/gles/glcache.h"
#include "rend/gles/naomi2.h"
#include "rend/tileclip.h" #include "rend/tileclip.h"
#include "rend/osd.h" #include "rend/osd.h"
#include "gl4naomi2.h"
static gl4PipelineShader* CurrentShader; static gl4PipelineShader* CurrentShader;
extern u32 gcflip; extern u32 gcflip;
@ -236,7 +236,7 @@ static void SetGPState(const PolyParam* gp)
if (nearest_filter) if (nearest_filter)
{ {
//nearest-neighbor filtering //nearest-neighbor filtering
glSamplerParameteri(texSamplers[i], GL_TEXTURE_MIN_FILTER, mipmapped ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST); glSamplerParameteri(texSamplers[i], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glSamplerParameteri(texSamplers[i], GL_TEXTURE_MAG_FILTER, GL_NEAREST); glSamplerParameteri(texSamplers[i], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
} }
else else

View File

@ -22,7 +22,11 @@
#include "rend/osd.h" #include "rend/osd.h"
#include "glsl.h" #include "glsl.h"
#include "gl4naomi2.h" #include "gl4naomi2.h"
#include "rend/gles/naomi2.h"
#ifdef LIBRETRO
#include "rend/gles/postprocess.h" #include "rend/gles/postprocess.h"
#endif
//Fragment and vertex shaders code //Fragment and vertex shaders code

View File

@ -1,6 +1,5 @@
#include "glcache.h" #include "glcache.h"
#include "gles.h" #include "gles.h"
#include "rend/sorter.h"
#include "rend/tileclip.h" #include "rend/tileclip.h"
#include "rend/osd.h" #include "rend/osd.h"
#include "naomi2.h" #include "naomi2.h"
@ -190,7 +189,7 @@ void SetGPState(const PolyParam* gp,u32 cflip=0)
if (nearest_filter) if (nearest_filter)
{ {
//nearest-neighbor filtering //nearest-neighbor filtering
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, mipmapped ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST); glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
} }
else else

View File

@ -1,6 +1,5 @@
#include "glcache.h" #include "glcache.h"
#include "gles.h" #include "gles.h"
#include "cfg/cfg.h"
#include "hw/pvr/ta.h" #include "hw/pvr/ta.h"
#ifndef LIBRETRO #ifndef LIBRETRO
#include "rend/gui.h" #include "rend/gui.h"
@ -15,6 +14,10 @@
#include "naomi2.h" #include "naomi2.h"
#include "rend/gles/postprocess.h" #include "rend/gles/postprocess.h"
#ifdef TEST_AUTOMATION
#include "cfg/cfg.h"
#endif
#include <cmath> #include <cmath>
#ifdef GLES #ifdef GLES

View File

@ -3,8 +3,7 @@
#include "hw/pvr/pvr_mem.h" #include "hw/pvr/pvr_mem.h"
#include "rend/TexCache.h" #include "rend/TexCache.h"
#include <cstdio> #include <memory>
#include <cstdlib>
GlTextureCache TexCache; GlTextureCache TexCache;

View File

@ -17,9 +17,9 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <array>
#include "postprocess.h" #include "postprocess.h"
#include "cfg/option.h"
#include <array>
PostProcessor postProcessor; PostProcessor postProcessor;

View File

@ -16,23 +16,18 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <mutex>
#include "gui.h" #include "gui.h"
#include "osd.h" #include "osd.h"
#include "cfg/cfg.h" #include "cfg/cfg.h"
#include "hw/maple/maple_if.h" #include "hw/maple/maple_if.h"
#include "hw/maple/maple_devs.h" #include "hw/maple/maple_devs.h"
#include "hw/naomi/naomi_cart.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui/roboto_medium.h" #include "imgui/roboto_medium.h"
#include "network/net_handshake.h" #include "network/net_handshake.h"
#include "network/ggpo.h" #include "network/ggpo.h"
#include "wsi/context.h" #include "wsi/context.h"
#include "input/gamepad_device.h" #include "input/gamepad_device.h"
#include "input/mouse.h"
#include "gui_util.h" #include "gui_util.h"
#include "gui_android.h"
#include "game_scanner.h" #include "game_scanner.h"
#include "version.h" #include "version.h"
#include "oslib/oslib.h" #include "oslib/oslib.h"
@ -51,6 +46,12 @@
#include "sdl/sdl.h" #include "sdl/sdl.h"
#endif #endif
#ifdef __ANDROID__
#include "gui_android.h"
#endif
#include <mutex>
static bool game_started; static bool game_started;
int insetLeft, insetRight, insetTop, insetBottom; int insetLeft, insetRight, insetTop, insetBottom;
@ -432,6 +433,7 @@ void gui_set_insets(int left, int right, int top, int bottom)
#if 0 #if 0
#include "oslib/timeseries.h" #include "oslib/timeseries.h"
#include <vector>
TimeSeries renderTimes; TimeSeries renderTimes;
TimeSeries vblankTimes; TimeSeries vblankTimes;
@ -518,48 +520,40 @@ static void gui_display_commands()
ImGui::Begin("##commands", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize); ImGui::Begin("##commands", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize);
bool loadSaveStateDisabled = settings.content.path.empty() || settings.network.online || settings.naomi.multiboard;
if (loadSaveStateDisabled)
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
// Load State
if (ImGui::Button("Load State", ScaledVec2(110, 50)) && !loadSaveStateDisabled)
{
gui_state = GuiState::Closed;
dc_loadstate(config::SavestateSlot);
}
ImGui::SameLine();
// Slot #
std::string slot = "Slot " + std::to_string((int)config::SavestateSlot + 1);
if (ImGui::Button(slot.c_str(), ImVec2(80 * settings.display.uiScale - ImGui::GetStyle().FramePadding.x, 50 * settings.display.uiScale)))
ImGui::OpenPopup("slot_select_popup");
if (ImGui::BeginPopup("slot_select_popup"))
{ {
for (int i = 0; i < 10; i++) DisabledScope scope(settings.content.path.empty() || settings.network.online || settings.naomi.multiboard);
if (ImGui::Selectable(std::to_string(i + 1).c_str(), config::SavestateSlot == i, 0,
ImVec2(ImGui::CalcTextSize("Slot 8").x, 0))) {
config::SavestateSlot = i;
SaveSettings();
}
ImGui::EndPopup();
}
ImGui::SameLine();
// Save State // Load State
if (ImGui::Button("Save State", ScaledVec2(110, 50)) && !loadSaveStateDisabled) if (ImGui::Button("Load State", ScaledVec2(110, 50)) && !scope.isDisabled())
{ {
gui_state = GuiState::Closed; gui_state = GuiState::Closed;
dc_savestate(config::SavestateSlot); dc_loadstate(config::SavestateSlot);
} }
if (loadSaveStateDisabled) ImGui::SameLine();
{
ImGui::PopItemFlag(); // Slot #
ImGui::PopStyleVar(); std::string slot = "Slot " + std::to_string((int)config::SavestateSlot + 1);
} if (ImGui::Button(slot.c_str(), ImVec2(80 * settings.display.uiScale - ImGui::GetStyle().FramePadding.x, 50 * settings.display.uiScale)))
ImGui::OpenPopup("slot_select_popup");
if (ImGui::BeginPopup("slot_select_popup"))
{
for (int i = 0; i < 10; i++)
if (ImGui::Selectable(std::to_string(i + 1).c_str(), config::SavestateSlot == i, 0,
ImVec2(ImGui::CalcTextSize("Slot 8").x, 0))) {
config::SavestateSlot = i;
SaveSettings();
}
ImGui::EndPopup();
}
ImGui::SameLine();
// Save State
if (ImGui::Button("Save State", ScaledVec2(110, 50)) && !scope.isDisabled())
{
gui_state = GuiState::Closed;
dc_savestate(config::SavestateSlot);
}
}
ImGui::Columns(2, "buttons", false); ImGui::Columns(2, "buttons", false);
@ -594,19 +588,11 @@ static void gui_display_commands()
ImGui::NextColumn(); ImGui::NextColumn();
// Cheats // Cheats
if (settings.network.online)
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(settings.network.online);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
} if (ImGui::Button("Cheats", ScaledVec2(150, 50)) && !settings.network.online)
if (ImGui::Button("Cheats", ScaledVec2(150, 50)) && !settings.network.online) gui_state = GuiState::Cheats;
{
gui_state = GuiState::Cheats;
}
if (settings.network.online)
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
} }
ImGui::Columns(1, nullptr, false); ImGui::Columns(1, nullptr, false);
@ -1360,27 +1346,21 @@ static void gui_display_settings()
"BIOS region"); "BIOS region");
const char *cable[] = { "VGA", "RGB Component", "TV Composite" }; const char *cable[] = { "VGA", "RGB Component", "TV Composite" };
if (config::Cable.isReadOnly())
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(config::Cable.isReadOnly());
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
} if (ImGui::BeginCombo("Cable", cable[config::Cable == 0 ? 0 : config::Cable - 1], ImGuiComboFlags_None))
if (ImGui::BeginCombo("Cable", cable[config::Cable == 0 ? 0 : config::Cable - 1], ImGuiComboFlags_None))
{
for (int i = 0; i < IM_ARRAYSIZE(cable); i++)
{ {
bool is_selected = i == 0 ? config::Cable <= 1 : config::Cable - 1 == i; for (int i = 0; i < IM_ARRAYSIZE(cable); i++)
if (ImGui::Selectable(cable[i], &is_selected)) {
config::Cable = i == 0 ? 0 : i + 1; bool is_selected = i == 0 ? config::Cable <= 1 : config::Cable - 1 == i;
if (is_selected) if (ImGui::Selectable(cable[i], &is_selected))
ImGui::SetItemDefaultFocus(); config::Cable = i == 0 ? 0 : i + 1;
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
} }
ImGui::EndCombo();
}
if (config::Cable.isReadOnly())
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
} }
ImGui::SameLine(); ImGui::SameLine();
ShowHelpMarker("Video connection type"); ShowHelpMarker("Video connection type");
@ -1751,19 +1731,13 @@ static void gui_display_settings()
OptionCheckbox("Fog", config::Fog, "Enable fog effects"); OptionCheckbox("Fog", config::Fog, "Enable fog effects");
OptionCheckbox("Widescreen", config::Widescreen, OptionCheckbox("Widescreen", config::Widescreen,
"Draw geometry outside of the normal 4:3 aspect ratio. May produce graphical glitches in the revealed areas.\nAspect Fit and shows the full 16:9 content."); "Draw geometry outside of the normal 4:3 aspect ratio. May produce graphical glitches in the revealed areas.\nAspect Fit and shows the full 16:9 content.");
if (!config::Widescreen) {
{ DisabledScope scope(!config::Widescreen);
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f); ImGui::Indent();
} OptionCheckbox("Super Widescreen", config::SuperWidescreen,
ImGui::Indent(); "Use the full width of the screen or window when its aspect ratio is greater than 16:9.\nAspect Fill and remove black bars.");
OptionCheckbox("Super Widescreen", config::SuperWidescreen, ImGui::Unindent();
"Use the full width of the screen or window when its aspect ratio is greater than 16:9.\nAspect Fill and remove black bars.");
ImGui::Unindent();
if (!config::Widescreen)
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
} }
OptionCheckbox("Widescreen Game Cheats", config::WidescreenGameHacks, OptionCheckbox("Widescreen Game Cheats", config::WidescreenGameHacks,
"Modify the game so that it displays in 16:9 anamorphic format and use horizontal screen stretching. Only some games are supported."); "Modify the game so that it displays in 16:9 anamorphic format and use horizontal screen stretching. Only some games are supported.");
@ -1824,16 +1798,10 @@ static void gui_display_settings()
if (isVulkan(config::RendererType)) if (isVulkan(config::RendererType))
{ {
ImGui::Indent(); ImGui::Indent();
if (!config::VSync) {
{ DisabledScope scope(!config::VSync);
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f); OptionCheckbox("Duplicate frames", config::DupeFrames, "Duplicate frames on high refresh rate monitors (120 Hz and higher)");
}
OptionCheckbox("Duplicate frames", config::DupeFrames, "Duplicate frames on high refresh rate monitors (120 Hz and higher)");
if (!config::VSync)
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
} }
ImGui::Unindent(); ImGui::Unindent();
} }
@ -2173,8 +2141,12 @@ static void gui_display_settings()
ImGui::Spacing(); ImGui::Spacing();
header("Network"); header("Network");
{ {
OptionCheckbox("Broadband Adapter Emulation", config::EmulateBBA, {
"Emulate the Ethernet Broadband Adapter (BBA) instead of the Modem"); DisabledScope scope(game_started);
OptionCheckbox("Broadband Adapter Emulation", config::EmulateBBA,
"Emulate the Ethernet Broadband Adapter (BBA) instead of the Modem");
}
OptionCheckbox("Enable GGPO Networking", config::GGPOEnable, OptionCheckbox("Enable GGPO Networking", config::GGPOEnable,
"Enable networking using GGPO"); "Enable networking using GGPO");
OptionCheckbox("Enable Naomi Networking", config::NetworkEnable, OptionCheckbox("Enable Naomi Networking", config::NetworkEnable,

View File

@ -18,7 +18,8 @@
*/ */
#pragma once #pragma once
#include "types.h" #include "types.h"
#include "cfg/option.h"
#include <string>
void gui_init(); void gui_init();
void gui_initFonts(); void gui_initFonts();

View File

@ -27,7 +27,6 @@
#include "oslib/directory.h" #include "oslib/directory.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui/imgui_internal.h" #include "imgui/imgui_internal.h"
#include "hw/maple/maple_devs.h"
#define STBI_ONLY_JPEG #define STBI_ONLY_JPEG
#define STBI_ONLY_PNG #define STBI_ONLY_PNG
#include <stb_image.h> #include <stb_image.h>
@ -636,20 +635,15 @@ void ShowHelpMarker(const char* desc)
template<bool PerGameOption> template<bool PerGameOption>
bool OptionCheckbox(const char *name, config::Option<bool, PerGameOption>& option, const char *help) bool OptionCheckbox(const char *name, config::Option<bool, PerGameOption>& option, const char *help)
{ {
bool b = option; bool pressed;
if (option.isReadOnly())
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(option.isReadOnly());
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
bool b = option;
pressed = ImGui::Checkbox(name, &b);
if (pressed)
option.set(b);
} }
bool pressed = ImGui::Checkbox(name, &b);
if (option.isReadOnly())
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
if (pressed)
option.set(b);
if (help != nullptr) if (help != nullptr)
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -662,20 +656,15 @@ template bool OptionCheckbox(const char *name, config::Option<bool, false>& opti
bool OptionSlider(const char *name, config::Option<int>& option, int min, int max, const char *help) bool OptionSlider(const char *name, config::Option<int>& option, int min, int max, const char *help)
{ {
int v = option; bool valueChanged;
if (option.isReadOnly())
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(option.isReadOnly());
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
int v = option;
valueChanged = ImGui::SliderInt(name, &v, min, max);
if (valueChanged)
option.set(v);
} }
bool valueChanged = ImGui::SliderInt(name, &v, min, max);
if (option.isReadOnly())
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
else if (valueChanged)
option.set(v);
if (help != nullptr) if (help != nullptr)
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -696,24 +685,18 @@ bool OptionArrowButtons(const char *name, config::Option<int>& option, int min,
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::SameLine(0.0f, innerSpacing); ImGui::SameLine(0.0f, innerSpacing);
ImGui::PushButtonRepeat(true); ImGui::PushButtonRepeat(true);
bool valueChanged = false; bool valueChanged = false;
if (option.isReadOnly())
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(option.isReadOnly());
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
if (ImGui::ArrowButton((id + "left").c_str(), ImGuiDir_Left)) { option.set(std::max(min, option - 1)); valueChanged = true; }
ImGui::SameLine(0.0f, innerSpacing);
if (ImGui::ArrowButton((id + "right").c_str(), ImGuiDir_Right)) { option.set(std::min(max, option + 1)); valueChanged = true; }
} }
if (ImGui::ArrowButton((id + "left").c_str(), ImGuiDir_Left)) { option.set(std::max(min, option - 1)); valueChanged = true; } ImGui::PopButtonRepeat();
ImGui::SameLine(0.0f, innerSpacing); ImGui::SameLine(0.0f, innerSpacing);
if (ImGui::ArrowButton((id + "right").c_str(), ImGuiDir_Right)) { option.set(std::min(max, option + 1)); valueChanged = true; } ImGui::Text("%s", name);
if (option.isReadOnly())
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
ImGui::PopButtonRepeat();
ImGui::SameLine(0.0f, innerSpacing);
ImGui::Text("%s", name);
if (help != nullptr) if (help != nullptr)
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -725,20 +708,15 @@ bool OptionArrowButtons(const char *name, config::Option<int>& option, int min,
template<typename T> template<typename T>
bool OptionRadioButton(const char *name, config::Option<T>& option, T value, const char *help) bool OptionRadioButton(const char *name, config::Option<T>& option, T value, const char *help)
{ {
int v = (int)option; bool pressed;
if (option.isReadOnly())
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(option.isReadOnly());
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
int v = (int)option;
pressed = ImGui::RadioButton(name, &v, (int)value);
if (pressed)
option.set((T)v);
} }
bool pressed = ImGui::RadioButton(name, &v, (int)value);
if (option.isReadOnly())
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
if (pressed)
option.set((T)v);
if (help != nullptr) if (help != nullptr)
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -752,27 +730,21 @@ template bool OptionRadioButton<int>(const char *name, config::Option<int>& opti
void OptionComboBox(const char *name, config::Option<int>& option, const char *values[], int count, void OptionComboBox(const char *name, config::Option<int>& option, const char *values[], int count,
const char *help) const char *help)
{ {
if (option.isReadOnly())
{ {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); DisabledScope scope(option.isReadOnly());
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
} if (ImGui::BeginCombo(name, values[option], ImGuiComboFlags_None))
if (ImGui::BeginCombo(name, values[option], ImGuiComboFlags_None))
{
for (int i = 0; i < count; i++)
{ {
bool is_selected = option == i; for (int i = 0; i < count; i++)
if (ImGui::Selectable(values[i], &is_selected)) {
option = i; bool is_selected = option == i;
if (is_selected) if (ImGui::Selectable(values[i], &is_selected))
ImGui::SetItemDefaultFocus(); option = i;
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
} }
ImGui::EndCombo();
}
if (option.isReadOnly())
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
} }
if (help != nullptr) if (help != nullptr)
{ {

View File

@ -18,14 +18,17 @@
*/ */
#pragma once #pragma once
#include <string>
#include "types.h" #include "types.h"
#include "cfg/option.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui/imgui_internal.h" #include "imgui/imgui_internal.h"
#include "gui.h" #include "gui.h"
#include "emulator.h" #include "emulator.h"
#include "stdclass.h"
#include <algorithm>
#include <chrono>
#include <future>
#include <string>
typedef bool (*StringCallback)(bool cancelled, std::string selection); typedef bool (*StringCallback)(bool cancelled, std::string selection);
@ -138,3 +141,30 @@ inline static ImVec2 operator/(const ImVec2& v, float f) {
} }
u8 *loadImage(const std::string& path, int& width, int& height); u8 *loadImage(const std::string& path, int& width, int& height);
class DisabledScope
{
public:
DisabledScope(bool disabled) : disabled(disabled)
{
if (disabled)
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
}
~DisabledScope()
{
if (disabled)
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
}
bool isDisabled() const {
return disabled;
}
private:
bool disabled;
};

View File

@ -16,8 +16,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>. along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <chrono>
#include <thread>
#include "mainui.h" #include "mainui.h"
#include "hw/pvr/Renderer_if.h" #include "hw/pvr/Renderer_if.h"
#include "gui.h" #include "gui.h"
@ -27,7 +26,9 @@
#include "emulator.h" #include "emulator.h"
#include "imgui_driver.h" #include "imgui_driver.h"
#include "profiler/fc_profiler.h" #include "profiler/fc_profiler.h"
#include <chrono> #include <chrono>
#include <thread>
static bool mainui_enabled; static bool mainui_enabled;
u32 MainFrameCount; u32 MainFrameCount;

View File

@ -1,4 +1,5 @@
#include "hw/pvr/ta.h" #include "hw/pvr/ta.h"
#include "hw/pvr/ta_ctx.h"
#include "hw/pvr/Renderer_if.h" #include "hw/pvr/Renderer_if.h"
struct norend : Renderer struct norend : Renderer

View File

@ -18,8 +18,7 @@
#include "types.h" #include "types.h"
#include "input/gamepad.h" #include "input/gamepad.h"
#include "input/gamepad_device.h" #include "input/gamepad_device.h"
#include "TexCache.h" #include "stdclass.h"
#include "hw/maple/maple_devs.h"
#ifdef LIBRETRO #ifdef LIBRETRO
#include "vmu_xhair.h" #include "vmu_xhair.h"
#endif #endif

View File

@ -15,7 +15,6 @@
along with reicast. If not, see <https://www.gnu.org/licenses/>. along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include "types.h"
#include "hw/pvr/ta_ctx.h" #include "hw/pvr/ta_ctx.h"
// Use the first vertex as provoking vertex for flat-shaded triangles // Use the first vertex as provoking vertex for flat-shaded triangles

Some files were not shown because too many files have changed in this diff Show More