don't save flash if no game started. libretro: fix notifications
compilation warnings, non-functional changes
This commit is contained in:
parent
c458a8f5e7
commit
de060d66ab
|
@ -110,7 +110,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
|
|||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||
-fno-strict-aliasing)
|
||||
-fno-strict-aliasing -Wall)
|
||||
elseif(MSVC)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /GR- /GS-)
|
||||
endif()
|
||||
|
|
|
@ -81,9 +81,9 @@ int setconfig(char** arg,int cl)
|
|||
const char* constval = value;
|
||||
if (constval==0)
|
||||
constval="";
|
||||
INFO_LOG(COMMON, "Virtual cfg %s:%s=%s", sect, key, value);
|
||||
INFO_LOG(COMMON, "Virtual cfg %s:%s=%s", sect, key, constval);
|
||||
|
||||
cfgSetVirtual(sect,key,value);
|
||||
cfgSetVirtual(sect, key, constval);
|
||||
rv++;
|
||||
|
||||
if (cl>=3 && stricmp(arg[2],",")==0)
|
||||
|
|
|
@ -455,7 +455,7 @@ void dc_start_game(const char *path)
|
|||
{
|
||||
// Boot BIOS
|
||||
if (!LoadRomFiles())
|
||||
throw ReicastException("No BIOS file found in " + get_writable_data_path(""));
|
||||
throw FlycastException("No BIOS file found in " + get_writable_data_path(""));
|
||||
TermDrive();
|
||||
InitDrive();
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ void dc_start_game(const char *path)
|
|||
// Content load failed. Boot the BIOS
|
||||
settings.imgread.ImagePath[0] = '\0';
|
||||
if (!LoadRomFiles())
|
||||
throw ReicastException("This media cannot be loaded");
|
||||
throw FlycastException("This media cannot be loaded");
|
||||
InitDrive();
|
||||
}
|
||||
}
|
||||
|
@ -598,7 +598,8 @@ void dc_stop()
|
|||
sh4_cpu.Stop();
|
||||
rend_cancel_emu_wait();
|
||||
emuThread.WaitToEnd();
|
||||
SaveRomFiles();
|
||||
if (settings.gameStarted)
|
||||
SaveRomFiles();
|
||||
if (running)
|
||||
EventManager::event(Event::Pause);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ void SaveSettings();
|
|||
|
||||
extern std::atomic<bool> loading_canceled;
|
||||
|
||||
int reicast_init(int argc, char* argv[]);
|
||||
int flycast_init(int argc, char* argv[]);
|
||||
void dc_reset(bool hard);
|
||||
void dc_init();
|
||||
void* dc_run(void*);
|
||||
|
|
|
@ -557,7 +557,7 @@ public:
|
|||
set_flags = op.flags & ArmOp::OP_SETS_FLAGS;
|
||||
logical_op_set_flags = op.isLogicalOp() && set_flags;
|
||||
set_carry_bit = false;
|
||||
bool save_v_flag = true; // FIXME is this needed?
|
||||
//bool save_v_flag = true; // FIXME is this needed?
|
||||
|
||||
Label *condLabel = nullptr;
|
||||
|
||||
|
@ -600,7 +600,7 @@ public:
|
|||
B(&arm_dispatch_label);
|
||||
|
||||
FinalizeCode();
|
||||
verify(GetBuffer()->GetCursorOffset() <= GetBuffer()->GetCapacity());
|
||||
verify((size_t)GetBuffer()->GetCursorOffset() <= GetBuffer()->GetCapacity());
|
||||
vmem_platform_flush_cache(
|
||||
recompiler::writeToExec(GetBuffer()->GetStartAddress<void*>()), recompiler::writeToExec(GetBuffer()->GetEndAddress<void*>()),
|
||||
GetBuffer()->GetStartAddress<void*>(), GetBuffer()->GetEndAddress<void*>());
|
||||
|
|
|
@ -470,6 +470,8 @@ struct DCFlashChip : MemChip
|
|||
*size = 64 * 1024;
|
||||
break;
|
||||
default:
|
||||
*offset = 0;
|
||||
*size = 0;
|
||||
die("unknown partition");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ void load_naomi_eeprom()
|
|||
FILE* f = nowide::fopen(eeprom_file.c_str(), "rb");
|
||||
if (f)
|
||||
{
|
||||
std::fread(EEPROM, 1, 0x80, f);
|
||||
if (std::fread(EEPROM, 1, 0x80, f) != 0x80)
|
||||
WARN_LOG(MAPLE, "Failed or truncated read of EEPROM '%s'", eeprom_file.c_str());
|
||||
std::fclose(f);
|
||||
DEBUG_LOG(MAPLE, "Loaded EEPROM from %s", eeprom_file.c_str());
|
||||
}
|
||||
|
@ -242,7 +243,7 @@ private:
|
|||
u32 source = NaomiGameInputs->buttons[i].source;
|
||||
int keyIdx = 0;
|
||||
for (; keyIdx < 32; keyIdx++)
|
||||
if (1 << keyIdx == source)
|
||||
if (1u << keyIdx == source)
|
||||
break;
|
||||
verify(keyIdx < 32);
|
||||
p1_mapping[keyIdx] = NaomiGameInputs->buttons[i].p1_target;
|
||||
|
|
|
@ -366,7 +366,7 @@ static void naomi_cart_LoadZip(const char *filename)
|
|||
strcpy(naomi_game_id, game->name);
|
||||
NOTICE_LOG(NAOMI, "NAOMI GAME ID [%s]", naomi_game_id);
|
||||
|
||||
} catch (const ReicastException& ex) {
|
||||
} catch (const FlycastException& ex) {
|
||||
delete CurrentCartridge;
|
||||
CurrentCartridge = NULL;
|
||||
|
||||
|
@ -393,7 +393,7 @@ void naomi_cart_LoadRom(const char* file)
|
|||
if (!loadBios("naomi", NULL, NULL, -1))
|
||||
{
|
||||
if (!bios_loaded)
|
||||
throw new ReicastException("Error: cannot load BIOS from naomi.zip");
|
||||
throw FlycastException("Error: cannot load BIOS from naomi.zip");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,14 +412,14 @@ void naomi_cart_LoadRom(const char* file)
|
|||
|
||||
FILE *fl = nowide::fopen(file, "r");
|
||||
if (!fl)
|
||||
throw new ReicastException("Error: can't open " + std::string(file));
|
||||
throw FlycastException("Error: can't open " + std::string(file));
|
||||
|
||||
char t[512];
|
||||
char* line = std::fgets(t, sizeof(t), fl);
|
||||
if (!line)
|
||||
{
|
||||
std::fclose(fl);
|
||||
throw new ReicastException("Error: Invalid LST file");
|
||||
throw FlycastException("Error: Invalid LST file");
|
||||
}
|
||||
|
||||
char* eon = strstr(line, "\n");
|
||||
|
@ -435,7 +435,7 @@ void naomi_cart_LoadRom(const char* file)
|
|||
if (!line)
|
||||
{
|
||||
std::fclose(fl);
|
||||
throw new ReicastException("Error: Invalid LST file");
|
||||
throw FlycastException("Error: Invalid LST file");
|
||||
}
|
||||
|
||||
while (line)
|
||||
|
@ -461,7 +461,7 @@ void naomi_cart_LoadRom(const char* file)
|
|||
// BIN loading
|
||||
FILE* fp = nowide::fopen(file, "rb");
|
||||
if (fp == NULL)
|
||||
throw new ReicastException("Error: can't open " + std::string(file));
|
||||
throw FlycastException("Error: can't open " + std::string(file));
|
||||
|
||||
std::fseek(fp, 0, SEEK_END);
|
||||
u32 file_size = (u32)std::ftell(fp);
|
||||
|
@ -521,7 +521,7 @@ void naomi_cart_LoadRom(const char* file)
|
|||
if (load_error)
|
||||
{
|
||||
free(romBase);
|
||||
throw new ReicastException("Error: Failed to load BIN/DAT file");
|
||||
throw FlycastException("Error: Failed to load BIN/DAT file");
|
||||
}
|
||||
|
||||
DEBUG_LOG(NAOMI, "Legacy ROM loaded successfully");
|
||||
|
|
|
@ -77,10 +77,10 @@ private:
|
|||
u8 naomi_cart_ram[64 * 1024];
|
||||
};
|
||||
|
||||
class NaomiCartException : public ReicastException
|
||||
class NaomiCartException : public FlycastException
|
||||
{
|
||||
public:
|
||||
NaomiCartException(std::string reason) : ReicastException(reason) {}
|
||||
NaomiCartException(const std::string& reason) : FlycastException(reason) {}
|
||||
};
|
||||
|
||||
void naomi_cart_LoadRom(const char* file);
|
||||
|
|
|
@ -128,12 +128,6 @@ static void dec_End(u32 dst, BlockEndType flags, bool delaySlot)
|
|||
verify(state.JumpAddr != NullAddress);
|
||||
}
|
||||
|
||||
#define GetN(str) ((str>>8) & 0xf)
|
||||
#define GetM(str) ((str>>4) & 0xf)
|
||||
#define GetImm4(str) ((str>>0) & 0xf)
|
||||
#define GetImm8(str) ((str>>0) & 0xff)
|
||||
#define GetSImm8(str) ((s8)((str>>0) & 0xff))
|
||||
|
||||
#define SR_STATUS_MASK 0x700083F2
|
||||
#define SR_T_MASK 1
|
||||
|
||||
|
|
|
@ -75,5 +75,11 @@ struct state_t
|
|||
};
|
||||
|
||||
const u32 NullAddress = 0xFFFFFFFF;
|
||||
|
||||
#define GetN(str) ((str>>8) & 0xf)
|
||||
#define GetM(str) ((str>>4) & 0xf)
|
||||
#define GetImm4(str) ((str>>0) & 0xf)
|
||||
#define GetImm8(str) ((str>>0) & 0xff)
|
||||
#define GetSImm8(str) ((s8)((str>>0) & 0xff))
|
||||
#define GetImm12(str) ((str>>0) & 0xfff)
|
||||
#define GetSImm12(str) (((short)((GetImm12(str))<<4))>>4)
|
||||
|
|
|
@ -13,14 +13,6 @@
|
|||
#include "hw/sh4/sh4_cache.h"
|
||||
#include "debug/gdb_server.h"
|
||||
|
||||
#define GetN(str) ((str>>8) & 0xf)
|
||||
#define GetM(str) ((str>>4) & 0xf)
|
||||
#define GetImm4(str) ((str>>0) & 0xf)
|
||||
#define GetImm8(str) ((str>>0) & 0xff)
|
||||
#define GetSImm8(str) ((s8)((str>>0) & 0xff))
|
||||
#define GetImm12(str) ((str>>0) & 0xfff)
|
||||
#define GetSImm12(str) (((s16)((GetImm12(str))<<4))>>4)
|
||||
|
||||
#define iNimp cpu_iNimp
|
||||
|
||||
//Read Mem macros
|
||||
|
|
|
@ -530,7 +530,7 @@ void MMU_init()
|
|||
}
|
||||
mmu_set_state();
|
||||
// pre-fill kernel memory
|
||||
for (int vpn = ARRAY_SIZE(mmuAddressLUT) / 2; vpn < ARRAY_SIZE(mmuAddressLUT); vpn++)
|
||||
for (u32 vpn = ARRAY_SIZE(mmuAddressLUT) / 2; vpn < ARRAY_SIZE(mmuAddressLUT); vpn++)
|
||||
mmuAddressLUT[vpn] = vpn << 12;
|
||||
}
|
||||
|
||||
|
|
|
@ -336,6 +336,8 @@ void SetMemoryHandlers()
|
|||
return;
|
||||
}
|
||||
interpreterRunning = false;
|
||||
#else
|
||||
(void)interpreterRunning;
|
||||
#endif
|
||||
if (CCN_MMUCR.AT == 1 && config::FullMMU)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "types.h"
|
||||
#include "interpr/sh4_opcodes.h"
|
||||
#include "sh4_opcode_list.h"
|
||||
#include "dyna/decoder.h"
|
||||
#include "dyna/decoder_opcodes.h"
|
||||
#include "hw/sh4/dyna/shil.h"
|
||||
#include "reios/reios.h"
|
||||
|
@ -22,16 +23,6 @@ sh4_opcodelistentry* OpDesc[0x10000];
|
|||
#define Mask_nh3bit 0xF1FF
|
||||
#define Mask_nh2bit 0xF3FF
|
||||
|
||||
#define GetN(str) ((str>>8) & 0xf)
|
||||
#define GetM(str) ((str>>4) & 0xf)
|
||||
#define GetImm4(str) ((str>>0) & 0xf)
|
||||
#define GetImm8(str) ((str>>0) & 0xff)
|
||||
#define GetSImm8(str) ((s8)((str>>0) & 0xff))
|
||||
#define GetImm12(str) ((str>>0) & 0xfff)
|
||||
#define GetSImm12(str) (((s16)((GetImm12(str))<<4))>>4)
|
||||
|
||||
|
||||
|
||||
//,DEC_D_RN|DEC_S_RM|DEC_OP(shop_and)
|
||||
u64 dec_Fill(DecMode mode,DecParam d,DecParam s,shilop op,u32 extra=0)
|
||||
{
|
||||
|
|
|
@ -289,7 +289,8 @@ struct RawTrackFile : TrackFile
|
|||
}
|
||||
|
||||
std::fseek(file, offset + FAD * fmt, SEEK_SET);
|
||||
std::fread(dst, 1, fmt, file);
|
||||
if (std::fread(dst, 1, fmt, file) != fmt)
|
||||
WARN_LOG(GDROM, "Failed or truncated GD-Rom read");
|
||||
}
|
||||
~RawTrackFile() override
|
||||
{
|
||||
|
|
|
@ -67,7 +67,8 @@ Disc* cue_parse(const char* file)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::fread(cue_data, 1, cue_len, fsource);
|
||||
if (std::fread(cue_data, 1, cue_len, fsource) != cue_len)
|
||||
WARN_LOG(GDROM, "Failed or truncated read of cue file '%s'", file);
|
||||
std::fclose(fsource);
|
||||
|
||||
std::istringstream cuesheet(cue_data);
|
||||
|
|
|
@ -76,7 +76,8 @@ Disc* load_gdi(const char* file)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::fread(gdi_data, 1, gdi_len, t);
|
||||
if (std::fread(gdi_data, 1, gdi_len, t) != gdi_len)
|
||||
WARN_LOG(GDROM, "Failed or truncated read of gdi file '%s'", file);
|
||||
std::fclose(t);
|
||||
|
||||
std::istringstream gdi(gdi_data);
|
||||
|
|
|
@ -537,13 +537,13 @@ void Mouse::setRelPos(int deltax, int deltay) {
|
|||
}
|
||||
|
||||
void Mouse::setWheel(int delta) {
|
||||
if (maple_port() >= 0 && maple_port() < ARRAY_SIZE(mo_wheel_delta))
|
||||
if (maple_port() >= 0 && maple_port() < (int)ARRAY_SIZE(mo_wheel_delta))
|
||||
mo_wheel_delta[maple_port()] += delta;
|
||||
}
|
||||
|
||||
void Mouse::setButton(Button button, bool pressed)
|
||||
{
|
||||
if (maple_port() >= 0 && maple_port() < ARRAY_SIZE(mo_buttons))
|
||||
if (maple_port() >= 0 && maple_port() < (int)ARRAY_SIZE(mo_buttons))
|
||||
{
|
||||
if (pressed)
|
||||
mo_buttons[maple_port()] &= ~(1 << (int)button);
|
||||
|
|
|
@ -396,7 +396,7 @@ int main(int argc, char* argv[])
|
|||
common_linux_setup();
|
||||
#endif
|
||||
|
||||
if (reicast_init(argc, argv))
|
||||
if (flycast_init(argc, argv))
|
||||
die("Flycast initialization failed\n");
|
||||
|
||||
mainui_loop();
|
||||
|
|
|
@ -78,7 +78,7 @@ void fault_handler (int sn, siginfo_t * si, void *segfault_ctx)
|
|||
MemoryInfo meminfo;
|
||||
u32 pageinfo;
|
||||
svcQueryMemory(&meminfo, &pageinfo, (u64)&__start__);
|
||||
ERROR_LOG(COMMON, ".text base: %p", meminfo.addr);
|
||||
ERROR_LOG(COMMON, ".text base: %p", (void*)meminfo.addr);
|
||||
#endif // __SWITCH__
|
||||
die("segfault");
|
||||
signal(SIGSEGV, SIG_DFL);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
using mem_handle_t = uintptr_t;
|
||||
static mem_handle_t vmem_fd = -1;
|
||||
static mem_handle_t vmem_fd_page = -1;
|
||||
//static mem_handle_t vmem_fd_page = -1;
|
||||
static mem_handle_t vmem_fd_codememory = -1;
|
||||
|
||||
static void *reserved_base;
|
||||
|
@ -20,10 +20,10 @@ static VirtmemReservation *virtmemReservation;
|
|||
bool mem_region_lock(void *start, size_t len)
|
||||
{
|
||||
size_t inpage = (uintptr_t)start & PAGE_MASK;
|
||||
len += inpage;
|
||||
size_t inlen = len & PAGE_MASK;
|
||||
if (inlen)
|
||||
len = (len + PAGE_SIZE) & ~(PAGE_SIZE-1);
|
||||
len += inpage;
|
||||
size_t inlen = len & PAGE_MASK;
|
||||
if (inlen)
|
||||
len = (len + PAGE_SIZE) & ~(PAGE_SIZE-1);
|
||||
|
||||
Result rc;
|
||||
uintptr_t start_addr = (uintptr_t)start - inpage;
|
||||
|
@ -40,10 +40,10 @@ bool mem_region_lock(void *start, size_t len)
|
|||
bool mem_region_unlock(void *start, size_t len)
|
||||
{
|
||||
size_t inpage = (uintptr_t)start & PAGE_MASK;
|
||||
len += inpage;
|
||||
size_t inlen = len & PAGE_MASK;
|
||||
if(inlen)
|
||||
len = (len + PAGE_SIZE) & ~(PAGE_SIZE-1);
|
||||
len += inpage;
|
||||
size_t inlen = len & PAGE_MASK;
|
||||
if (inlen)
|
||||
len = (len + PAGE_SIZE) & ~(PAGE_SIZE-1);
|
||||
|
||||
Result rc;
|
||||
uintptr_t start_addr = (uintptr_t)start - inpage;
|
||||
|
@ -57,6 +57,7 @@ bool mem_region_unlock(void *start, size_t len)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
static bool mem_region_set_exec(void *start, size_t len)
|
||||
{
|
||||
size_t inpage = (uintptr_t)start & PAGE_MASK;
|
||||
|
@ -75,6 +76,7 @@ static void *mem_region_reserve(void *start, size_t len)
|
|||
virtmemUnlock();
|
||||
return p;
|
||||
}
|
||||
*/
|
||||
|
||||
static bool mem_region_release(void *start, size_t len)
|
||||
{
|
||||
|
@ -92,9 +94,11 @@ static void *mem_region_map_file(void *file_handle, void *dest, size_t len, size
|
|||
{
|
||||
Result rc = svcMapProcessMemory(dest, envGetOwnProcessHandle(), (u64)(vmem_fd_codememory + offset), len);
|
||||
if (R_FAILED(rc))
|
||||
WARN_LOG(VMEM, "Fatal error creating the view... base: %p offset: 0x%x size: 0x%x src: %p err: 0x%x", vmem_fd, offset, len, vmem_fd_codememory + offset, rc);
|
||||
WARN_LOG(VMEM, "Fatal error creating the view... base: %p offset: 0x%zx size: 0x%zx src: %p err: 0x%x",
|
||||
(void*)vmem_fd, offset, len, (void*)(vmem_fd_codememory + offset), rc);
|
||||
else
|
||||
INFO_LOG(VMEM, "Created the view... base: %p offset: 0x%x size: 0x%x src: %p err: 0x%x", vmem_fd, offset, len, vmem_fd_codememory + offset, rc);
|
||||
INFO_LOG(VMEM, "Created the view... base: %p offset: 0x%zx size: 0x%zx src: %p err: 0x%x",
|
||||
(void*)vmem_fd, offset, len, (void*)(vmem_fd_codememory + offset), rc);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -104,12 +108,14 @@ static bool mem_region_unmap_file(void *start, size_t len)
|
|||
return mem_region_release(start, len);
|
||||
}
|
||||
|
||||
/*
|
||||
// Allocates memory via a fd on shmem/ahmem or even a file on disk
|
||||
static mem_handle_t allocate_shared_filemem(unsigned size)
|
||||
{
|
||||
void* mem = memalign(0x1000, size);
|
||||
return (uintptr_t)mem;
|
||||
}
|
||||
*/
|
||||
|
||||
// Implement vmem initialization for RAM, ARAM, VRAM and SH4 context, fpcb etc.
|
||||
// The function supports allocating 512MB or 4GB addr spaces.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
static std::future<void> loadingDone;
|
||||
|
||||
int reicast_init(int argc, char* argv[])
|
||||
int flycast_init(int argc, char* argv[])
|
||||
{
|
||||
#if defined(TEST_AUTOMATION)
|
||||
setbuf(stdout, 0);
|
||||
|
|
|
@ -1004,7 +1004,7 @@ public:
|
|||
// Args are pushed in reverse order by shil_canonical
|
||||
for (int i = CC_pars.size(); i-- > 0;)
|
||||
{
|
||||
verify(fregused < call_fregs.size() && regused < call_regs.size());
|
||||
verify(fregused < (int)call_fregs.size() && regused < (int)call_regs.size());
|
||||
shil_param& prm = *CC_pars[i].prm;
|
||||
switch (CC_pars[i].type)
|
||||
{
|
||||
|
@ -1629,6 +1629,7 @@ private:
|
|||
rv = mmu_data_translation<MMU_TT_DREAD, u32>(addr, paddr);
|
||||
break;
|
||||
default:
|
||||
rv = 0;
|
||||
die("Invalid immediate size");
|
||||
break;
|
||||
}
|
||||
|
@ -1839,6 +1840,7 @@ private:
|
|||
rv = mmu_data_translation<MMU_TT_DWRITE, u32>(addr, paddr);
|
||||
break;
|
||||
default:
|
||||
rv = 0;
|
||||
die("Invalid immediate size");
|
||||
break;
|
||||
}
|
||||
|
@ -2192,11 +2194,11 @@ bool ngen_Rewrite(host_context_t &context, void *faultAddress)
|
|||
//LOGI("ngen_Rewrite pc %zx\n", context.pc);
|
||||
u32 *code_ptr = (u32 *)CC_RX2RW(context.pc);
|
||||
u32 armv8_op = *code_ptr;
|
||||
bool is_read;
|
||||
u32 size;
|
||||
bool is_read = false;
|
||||
u32 size = 0;
|
||||
bool found = false;
|
||||
u32 masked = armv8_op & STR_LDR_MASK;
|
||||
for (int i = 0; i < ARRAY_SIZE(armv8_mem_ops); i++)
|
||||
for (u32 i = 0; i < ARRAY_SIZE(armv8_mem_ops); i++)
|
||||
{
|
||||
if (masked == armv8_mem_ops[i])
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ static bool reios_locate_bootfile(const char* bootfile)
|
|||
data[8 + j] = _vmem_ReadMem8(0x0021a000 + j);
|
||||
|
||||
// system settings
|
||||
flash_syscfg_block syscfg;
|
||||
flash_syscfg_block syscfg{};
|
||||
verify(static_cast<DCFlashChip*>(flashrom)->ReadBlock(FLASH_PT_USER, FLASH_USER_SYSCFG, &syscfg));
|
||||
memcpy(&data[16], &syscfg.time_lo, 8);
|
||||
|
||||
|
@ -210,7 +210,7 @@ static void reios_sys_system() {
|
|||
data[8 + i] = flashrom->Read8(0x1a000 + i);
|
||||
|
||||
// system settings
|
||||
flash_syscfg_block syscfg;
|
||||
flash_syscfg_block syscfg{};
|
||||
verify(static_cast<DCFlashChip*>(flashrom)->ReadBlock(FLASH_PT_USER, FLASH_USER_SYSCFG, &syscfg));
|
||||
memcpy(&data[16], &syscfg.time_lo, 8);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
#pragma once
|
||||
#include "rend/gles/gles.h"
|
||||
#include "glsl.h"
|
||||
#include <unordered_map>
|
||||
|
||||
void gl4DrawStrips(GLuint output_fbo, int width, int height);
|
||||
|
@ -106,31 +105,7 @@ extern GLuint geom_fbo;
|
|||
extern GLuint texSamplers[2];
|
||||
extern GLuint depth_fbo;
|
||||
|
||||
static const char* ShaderHeader = R"(
|
||||
layout(r32ui, binding = 4) uniform coherent restrict uimage2D abufferPointerImg;
|
||||
|
||||
layout(binding = 0, offset = 0) uniform atomic_uint buffer_index;
|
||||
)"
|
||||
OIT_POLY_PARAM
|
||||
R"(
|
||||
layout (binding = 0, std430) coherent restrict buffer PixelBuffer {
|
||||
Pixel pixels[];
|
||||
};
|
||||
|
||||
uint getNextPixelIndex()
|
||||
{
|
||||
uint index = atomicCounterIncrement(buffer_index);
|
||||
if (index >= pixels.length())
|
||||
// Buffer overflow
|
||||
discard;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
layout (binding = 1, std430) readonly buffer TrPolyParamBuffer {
|
||||
PolyParam tr_poly_params[];
|
||||
};
|
||||
)";
|
||||
extern const char* ShaderHeader;
|
||||
|
||||
class OpenGl4Source : public ShaderSource
|
||||
{
|
||||
|
|
|
@ -20,9 +20,36 @@
|
|||
#include "rend/gles/glcache.h"
|
||||
#include "rend/transform_matrix.h"
|
||||
#include "rend/osd.h"
|
||||
#include "glsl.h"
|
||||
|
||||
//Fragment and vertex shaders code
|
||||
|
||||
const char* ShaderHeader = R"(
|
||||
layout(r32ui, binding = 4) uniform coherent restrict uimage2D abufferPointerImg;
|
||||
|
||||
layout(binding = 0, offset = 0) uniform atomic_uint buffer_index;
|
||||
)"
|
||||
OIT_POLY_PARAM
|
||||
R"(
|
||||
layout (binding = 0, std430) coherent restrict buffer PixelBuffer {
|
||||
Pixel pixels[];
|
||||
};
|
||||
|
||||
uint getNextPixelIndex()
|
||||
{
|
||||
uint index = atomicCounterIncrement(buffer_index);
|
||||
if (index >= pixels.length())
|
||||
// Buffer overflow
|
||||
discard;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
layout (binding = 1, std430) readonly buffer TrPolyParamBuffer {
|
||||
PolyParam tr_poly_params[];
|
||||
};
|
||||
)";
|
||||
|
||||
static const char* VertexShaderSource = R"(
|
||||
#if pp_Gouraud == 0
|
||||
#define INTERPOLATION flat
|
||||
|
|
|
@ -29,6 +29,44 @@
|
|||
|
||||
//Fragment and vertex shaders code
|
||||
|
||||
const char* ShaderCompatSource = R"(
|
||||
#define GLES2 0
|
||||
#define GLES3 1
|
||||
#define GL2 2
|
||||
#define GL3 3
|
||||
|
||||
#if TARGET_GL == GL2
|
||||
#define highp
|
||||
#define lowp
|
||||
#define mediump
|
||||
#endif
|
||||
#if TARGET_GL == GLES3
|
||||
out highp vec4 FragColor;
|
||||
#define gl_FragColor FragColor
|
||||
#define FOG_CHANNEL a
|
||||
#elif TARGET_GL == GL3
|
||||
out highp vec4 FragColor;
|
||||
#define gl_FragColor FragColor
|
||||
#define FOG_CHANNEL r
|
||||
#else
|
||||
#define texture texture2D
|
||||
#define FOG_CHANNEL a
|
||||
#endif
|
||||
)";
|
||||
|
||||
const char *VertexCompatShader = R"(
|
||||
#if TARGET_GL == GLES2 || TARGET_GL == GL2
|
||||
#define in attribute
|
||||
#define out varying
|
||||
#endif
|
||||
)";
|
||||
|
||||
const char *PixelCompatShader = R"(
|
||||
#if TARGET_GL == GLES2 || TARGET_GL == GL2
|
||||
#define in varying
|
||||
#endif
|
||||
)";
|
||||
|
||||
static const char* GouraudSource = R"(
|
||||
#if TARGET_GL == GL3 || TARGET_GL == GLES3
|
||||
#if pp_Gouraud == 0
|
||||
|
|
|
@ -298,43 +298,9 @@ void initQuad();
|
|||
void termQuad();
|
||||
void drawQuad(GLuint texId, bool rotate = false, bool swapY = false);
|
||||
|
||||
static const char* ShaderCompatSource = R"(
|
||||
#define GLES2 0
|
||||
#define GLES3 1
|
||||
#define GL2 2
|
||||
#define GL3 3
|
||||
|
||||
#if TARGET_GL == GL2
|
||||
#define highp
|
||||
#define lowp
|
||||
#define mediump
|
||||
#endif
|
||||
#if TARGET_GL == GLES3
|
||||
out highp vec4 FragColor;
|
||||
#define gl_FragColor FragColor
|
||||
#define FOG_CHANNEL a
|
||||
#elif TARGET_GL == GL3
|
||||
out highp vec4 FragColor;
|
||||
#define gl_FragColor FragColor
|
||||
#define FOG_CHANNEL r
|
||||
#else
|
||||
#define texture texture2D
|
||||
#define FOG_CHANNEL a
|
||||
#endif
|
||||
)";
|
||||
|
||||
static const char *VertexCompatShader = R"(
|
||||
#if TARGET_GL == GLES2 || TARGET_GL == GL2
|
||||
#define in attribute
|
||||
#define out varying
|
||||
#endif
|
||||
)";
|
||||
|
||||
static const char *PixelCompatShader = R"(
|
||||
#if TARGET_GL == GLES2 || TARGET_GL == GL2
|
||||
#define in varying
|
||||
#endif
|
||||
)";
|
||||
extern const char* ShaderCompatSource;
|
||||
extern const char *VertexCompatShader;
|
||||
extern const char *PixelCompatShader;
|
||||
|
||||
class OpenGlSource : public ShaderSource
|
||||
{
|
||||
|
|
|
@ -746,13 +746,12 @@ static void controller_mapping_popup(const std::shared_ptr<GamepadDevice>& gamep
|
|||
- ImGui::GetStyle().FramePadding.x * 3.0f - ImGui::GetStyle().ItemSpacing.x * 3.0f);
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
static ImGuiComboFlags flags = 0;
|
||||
|
||||
const char* items[] = { "Dreamcast Controls", "Arcade Controls" };
|
||||
static int item_current_map_idx = 0;
|
||||
static int last_item_current_map_idx = 2;
|
||||
|
||||
// Here our selection data is an index.
|
||||
const char* combo_label = items[item_current_map_idx]; // Label to preview before opening the combo (technically it could be anything)
|
||||
|
||||
ImGui::PushItemWidth(ImGui::CalcTextSize("Dreamcast Controls").x + ImGui::GetStyle().ItemSpacing.x * 2.0f * 3);
|
||||
|
||||
|
@ -2072,9 +2071,9 @@ static void gui_display_loadscreen()
|
|||
gui_state = GuiState::Closed;
|
||||
ImGui::Text("STARTING...");
|
||||
}
|
||||
} catch (const ReicastException& ex) {
|
||||
ERROR_LOG(BOOT, "%s", ex.reason.c_str());
|
||||
error_msg = ex.reason;
|
||||
} catch (const FlycastException& ex) {
|
||||
ERROR_LOG(BOOT, "%s", ex.what());
|
||||
error_msg = ex.what();
|
||||
#ifdef TEST_AUTOMATION
|
||||
die("Game load failed");
|
||||
#endif
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
vk::Device GetDevice() const { return device; }
|
||||
vk::PipelineCache GetPipelineCache() const { return *pipelineCache; }
|
||||
vk::DescriptorPool GetDescriptorPool() const { return *descriptorPool; }
|
||||
int GetSwapChainSize() const { u32 m = retro_render_if->get_sync_index_mask(retro_render_if->handle); u32 n = 1; while (m >>= 1) n++; return n; }
|
||||
size_t GetSwapChainSize() const { u32 m = retro_render_if->get_sync_index_mask(retro_render_if->handle); u32 n = 1; while (m >>= 1) n++; return n; }
|
||||
int GetCurrentImageIndex() const { return retro_render_if->get_sync_index(retro_render_if->handle); }
|
||||
// FIXME that's not quite correct
|
||||
void WaitIdle() const { retro_render_if->wait_sync_index(retro_render_if->handle); }
|
||||
|
|
|
@ -425,12 +425,10 @@ struct OnLoad
|
|||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
class ReicastException
|
||||
class FlycastException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
ReicastException(std::string reason) : reason(reason) {}
|
||||
|
||||
std::string reason;
|
||||
FlycastException(const std::string& reason) : std::runtime_error(reason) {}
|
||||
};
|
||||
|
||||
enum serialize_version_enum {
|
||||
|
|
|
@ -707,7 +707,7 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
setupPath();
|
||||
findKeyboardLayout();
|
||||
|
||||
if (reicast_init(argc, argv) != 0)
|
||||
if (flycast_init(argc, argv) != 0)
|
||||
die("Flycast initialization failed");
|
||||
|
||||
os_InstallFaultHandler();
|
||||
|
|
|
@ -234,7 +234,7 @@ JNIEXPORT jstring JNICALL Java_com_reicast_emulator_emu_JNIdc_initEnvironment(JN
|
|||
EventManager::listen(Event::Pause, emuEventCallback);
|
||||
EventManager::listen(Event::Resume, emuEventCallback);
|
||||
jstring msg = NULL;
|
||||
int rc = reicast_init(0, NULL);
|
||||
int rc = flycast_init(0, NULL);
|
||||
if (rc == -4)
|
||||
msg = env->NewStringUTF("Cannot find configuration");
|
||||
else if (rc == 69)
|
||||
|
|
|
@ -243,7 +243,7 @@ int emu_reicast_init()
|
|||
argv[paramCount++] = strdup(arg);
|
||||
}
|
||||
|
||||
int rc = reicast_init(paramCount, argv);
|
||||
int rc = flycast_init(paramCount, argv);
|
||||
|
||||
for (unsigned long i = 0; i < paramCount; i++)
|
||||
free(argv[i]);
|
||||
|
|
|
@ -1229,6 +1229,9 @@ static void set_input_descriptors()
|
|||
if (name != NULL && name[0] != '\0')
|
||||
desc[descriptor_index++] = { i, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, name };
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1294,6 +1297,9 @@ static void set_input_descriptors()
|
|||
desc[descriptor_index++] = { i, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_START, "Start" };
|
||||
desc[descriptor_index++] = { i, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_AUX_A, "B" };
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1831,7 +1837,7 @@ unsigned retro_get_region()
|
|||
// Controller
|
||||
void retro_set_controller_port_device(unsigned in_port, unsigned device)
|
||||
{
|
||||
if (device_type[in_port] != device && in_port < MAPLE_PORTS)
|
||||
if (device_type[in_port] != (int)device && in_port < MAPLE_PORTS)
|
||||
{
|
||||
devices_need_refresh = true;
|
||||
device_type[in_port] = device;
|
||||
|
@ -2577,6 +2583,9 @@ static void UpdateInputState(u32 port)
|
|||
case MDT_Mouse:
|
||||
updateMouseState(port);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2628,16 +2637,19 @@ static void retro_keyboard_event(bool down, unsigned keycode, uint32_t character
|
|||
{
|
||||
// Dreamcast keyboard emulation
|
||||
if (keycode == RETROK_LSHIFT || keycode == RETROK_RSHIFT)
|
||||
{
|
||||
if (!down)
|
||||
kb_shift[0] &= ~(0x02 | 0x20);
|
||||
else
|
||||
kb_shift[0] |= (0x02 | 0x20);
|
||||
}
|
||||
if (keycode == RETROK_LCTRL || keycode == RETROK_RCTRL)
|
||||
{
|
||||
if (!down)
|
||||
kb_shift[0] &= ~(0x01 | 0x10);
|
||||
else
|
||||
kb_shift[0] |= (0x01 | 0x10);
|
||||
|
||||
}
|
||||
// Make sure modifier keys are released
|
||||
if ((key_modifiers & RETROKMOD_SHIFT) == 0)
|
||||
{
|
||||
|
@ -2930,7 +2942,7 @@ void gui_display_notification(const char *msg, int duration)
|
|||
retro_message retromsg;
|
||||
retromsg.msg = msg;
|
||||
retromsg.frames = duration / 17;
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &msg);
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &retromsg);
|
||||
}
|
||||
|
||||
void gui_init() {
|
||||
|
|
Loading…
Reference in New Issue