ui: add loading screen with cancel button. don't freeze ui on load
This commit is contained in:
parent
06313dd540
commit
17a2c3644f
|
@ -1,5 +1,6 @@
|
|||
#include "cfg/cfg.h"
|
||||
#include "rend/TexCache.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include <csignal>
|
||||
|
||||
|
@ -12,7 +13,7 @@ TA_context* read_frame(const char* file, u8* vram_ref = NULL);
|
|||
void rend_set_fb_scale(float x,float y);
|
||||
|
||||
#ifdef TARGET_DISPFRAME
|
||||
void dc_run()
|
||||
void *dc_run(void*)
|
||||
{
|
||||
struct sigaction act, segv_oact;
|
||||
memset(&act, 0, sizeof(act));
|
||||
|
@ -60,5 +61,6 @@ void dc_run()
|
|||
|
||||
os_DoEvents();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Created on: Apr 20, 2020
|
||||
|
||||
Copyright 2020 flyinghead
|
||||
|
||||
This file is part of flycast.
|
||||
|
||||
flycast is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
flycast is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
|
||||
void InitSettings();
|
||||
void LoadSettings(bool game_specific);
|
||||
void SaveSettings();
|
||||
|
||||
extern std::atomic<bool> loading_canceled;
|
||||
|
||||
int reicast_init(int argc, char* argv[]);
|
||||
void dc_reset(bool hard);
|
||||
void dc_init();
|
||||
void* dc_run(void*);
|
||||
void dc_term();
|
||||
void dc_stop();
|
||||
void dc_request_reset();
|
||||
void dc_exit();
|
||||
void dc_resume();
|
||||
void dc_savestate();
|
||||
void dc_loadstate();
|
||||
void dc_load_game(const char *path);
|
||||
bool dc_is_load_done();
|
||||
void dc_cancel_load();
|
||||
void dc_get_load_status();
|
|
@ -179,8 +179,8 @@ s32 libAICA_Init()
|
|||
init_mem();
|
||||
aica_Init();
|
||||
|
||||
verify(sizeof(*CommonData)==0x508);
|
||||
verify(sizeof(*DSPData)==0x15C8);
|
||||
static_assert(sizeof(*CommonData) == 0x508, "Invalid CommonData size");
|
||||
static_assert(sizeof(*DSPData) == 0x15C8, "Invalid DSPData size");
|
||||
|
||||
CommonData=(CommonData_struct*)&aica_reg[0x2800];
|
||||
DSPData=(DSPData_struct*)&aica_reg[0x3000];
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
extern u32 VREG;
|
||||
extern VArray2 aica_ram;
|
||||
extern u32 RealTimeClock;
|
||||
u32 GetRTC_now();
|
||||
u32 ReadMem_aica_rtc(u32 addr,u32 sz);
|
||||
void WriteMem_aica_rtc(u32 addr,u32 data,u32 sz);
|
||||
u32 ReadMem_aica_reg(u32 addr,u32 sz);
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "hw/modem/modem.h"
|
||||
#include "hw/naomi/naomi.h"
|
||||
#include "hw/pvr/pvr_sb_regs.h"
|
||||
|
||||
extern void dc_request_reset();
|
||||
#include "emulator.h"
|
||||
|
||||
std::array<RegisterStruct, 0x540> sb_regs;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "gdcartridge.h"
|
||||
#include "stdclass.h"
|
||||
#include "emulator.h"
|
||||
#include "rend/gui.h"
|
||||
|
||||
/*
|
||||
|
||||
|
@ -567,8 +569,21 @@ void GDCartridge::device_start()
|
|||
u32 des_subkeys[32];
|
||||
des_generate_subkeys(rev64(key), des_subkeys);
|
||||
|
||||
u32 progress = ~0;
|
||||
for (u32 i = 0; i < file_rounded_size; i += 8)
|
||||
{
|
||||
const u32 new_progress = (u32)(((u64)i + 8) * 100 / file_rounded_size);
|
||||
if (progress != new_progress)
|
||||
{
|
||||
if (loading_canceled)
|
||||
break;
|
||||
progress = new_progress;
|
||||
char status_str[16];
|
||||
sprintf(status_str, "Decrypting %d%%", progress);
|
||||
gui_display_notification(status_str, 2000);
|
||||
}
|
||||
*(u64 *)(dimm_data + i) = des_encrypt_decrypt<true>(*(u64 *)(dimm_data + i), des_subkeys);
|
||||
}
|
||||
}
|
||||
|
||||
delete gdrom;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "gdcartridge.h"
|
||||
#include "archive/archive.h"
|
||||
#include "stdclass.h"
|
||||
#include "emulator.h"
|
||||
#include "rend/gui.h"
|
||||
|
||||
Cartridge *CurrentCartridge;
|
||||
bool bios_loaded = false;
|
||||
|
@ -267,8 +269,14 @@ static void naomi_cart_LoadZip(const char *filename)
|
|||
CurrentCartridge->SetKey(game->key);
|
||||
NaomiGameInputs = game->inputs;
|
||||
|
||||
for (int romid = 0; game->blobs[romid].filename != NULL; romid++)
|
||||
for (int romid = 0; game->blobs[romid].filename != NULL && !loading_canceled; romid++)
|
||||
{
|
||||
if (game->cart_type != GD)
|
||||
{
|
||||
std::string progress = "ROM " + std::to_string(romid + 1);
|
||||
gui_display_notification(progress.c_str(), 1000);
|
||||
}
|
||||
|
||||
u32 len = game->blobs[romid].length;
|
||||
|
||||
if (game->blobs[romid].blob_type == Copy)
|
||||
|
@ -354,6 +362,8 @@ static void naomi_cart_LoadZip(const char *filename)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (loading_canceled)
|
||||
return;
|
||||
if (naomi_default_eeprom == NULL && game->eeprom_dump != NULL)
|
||||
naomi_default_eeprom = game->eeprom_dump;
|
||||
naomi_rotate_screen = game->rotation_flag == ROT270;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <vector>
|
||||
|
||||
#include "deps/coreio/coreio.h"
|
||||
#include "emulator.h"
|
||||
#include "rend/gui.h"
|
||||
|
||||
extern u32 NullDriveDiscType;
|
||||
struct TocTrackInfo
|
||||
|
@ -95,7 +97,6 @@ void GetDriveToc(u32* to,DiskArea area);
|
|||
void GetDriveSector(u8 * buff,u32 StartSector,u32 SectorCount,u32 secsz);
|
||||
|
||||
void GetDriveSessionInfo(u8* to,u8 session);
|
||||
int GetFile(char *szFileName, char *szParse=0,u32 flags=0);
|
||||
int msgboxf(char* text,unsigned int type,...);
|
||||
void printtoc(TocInfo* toc,SessionInfo* ses);
|
||||
extern u8 q_subchannel[96];
|
||||
|
@ -170,8 +171,23 @@ struct Disc
|
|||
SectorFormat secfmt;
|
||||
SubcodeFormat subfmt;
|
||||
|
||||
while(count)
|
||||
u32 progress = ~0;
|
||||
for (u32 i = 1; i <= count; i++)
|
||||
{
|
||||
if (count >= 100)
|
||||
{
|
||||
if (loading_canceled)
|
||||
break;
|
||||
// Progress report when loading naomi gd-rom games
|
||||
const u32 new_progress = i * 100 / count;
|
||||
if (progress != new_progress)
|
||||
{
|
||||
progress = new_progress;
|
||||
char status_str[16];
|
||||
sprintf(status_str, "%d%%", progress);
|
||||
gui_display_notification(status_str, 2000);
|
||||
}
|
||||
}
|
||||
if (ReadSector(FAD,temp,&secfmt,q_subchannel,&subfmt))
|
||||
{
|
||||
//TODO: Proper sector conversions
|
||||
|
@ -207,7 +223,6 @@ struct Disc
|
|||
}
|
||||
dst+=fmt;
|
||||
FAD++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
virtual ~Disc()
|
||||
|
|
|
@ -21,14 +21,13 @@
|
|||
#include "cfg/cfg.h"
|
||||
#include "oslib/oslib.h"
|
||||
#include "rend/gui.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
|
||||
#define MAPLE_PORT_CFG_PREFIX "maple_"
|
||||
|
||||
extern void dc_exit();
|
||||
|
||||
// Gamepads
|
||||
u16 kcode[4] = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF };
|
||||
s8 joyx[4];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#if HOST_OS==OS_LINUX
|
||||
#include "hw/sh4/dyna/blockmanager.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <csignal>
|
||||
|
@ -125,8 +126,6 @@ void os_CreateWindow()
|
|||
}
|
||||
|
||||
void common_linux_setup();
|
||||
int reicast_init(int argc, char* argv[]);
|
||||
void dc_term();
|
||||
void* rend_thread(void* p);
|
||||
|
||||
#ifdef TARGET_PANDORA
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "icon.h"
|
||||
#include "wsi/context.h"
|
||||
#include "hw/maple/maple_devs.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#if FEAT_HAS_NIXPROF
|
||||
#include "profiler/profiler.h"
|
||||
|
@ -78,8 +79,6 @@ static Atom wmDeleteMessage;
|
|||
|
||||
extern bool dump_frame_switch;
|
||||
|
||||
void dc_exit();
|
||||
|
||||
enum
|
||||
{
|
||||
_NET_WM_STATE_REMOVE =0,
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
// nullDC.cpp : Makes magic cookies
|
||||
//
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <thread>
|
||||
|
||||
//initialse Emu
|
||||
#include "types.h"
|
||||
#include "emulator.h"
|
||||
#include "oslib/oslib.h"
|
||||
#include "oslib/audiostream.h"
|
||||
#include "hw/mem/_vmem.h"
|
||||
|
@ -31,9 +35,7 @@
|
|||
#include "network/naomi_network.h"
|
||||
|
||||
void FlushCache();
|
||||
void LoadCustom();
|
||||
void* dc_run(void*);
|
||||
void dc_resume();
|
||||
static void LoadCustom();
|
||||
|
||||
extern bool fast_forward_mode;
|
||||
|
||||
|
@ -50,19 +52,14 @@ static int saved_screen_stretching = -1;
|
|||
|
||||
cThread emu_thread(&dc_run, NULL);
|
||||
|
||||
static std::future<void> loading_done;
|
||||
std::atomic<bool> loading_canceled;
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
int GetFile(char *szFileName, char *szParse /* = 0 */, u32 flags /* = 0 */)
|
||||
{
|
||||
cfgLoadStr("config", "image", szFileName, "");
|
||||
|
||||
return szFileName[0] != '\0' ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
s32 plugins_Init()
|
||||
static s32 plugins_Init()
|
||||
{
|
||||
|
||||
if (s32 rv = libPvr_Init())
|
||||
|
@ -82,7 +79,7 @@ s32 plugins_Init()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void plugins_Term()
|
||||
static void plugins_Term()
|
||||
{
|
||||
//term all plugins
|
||||
libARM_Term();
|
||||
|
@ -91,7 +88,7 @@ void plugins_Term()
|
|||
libPvr_Term();
|
||||
}
|
||||
|
||||
void plugins_Reset(bool hard)
|
||||
static void plugins_Reset(bool hard)
|
||||
{
|
||||
libPvr_Reset(hard);
|
||||
libGDR_Reset(hard);
|
||||
|
@ -100,7 +97,7 @@ void plugins_Reset(bool hard)
|
|||
//libExtDevice_Reset(Manual);
|
||||
}
|
||||
|
||||
void LoadSpecialSettings()
|
||||
static void LoadSpecialSettings()
|
||||
{
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
{
|
||||
|
@ -466,7 +463,7 @@ int reicast_init(int argc, char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
void set_platform(int platform)
|
||||
static void set_platform(int platform)
|
||||
{
|
||||
if (VRAM_SIZE != 0)
|
||||
_vmem_unprotect_vram(0, VRAM_SIZE);
|
||||
|
@ -559,8 +556,9 @@ static int get_game_platform(const char *path)
|
|||
return DC_PLATFORM_DREAMCAST;
|
||||
}
|
||||
|
||||
void dc_start_game(const char *path)
|
||||
static void dc_start_game(const char *path)
|
||||
{
|
||||
DEBUG_LOG(BOOT, "Loading game %s", path == nullptr ? "(nil)" : path);
|
||||
bool forced_bios_file = false;
|
||||
|
||||
if (path != NULL)
|
||||
|
@ -634,6 +632,8 @@ void dc_start_game(const char *path)
|
|||
else if (settings.platform.system == DC_PLATFORM_NAOMI || settings.platform.system == DC_PLATFORM_ATOMISWAVE)
|
||||
{
|
||||
naomi_cart_LoadRom(path);
|
||||
if (loading_canceled)
|
||||
return;
|
||||
LoadCustom();
|
||||
if (settings.platform.system == DC_PLATFORM_NAOMI)
|
||||
{
|
||||
|
@ -660,8 +660,6 @@ void dc_start_game(const char *path)
|
|||
}
|
||||
}
|
||||
fast_forward_mode = false;
|
||||
game_started = true;
|
||||
dc_resume();
|
||||
}
|
||||
|
||||
bool dc_is_running()
|
||||
|
@ -708,6 +706,7 @@ void* dc_run(void*)
|
|||
|
||||
void dc_term()
|
||||
{
|
||||
dc_cancel_load();
|
||||
sh4_cpu.Term();
|
||||
if (settings.platform.system != DC_PLATFORM_DREAMCAST)
|
||||
naomi_cart_Close();
|
||||
|
@ -952,7 +951,7 @@ void LoadSettings(bool game_specific)
|
|||
*/
|
||||
}
|
||||
|
||||
void LoadCustom()
|
||||
static void LoadCustom()
|
||||
{
|
||||
char *reios_id;
|
||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||
|
@ -1088,7 +1087,9 @@ void SaveSettings()
|
|||
|
||||
void dc_resume()
|
||||
{
|
||||
emu_thread.Start();
|
||||
game_started = true;
|
||||
if (!emu_thread.thread.joinable())
|
||||
emu_thread.Start();
|
||||
}
|
||||
|
||||
static void cleanup_serialize(void *data)
|
||||
|
@ -1248,3 +1249,35 @@ void dc_loadstate()
|
|||
cleanup_serialize(data) ;
|
||||
INFO_LOG(SAVESTATE, "Loaded state from %s size %d", filename.c_str(), total_size) ;
|
||||
}
|
||||
|
||||
void dc_load_game(const char *path)
|
||||
{
|
||||
loading_canceled = false;
|
||||
|
||||
loading_done = std::async(std::launch::async, [path] {
|
||||
dc_start_game(path);
|
||||
});
|
||||
}
|
||||
|
||||
bool dc_is_load_done()
|
||||
{
|
||||
if (!loading_done.valid())
|
||||
return true;
|
||||
if (loading_done.wait_for(std::chrono::milliseconds(0)) == std::future_status::ready)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void dc_cancel_load()
|
||||
{
|
||||
if (loading_done.valid())
|
||||
{
|
||||
loading_canceled = true;
|
||||
loading_done.get();
|
||||
}
|
||||
}
|
||||
|
||||
void dc_get_load_status()
|
||||
{
|
||||
loading_done.get();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "rend/TexCache.h"
|
||||
#include "rend/transform_matrix.h"
|
||||
#include "wsi/gl_context.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -413,7 +414,6 @@ void do_swap_automation()
|
|||
|
||||
if (do_screenshot)
|
||||
{
|
||||
extern void dc_exit();
|
||||
int bytesz = screen_width * screen_height * 3;
|
||||
u8* img = new u8[bytesz];
|
||||
|
||||
|
|
|
@ -35,13 +35,8 @@
|
|||
#include "oslib/audiostream.h"
|
||||
#include "imgread/common.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "emulator.h"
|
||||
|
||||
extern void dc_loadstate();
|
||||
extern void dc_savestate();
|
||||
extern void dc_stop();
|
||||
extern void dc_reset(bool hard);
|
||||
extern void dc_resume();
|
||||
extern void dc_start_game(const char *path);
|
||||
extern void UpdateInputState(u32 port);
|
||||
extern bool game_started;
|
||||
|
||||
|
@ -59,6 +54,8 @@ static bool settings_opening;
|
|||
static bool touch_up;
|
||||
#endif
|
||||
static std::string error_msg;
|
||||
static std::string osd_message;
|
||||
static double osd_message_end;
|
||||
|
||||
static void display_vmus();
|
||||
static void reset_vmus();
|
||||
|
@ -290,15 +287,11 @@ void gui_open_settings()
|
|||
static void gui_start_game(const std::string& path)
|
||||
{
|
||||
scanner.stop();
|
||||
try {
|
||||
dc_start_game(path.empty() ? NULL : path.c_str());
|
||||
} catch (ReicastException& ex) {
|
||||
ERROR_LOG(BOOT, "%s", ex.reason.c_str());
|
||||
error_msg = ex.reason;
|
||||
gui_state = Main;
|
||||
game_started = false;
|
||||
settings.imgread.ImagePath[0] = '\0';
|
||||
}
|
||||
gui_state = Loading;
|
||||
static std::string path_copy;
|
||||
path_copy = path; // path may be a local var
|
||||
|
||||
dc_load_game(path.empty() ? NULL : path_copy.c_str());
|
||||
}
|
||||
|
||||
static void gui_display_commands()
|
||||
|
@ -317,18 +310,18 @@ static void gui_display_commands()
|
|||
ImGui::SetNextWindowPos(ImVec2(screen_width / 2.f, screen_height / 2.f), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::SetNextWindowSize(ImVec2(330 * scaling, 0));
|
||||
|
||||
ImGui::Begin("Flycast", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Begin("##commands", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize);
|
||||
|
||||
ImGui::Columns(2, "buttons", false);
|
||||
if (ImGui::Button("Load State", ImVec2(150 * scaling, 50 * scaling)))
|
||||
{
|
||||
gui_state = ClosedNoResume;
|
||||
gui_state = Closed;
|
||||
dc_loadstate();
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
if (ImGui::Button("Save State", ImVec2(150 * scaling, 50 * scaling)))
|
||||
{
|
||||
gui_state = ClosedNoResume;
|
||||
gui_state = Closed;
|
||||
dc_savestate();
|
||||
}
|
||||
|
||||
|
@ -643,6 +636,7 @@ static void error_popup()
|
|||
{
|
||||
if (!error_msg.empty())
|
||||
{
|
||||
ImGui::OpenPopup("Error");
|
||||
if (ImGui::BeginPopupModal("Error", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove))
|
||||
{
|
||||
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 400.f * scaling);
|
||||
|
@ -659,7 +653,6 @@ static void error_popup()
|
|||
ImGui::PopStyleVar();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::OpenPopup("Error");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1504,7 +1497,7 @@ static void gui_display_content()
|
|||
ImGui::PushID("bios");
|
||||
if (ImGui::Selectable("Dreamcast BIOS"))
|
||||
{
|
||||
gui_state = ClosedNoResume;
|
||||
gui_state = Closed;
|
||||
settings.imgread.ImagePath[0] = '\0';
|
||||
gui_start_game("");
|
||||
}
|
||||
|
@ -1536,7 +1529,7 @@ static void gui_display_content()
|
|||
else
|
||||
{
|
||||
scanner.get_mutex().unlock();
|
||||
gui_state = ClosedNoResume;
|
||||
gui_state = Closed;
|
||||
gui_start_game(game.path);
|
||||
scanner.get_mutex().lock();
|
||||
}
|
||||
|
@ -1589,6 +1582,67 @@ void gui_display_onboarding()
|
|||
ImGui_impl_RenderDrawData(ImGui::GetDrawData(), false);
|
||||
}
|
||||
|
||||
void gui_display_loadscreen()
|
||||
{
|
||||
ImGui_Impl_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(screen_width / 2, screen_height / 2), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::SetNextWindowSize(ImVec2(330 * scaling, 180 * scaling));
|
||||
|
||||
ImGui::Begin("##loading", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20 * scaling, 10 * scaling));
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::SetCursorPosX(20.f * scaling);
|
||||
if (dc_is_load_done())
|
||||
{
|
||||
try {
|
||||
dc_get_load_status();
|
||||
gui_state = Closed;
|
||||
ImGui::Text("STARTING...");
|
||||
} catch (ReicastException& ex) {
|
||||
ERROR_LOG(BOOT, "%s", ex.reason.c_str());
|
||||
error_msg = ex.reason;
|
||||
#ifdef TEST_AUTOMATION
|
||||
die("Game load failed");
|
||||
#endif
|
||||
gui_state = Main;
|
||||
settings.imgread.ImagePath[0] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("LOADING... ");
|
||||
double now = os_GetSeconds();
|
||||
if (!osd_message.empty())
|
||||
{
|
||||
if (now >= osd_message_end)
|
||||
osd_message.clear();
|
||||
else
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("%s", osd_message.c_str());
|
||||
}
|
||||
}
|
||||
float currentwidth = ImGui::GetContentRegionAvailWidth();
|
||||
ImGui::SetCursorPosX((currentwidth - 100.f * scaling) / 2.f + ImGui::GetStyle().WindowPadding.x);
|
||||
ImGui::SetCursorPosY(126.f * scaling);
|
||||
if (ImGui::Button("Cancel", ImVec2(100.f * scaling, 0.f)))
|
||||
{
|
||||
dc_cancel_load();
|
||||
gui_state = Main;
|
||||
settings.imgread.ImagePath[0] = '\0';
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::End();
|
||||
|
||||
ImGui::Render();
|
||||
ImGui_impl_RenderDrawData(ImGui::GetDrawData(), false);
|
||||
}
|
||||
|
||||
void gui_display_ui()
|
||||
{
|
||||
switch (gui_state)
|
||||
|
@ -1604,20 +1658,12 @@ void gui_display_ui()
|
|||
{
|
||||
std::string game_file = settings.imgread.ImagePath;
|
||||
if (!game_file.empty())
|
||||
{
|
||||
gui_state = ClosedNoResume;
|
||||
gui_start_game(game_file);
|
||||
#ifdef TEST_AUTOMATION
|
||||
if (gui_state == Main)
|
||||
die("Game load failed");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
gui_display_content();
|
||||
}
|
||||
break;
|
||||
case Closed:
|
||||
case ClosedNoResume:
|
||||
break;
|
||||
case Onboarding:
|
||||
gui_display_onboarding();
|
||||
|
@ -1632,20 +1678,19 @@ void gui_display_ui()
|
|||
case SelectDisk:
|
||||
gui_display_content();
|
||||
break;
|
||||
case Loading:
|
||||
gui_display_loadscreen();
|
||||
break;
|
||||
}
|
||||
|
||||
if (gui_state == Closed)
|
||||
dc_resume();
|
||||
else if (gui_state == ClosedNoResume)
|
||||
gui_state = Closed;
|
||||
}
|
||||
|
||||
static float LastFPSTime;
|
||||
static int lastFrameCount = 0;
|
||||
static float fps = -1;
|
||||
|
||||
static std::string osd_message;
|
||||
static double osd_message_end;
|
||||
extern bool fast_forward_mode;
|
||||
|
||||
void gui_display_notification(const char *msg, int duration)
|
||||
|
|
|
@ -33,7 +33,7 @@ extern u32 vmu_lcd_data[8][48 * 32];
|
|||
extern bool vmu_lcd_status[8];
|
||||
extern bool vmu_lcd_changed[8];
|
||||
|
||||
typedef enum { Closed, Commands, Settings, ClosedNoResume, Main, Onboarding, VJoyEdit, VJoyEditCommands, SelectDisk } GuiState;
|
||||
typedef enum { Closed, Commands, Settings, Main, Onboarding, VJoyEdit, VJoyEditCommands, SelectDisk, Loading } GuiState;
|
||||
extern GuiState gui_state;
|
||||
void ImGui_Impl_NewFrame();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "compiler.h"
|
||||
#include "texture.h"
|
||||
#include "utils.h"
|
||||
#include "emulator.h"
|
||||
|
||||
VulkanContext *VulkanContext::contextInstance;
|
||||
|
||||
|
@ -871,7 +872,6 @@ void VulkanContext::Term()
|
|||
void VulkanContext::DoSwapAutomation()
|
||||
{
|
||||
#ifdef TEST_AUTOMATION
|
||||
extern void dc_exit();
|
||||
extern bool do_screenshot;
|
||||
|
||||
if (do_screenshot)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "sdl_gamepad.h"
|
||||
#include "sdl_keyboard.h"
|
||||
#include "wsi/context.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#ifdef USE_VULKAN
|
||||
#include <SDL2/SDL_vulkan.h>
|
||||
|
@ -31,8 +32,6 @@ static bool window_maximized;
|
|||
static int window_width = WINDOW_WIDTH;
|
||||
static int window_height = WINDOW_HEIGHT;
|
||||
|
||||
extern void dc_exit();
|
||||
|
||||
static void sdl_open_joystick(int index)
|
||||
{
|
||||
SDL_Joystick *pJoystick = SDL_JoystickOpen(index);
|
||||
|
|
16
core/types.h
16
core/types.h
|
@ -313,8 +313,8 @@ int msgboxf(const char* text, unsigned int type, ...);
|
|||
#define MBX_ICONEXCLAMATION 0
|
||||
#define MBX_ICONERROR 0
|
||||
|
||||
#define verify(x) do { if ((x) == false){ msgboxf("Verify Failed : " #x "\n in %s -> %s : %d \n", MBX_ICONERROR, (__FUNCTION__), (__FILE__), __LINE__); dbgbreak;}} while (false)
|
||||
#define die(reason) do { msgboxf("Fatal error : %s\n in %s -> %s : %d \n", MBX_ICONERROR,(reason), (__FUNCTION__), (__FILE__), __LINE__); dbgbreak;} while (false)
|
||||
#define verify(x) do { if ((x) == false){ msgboxf("Verify Failed : " #x "\n in %s -> %s : %d", MBX_ICONERROR, (__FUNCTION__), (__FILE__), __LINE__); dbgbreak;}} while (false)
|
||||
#define die(reason) do { msgboxf("Fatal error : %s\n in %s -> %s : %d", MBX_ICONERROR,(reason), (__FUNCTION__), (__FILE__), __LINE__); dbgbreak;} while (false)
|
||||
|
||||
|
||||
//will be removed sometime soon
|
||||
|
@ -553,23 +553,11 @@ extern settings_t settings;
|
|||
#define FLASH_SIZE settings.platform.flash_size
|
||||
#define BBSRAM_SIZE settings.platform.bbsram_size
|
||||
|
||||
void InitSettings();
|
||||
void LoadSettings(bool game_specific);
|
||||
void SaveSettings();
|
||||
u32 GetRTC_now();
|
||||
|
||||
inline bool is_s8(u32 v) { return (s8)v==(s32)v; }
|
||||
inline bool is_u8(u32 v) { return (u8)v==(s32)v; }
|
||||
inline bool is_s16(u32 v) { return (s16)v==(s32)v; }
|
||||
inline bool is_u16(u32 v) { return (u16)v==(u32)v; }
|
||||
|
||||
//more to come
|
||||
|
||||
//sh4 thread
|
||||
s32 plugins_Init();
|
||||
void plugins_Term();
|
||||
void plugins_Reset(bool Manual);
|
||||
|
||||
//PVR
|
||||
s32 libPvr_Init();
|
||||
void libPvr_Reset(bool Manual);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "sdl/sdl.h"
|
||||
#endif
|
||||
#include "hw/maple/maple_devs.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#include <windows.h>
|
||||
|
@ -115,8 +116,6 @@ PCHAR*
|
|||
return argv;
|
||||
}
|
||||
|
||||
void dc_exit(void);
|
||||
|
||||
bool VramLockedWrite(u8* address);
|
||||
bool ngen_Rewrite(unat& addr,unat retadr,unat acc);
|
||||
bool BM_LockedWrite(u8* address);
|
||||
|
@ -748,9 +747,7 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
__try
|
||||
#endif
|
||||
{
|
||||
int reicast_init(int argc, char* argv[]);
|
||||
void *rend_thread(void *);
|
||||
void dc_term();
|
||||
|
||||
if (reicast_init(argc, argv) != 0)
|
||||
die("Reicast initialization failed");
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "cfg/cfg.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "wsi/context.h"
|
||||
#include "emulator.h"
|
||||
|
||||
JavaVM* g_jvm;
|
||||
|
||||
|
@ -133,11 +134,6 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_screenDpi(JNIEnv *env
|
|||
screen_dpi = screenDpi;
|
||||
}
|
||||
|
||||
int reicast_init(int argc, char* argv[]);
|
||||
void dc_resume();
|
||||
void dc_stop();
|
||||
void dc_term();
|
||||
|
||||
bool egl_makecurrent();
|
||||
|
||||
extern int screen_width,screen_height;
|
||||
|
@ -667,4 +663,4 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setButtons(JNIEnv *en
|
|||
jbyte* b = env->GetByteArrayElements(data, &isCopy);
|
||||
memcpy(DefaultOSDButtons.data(), b, len);
|
||||
env->ReleaseByteArrayElements(data, b, JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#import <AppKit/AppKit.h>
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <sys/stat.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_port.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "hw/maple/maple_cfg.h"
|
||||
|
@ -21,6 +24,7 @@
|
|||
#endif
|
||||
#include "stdclass.h"
|
||||
#include "wsi/context.h"
|
||||
#include "emulator.h"
|
||||
|
||||
OSXKeyboardDevice keyboard(0);
|
||||
static std::shared_ptr<OSXKbGamepadDevice> kb_gamepad(0);
|
||||
|
@ -56,6 +60,18 @@ void UpdateInputState(u32 port) {
|
|||
}
|
||||
|
||||
void os_CreateWindow() {
|
||||
#if 0
|
||||
int ret = task_set_exception_ports(
|
||||
mach_task_self(),
|
||||
EXC_MASK_BAD_ACCESS,
|
||||
MACH_PORT_NULL,
|
||||
EXCEPTION_DEFAULT,
|
||||
0);
|
||||
|
||||
if (ret != KERN_SUCCESS) {
|
||||
printf("task_set_exception_ports: %s\n", mach_error_string(ret));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void os_SetupInput()
|
||||
|
@ -71,9 +87,6 @@ void os_SetupInput()
|
|||
}
|
||||
|
||||
void common_linux_setup();
|
||||
int reicast_init(int argc, char* argv[]);
|
||||
void dc_exit();
|
||||
void dc_resume();
|
||||
void rend_init_renderer();
|
||||
|
||||
extern "C" void emu_dc_exit()
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
#include "hw/mem/_vmem.h"
|
||||
#include "hw/maple/maple_cfg.h"
|
||||
#include "hw/maple/maple_devs.h"
|
||||
|
||||
void dc_init();
|
||||
void dc_reset(bool hard);
|
||||
#include "emulator.h"
|
||||
|
||||
class SerializeTest : public ::testing::Test {
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue