mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-07-11 01:24:01 +02:00
more work
This commit is contained in:
@@ -22,6 +22,7 @@ Core::Core(void)
|
||||
Core::~Core(void)
|
||||
{
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
void DebugCallback(void *Context, int level, const char *message)
|
||||
{
|
||||
@@ -36,6 +37,7 @@ void StateCallback(void *Context2, m64p_core_param ParamChanged, int NewValue)
|
||||
bool Core::Init(m64p_dynlib_handle handle)
|
||||
{
|
||||
m64p_error ret;
|
||||
|
||||
if (!M64P::Core.IsHooked())
|
||||
{
|
||||
this->error_Message = "M64P::Core is not hooked!";
|
||||
@@ -55,8 +57,6 @@ bool Core::Init(m64p_dynlib_handle handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool Core::HasPluginConfig(PluginType type)
|
||||
{
|
||||
return this->plugin_Get(type)->HasConfig();
|
||||
@@ -64,7 +64,44 @@ bool Core::HasPluginConfig(PluginType type)
|
||||
|
||||
bool Core::OpenPluginConfig(PluginType type)
|
||||
{
|
||||
return this->plugin_Get(type)->OpenConfig();
|
||||
bool ret, paused;
|
||||
|
||||
paused = this->emulation_IsPaused();
|
||||
|
||||
if (!paused)
|
||||
this->PauseEmulation();
|
||||
|
||||
ret = this->plugin_Get(type)->OpenConfig();
|
||||
|
||||
if (!paused)
|
||||
this->ResumeEmulation();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Core::TakeScreenshot(void)
|
||||
{
|
||||
m64p_error ret;
|
||||
|
||||
ret = M64P::Core.DoCommand(M64CMD_TAKE_NEXT_SCREENSHOT, 0, NULL);
|
||||
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
this->error_Message = "Core::TakeScreenshot M64P::Core.DoCommand(M64CMD_TAKE_NEXT_SCREENSHOT) Failed: ";
|
||||
this->error_Message += M64P::Core.ErrorMessage(ret);
|
||||
}
|
||||
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
bool Core::EnableSpeedLimiter(void)
|
||||
{
|
||||
return this->emulation_SpeedLimited(true);
|
||||
}
|
||||
|
||||
bool Core::DisableSpeedLimiter(void)
|
||||
{
|
||||
return this->emulation_SpeedLimited(false);
|
||||
}
|
||||
|
||||
M64P::Wrapper::Plugin *Core::plugin_Get(PluginType type)
|
||||
@@ -313,6 +350,16 @@ bool Core::ResumeEmulation(void)
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
bool Core::IsEmulationRunning(void)
|
||||
{
|
||||
return emulation_IsRunning();
|
||||
}
|
||||
|
||||
bool Core::isEmulationPaused(void)
|
||||
{
|
||||
return emulation_IsPaused();
|
||||
}
|
||||
|
||||
bool Core::ResetEmulation(bool hard)
|
||||
{
|
||||
m64p_error ret;
|
||||
@@ -412,3 +459,19 @@ bool Core::emulation_IsPaused(void)
|
||||
|
||||
return state == M64EMU_PAUSED;
|
||||
}
|
||||
|
||||
bool Core::emulation_SpeedLimited(bool enabled)
|
||||
{
|
||||
m64p_error ret;
|
||||
|
||||
int value = enabled ? 1 : 0;
|
||||
|
||||
ret = M64P::Core.DoCommand(M64CMD_CORE_STATE_SET, M64CORE_SPEED_LIMITER, &enabled);
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
this->error_Message = "Core::emulation_SpeedLimited: M64P::Core.DoCommand(M64CMD_CORE_STATE_SET) Failed: ";
|
||||
this->error_Message += M64P::Core.ErrorMessage(ret);
|
||||
}
|
||||
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ namespace M64P
|
||||
bool ResumeEmulation(void);
|
||||
bool ResetEmulation(bool);
|
||||
|
||||
bool IsEmulationRunning(void);
|
||||
bool isEmulationPaused(void);
|
||||
|
||||
bool TakeScreenshot(void);
|
||||
|
||||
bool EnableSpeedLimiter(void);
|
||||
bool DisableSpeedLimiter(void);
|
||||
|
||||
QString GetLastError(void);
|
||||
|
||||
private:
|
||||
@@ -65,6 +73,8 @@ namespace M64P
|
||||
bool emulation_QueryState(m64p_emu_state*);
|
||||
bool emulation_IsRunning(void);
|
||||
bool emulation_IsPaused(void);
|
||||
bool emulation_SpeedLimited(bool);
|
||||
|
||||
};
|
||||
} // namespace Wrapper
|
||||
} // namespace M64P
|
||||
|
||||
@@ -55,6 +55,8 @@ bool MainWindow::Init(void)
|
||||
g_MupenApi.Core.GetPlugins(M64P::Wrapper::PluginType::Audio);
|
||||
g_MupenApi.Core.GetPlugins(M64P::Wrapper::PluginType::Input);
|
||||
|
||||
g_MupenApi.Config.SetOption("Core", "ScreenshotPath", "Screenshots");
|
||||
|
||||
this->ui_Init();
|
||||
this->ui_Setup();
|
||||
|
||||
@@ -393,6 +395,7 @@ void MainWindow::menuBar_Actions_Connect(void)
|
||||
connect(this->action_System_SoftReset, &QAction::triggered, this, &MainWindow::on_Action_System_SoftReset);
|
||||
connect(this->action_System_HardReset, &QAction::triggered, this, &MainWindow::on_Action_System_HardReset);
|
||||
connect(this->action_System_Pause, &QAction::triggered, this, &MainWindow::on_Action_System_Pause);
|
||||
connect(this->action_System_GenerateBitmap, &QAction::triggered, this, &MainWindow::on_Action_System_GenerateBitmap);
|
||||
connect(this->action_System_LimitFPS, &QAction::triggered, this, &MainWindow::on_Action_System_LimitFPS);
|
||||
connect(this->action_System_SwapDisk, &QAction::triggered, this, &MainWindow::on_Action_System_SwapDisk);
|
||||
connect(this->action_System_SaveState, &QAction::triggered, this, &MainWindow::on_Action_System_SaveState);
|
||||
@@ -520,12 +523,29 @@ void MainWindow::on_Action_System_Pause(void)
|
||||
|
||||
void MainWindow::on_Action_System_GenerateBitmap(void)
|
||||
{
|
||||
|
||||
if (!g_MupenApi.Core.TakeScreenshot())
|
||||
{
|
||||
this->ui_MessageBox("Error", "Api::Core::TakeScreenshot Failed!", g_MupenApi.Core.GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_Action_System_LimitFPS(void)
|
||||
{
|
||||
bool enabled, ret;
|
||||
|
||||
enabled = this->action_System_LimitFPS->isChecked();
|
||||
|
||||
std::cout << "enabled: " << enabled << std::endl;
|
||||
|
||||
if (enabled)
|
||||
ret = g_MupenApi.Core.EnableSpeedLimiter();
|
||||
else
|
||||
ret = g_MupenApi.Core.DisableSpeedLimiter();
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
this->ui_MessageBox("Error", "aaaa Failed:", g_MupenApi.Core.GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_Action_System_SwapDisk(void)
|
||||
|
||||
Reference in New Issue
Block a user