mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-23 16:19:44 +00:00
Buildfix android, misc other fixes, some include cleanup
This commit is contained in:
parent
187159eb53
commit
724a600381
@ -29,6 +29,7 @@
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#ifdef _WIN32
|
||||
#include "Windows/OpenGLBase.h"
|
||||
#include "Windows/InputDevice.h"
|
||||
#endif
|
||||
|
||||
#include "Host.h"
|
||||
@ -39,19 +40,10 @@ event m_hStepEvent;
|
||||
recursive_mutex m_hStepMutex;
|
||||
event m_hInactiveEvent;
|
||||
recursive_mutex m_hInactiveMutex;
|
||||
|
||||
#ifdef _WIN32
|
||||
InputState input_state;
|
||||
|
||||
// This can be read and written from ANYWHERE.
|
||||
volatile CoreState coreState = CORE_STEPPING;
|
||||
// Note: intentionally not used for CORE_NEXTFRAME.
|
||||
volatile bool coreStatePending = false;
|
||||
|
||||
void Core_UpdateState(CoreState newState)
|
||||
{
|
||||
if ((coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME) && newState != CORE_RUNNING)
|
||||
coreStatePending = true;
|
||||
coreState = newState;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Core_ErrorPause()
|
||||
{
|
||||
@ -108,17 +100,20 @@ void UpdateScreenScale() {
|
||||
pixel_in_dps = (float)pixel_xres / dp_xres;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void Core_RunLoop()
|
||||
{
|
||||
while (!coreState) {
|
||||
time_update();
|
||||
UpdateScreenScale();
|
||||
{
|
||||
lock_guard guard(input_state.lock);
|
||||
if (GetAsyncKeyState(VK_ESCAPE)) {
|
||||
input_state.pad_buttons |= PAD_BUTTON_MENU;
|
||||
} else {
|
||||
input_state.pad_buttons &= ~PAD_BUTTON_MENU;
|
||||
{
|
||||
lock_guard guard(input_state.lock);
|
||||
if (GetAsyncKeyState(VK_ESCAPE)) {
|
||||
input_state.pad_buttons |= PAD_BUTTON_MENU;
|
||||
} else {
|
||||
input_state.pad_buttons &= ~PAD_BUTTON_MENU;
|
||||
}
|
||||
}
|
||||
NativeUpdate(input_state);
|
||||
}
|
||||
@ -129,6 +124,7 @@ void Core_RunLoop()
|
||||
GL_SwapBuffers();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Core_DoSingleStep()
|
||||
{
|
||||
|
21
Core/Core.h
21
Core/Core.h
@ -17,8 +17,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../Globals.h"
|
||||
#include "CoreParameter.h"
|
||||
#include "Globals.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
|
||||
// called from emu thread
|
||||
void Core_Run();
|
||||
@ -33,22 +34,8 @@ void Core_Halt(const char *msg);
|
||||
|
||||
bool Core_IsStepping();
|
||||
|
||||
// RUNNING must be at 0.
|
||||
enum CoreState
|
||||
{
|
||||
CORE_RUNNING = 0,
|
||||
CORE_STEPPING,
|
||||
CORE_POWERDOWN,
|
||||
CORE_ERROR,
|
||||
CORE_NEXTFRAME,
|
||||
};
|
||||
|
||||
void Core_UpdateState(CoreState newState);
|
||||
bool Core_IsInactive();
|
||||
void Core_WaitInactive();
|
||||
void Core_WaitInactive(int milliseconds);
|
||||
|
||||
void UpdateScreenScale();
|
||||
|
||||
|
||||
extern volatile CoreState coreState;
|
||||
void UpdateScreenScale();
|
@ -16,16 +16,15 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
|
||||
#include "../../MemMap.h"
|
||||
|
||||
#include "../MIPS.h"
|
||||
#include "ArmEmitter.h"
|
||||
#include "../../CoreTiming.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "MemoryUtil.h"
|
||||
|
||||
#include "ArmEmitter.h"
|
||||
#include "ArmJit.h"
|
||||
#include "../JitCommon/JitCommon.h"
|
||||
#include "../../Core.h"
|
||||
#include "ArmAsm.h"
|
||||
|
||||
using namespace ArmGen;
|
||||
|
@ -15,16 +15,16 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "MIPSTables.h"
|
||||
|
||||
#include "MIPS.h"
|
||||
#include "MIPSDis.h"
|
||||
#include "MIPSDisVFPU.h"
|
||||
#include "MIPSInt.h"
|
||||
#include "MIPSIntVFPU.h"
|
||||
#include "MIPSCodeUtils.h"
|
||||
#include "../../Core/CoreTiming.h"
|
||||
#include "../Debugger/Breakpoints.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSDis.h"
|
||||
#include "Core/MIPS/MIPSDisVFPU.h"
|
||||
#include "Core/MIPS/MIPSInt.h"
|
||||
#include "Core/MIPS/MIPSIntVFPU.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
#include "Core/MIPS/MIPSTables.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Debugger/Breakpoints.h"
|
||||
|
||||
#include "JitCommon/JitCommon.h"
|
||||
|
||||
|
@ -20,11 +20,12 @@
|
||||
|
||||
#include "../../MemMap.h"
|
||||
|
||||
#include "../MIPS.h"
|
||||
#include "../../CoreTiming.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Common/MemoryUtil.h"
|
||||
|
||||
#include "ABI.h"
|
||||
#include "Jit.h"
|
||||
#include "../JitCommon/JitCommon.h"
|
||||
#include "../../Core.h"
|
||||
|
@ -18,13 +18,14 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "../../Core.h"
|
||||
#include "../../CoreTiming.h"
|
||||
#include "../../Config.h"
|
||||
#include "../MIPS.h"
|
||||
#include "../MIPSCodeUtils.h"
|
||||
#include "../MIPSInt.h"
|
||||
#include "../MIPSTables.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
#include "Core/MIPS/MIPSInt.h"
|
||||
#include "Core/MIPS/MIPSTables.h"
|
||||
|
||||
#include "RegCache.h"
|
||||
#include "Jit.h"
|
||||
|
@ -53,6 +53,18 @@ GlobalUIState globalUIState;
|
||||
static CoreParameter coreParameter;
|
||||
static PSPMixer *mixer;
|
||||
|
||||
// This can be read and written from ANYWHERE.
|
||||
volatile CoreState coreState = CORE_STEPPING;
|
||||
// Note: intentionally not used for CORE_NEXTFRAME.
|
||||
volatile bool coreStatePending = false;
|
||||
|
||||
void Core_UpdateState(CoreState newState)
|
||||
{
|
||||
if ((coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME) && newState != CORE_RUNNING)
|
||||
coreStatePending = true;
|
||||
coreState = newState;
|
||||
}
|
||||
|
||||
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
|
||||
{
|
||||
INFO_LOG(HLE, "PPSSPP %s", PPSSPP_GIT_VERSION);
|
||||
|
@ -45,4 +45,18 @@ void PSP_SWI();
|
||||
|
||||
void GetSysDirectories(std::string &memstickpath, std::string &flash0path);
|
||||
|
||||
// RUNNING must be at 0.
|
||||
enum CoreState
|
||||
{
|
||||
CORE_RUNNING = 0,
|
||||
CORE_STEPPING,
|
||||
CORE_POWERDOWN,
|
||||
CORE_ERROR,
|
||||
CORE_NEXTFRAME,
|
||||
};
|
||||
|
||||
extern volatile CoreState coreState;
|
||||
extern volatile bool coreStatePending;
|
||||
void Core_UpdateState(CoreState newState);
|
||||
|
||||
CoreParameter &PSP_CoreParameter();
|
@ -55,12 +55,10 @@ DWORD TheThread(LPVOID x) {
|
||||
Host *oldHost = host;
|
||||
UpdateScreenScale();
|
||||
|
||||
NativeInit(0, 0, memstick.c_str(), "C:\\", "1234");
|
||||
NativeInit(0, 0, memstick.c_str(), memstick.c_str(), "1234");
|
||||
Host *nativeHost = host;
|
||||
host = oldHost;
|
||||
|
||||
CoreParameter coreParameter;
|
||||
|
||||
host->UpdateUI();
|
||||
|
||||
std::string error_string;
|
||||
@ -78,7 +76,6 @@ DWORD TheThread(LPVOID x) {
|
||||
_dbg_update_();
|
||||
|
||||
Core_EnableStepping(FALSE);
|
||||
|
||||
Core_Run();
|
||||
|
||||
shutdown:
|
||||
|
@ -357,8 +357,7 @@ namespace MainWindow
|
||||
SendMessage(memoryWindow[i]->GetDlgHandle(), WM_CLOSE, 0, 0);
|
||||
|
||||
NativeMessageReceived("stop", "");
|
||||
|
||||
// EmuThread_Stop();
|
||||
|
||||
SetPlaying(0);
|
||||
Update();
|
||||
UpdateMenus();
|
||||
@ -373,25 +372,7 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_EMULATION_RESET:
|
||||
/*
|
||||
for (int i=0; i<numCPUs; i++)
|
||||
if (disasmWindow[i])
|
||||
SendMessage(disasmWindow[i]->GetDlgHandle(), WM_COMMAND, IDC_STOP, 0);
|
||||
|
||||
Core_WaitInactive();
|
||||
|
||||
for (int i=0; i<numCPUs; i++)
|
||||
if (disasmWindow[i])
|
||||
SendMessage(disasmWindow[i]->GetDlgHandle(), WM_CLOSE, 0, 0);
|
||||
for (int i=0; i<numCPUs; i++)
|
||||
if (memoryWindow[i])
|
||||
SendMessage(memoryWindow[i]->GetDlgHandle(), WM_CLOSE, 0, 0);
|
||||
|
||||
|
||||
EmuThread_Stop();
|
||||
|
||||
EmuThread_Start(GetCurrentFilename());*/
|
||||
|
||||
NativeMessageReceived("reset", "");
|
||||
break;
|
||||
|
||||
case ID_EMULATION_SPEEDLIMIT:
|
||||
@ -710,7 +691,6 @@ namespace MainWindow
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void UpdateMenus()
|
||||
{
|
||||
HMENU menu = GetMenu(GetHWND());
|
||||
@ -741,7 +721,7 @@ namespace MainWindow
|
||||
EnableMenuItem(menu,ID_EMULATION_RUN, (Core_IsStepping() || globalUIState == UISTATE_PAUSEMENU) ? MF_ENABLED : MF_GRAYED);
|
||||
EnableMenuItem(menu,ID_EMULATION_PAUSE, globalUIState == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED);
|
||||
EnableMenuItem(menu,ID_EMULATION_STOP, globalUIState == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED);
|
||||
EnableMenuItem(menu,ID_EMULATION_RESET, MF_GRAYED); //pspRunning ? MF_ENABLED : MF_GRAYED);
|
||||
EnableMenuItem(menu,ID_EMULATION_RESET, globalUIState == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED);
|
||||
|
||||
UINT enable = globalUIState == UISTATE_MENU ? MF_ENABLED : MF_GRAYED;
|
||||
EnableMenuItem(menu,ID_FILE_LOAD,enable);
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <Core/Core.h>
|
||||
|
||||
#include "Core/System.h"
|
||||
|
||||
namespace MainWindow
|
||||
{
|
||||
|
@ -24,16 +24,17 @@
|
||||
#include "input/input_state.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "../../Core/Config.h"
|
||||
#include "../../Core/CoreTiming.h"
|
||||
#include "../../Core/CoreParameter.h"
|
||||
#include "../../Core/Core.h"
|
||||
#include "../../Core/Host.h"
|
||||
#include "../../Core/System.h"
|
||||
#include "../../Core/MIPS/MIPS.h"
|
||||
#include "../../GPU/GPUState.h"
|
||||
#include "../../GPU/GPUInterface.h"
|
||||
#include "../../Core/HLE/sceCtrl.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
|
||||
#include "GamepadEmu.h"
|
||||
#include "UIShader.h"
|
||||
@ -80,11 +81,16 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true)
|
||||
}
|
||||
|
||||
host->BootDone();
|
||||
host->AttemptLoadSymbolMap();
|
||||
host->UpdateDisassembly();
|
||||
|
||||
#ifdef _WIN32
|
||||
if (g_Config.bAutoRun) {
|
||||
Core_EnableStepping(false);
|
||||
} else {
|
||||
Core_EnableStepping(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
LayoutGamepad(dp_xres, dp_yres);
|
||||
|
||||
@ -95,6 +101,8 @@ EmuScreen::~EmuScreen()
|
||||
{
|
||||
if (!invalid_) {
|
||||
// If we were invalid, it would already be shutdown.
|
||||
|
||||
// symbolMap.SaveSymbolMap(SymbolMapFilename(coreParam.fileToStart).c_str());
|
||||
PSP_Shutdown();
|
||||
}
|
||||
}
|
||||
@ -112,6 +120,23 @@ void EmuScreen::sendMessage(const char *message, const char *value)
|
||||
screenManager()->push(new PauseScreen());
|
||||
} else if (!strcmp(message, "stop")) {
|
||||
screenManager()->switchScreen(new MenuScreen());
|
||||
} else if (!strcmp(message, "reset")) {
|
||||
PSP_Shutdown();
|
||||
std::string resetError;
|
||||
if (!PSP_Init(PSP_CoreParameter(), &resetError)) {
|
||||
ELOG("Error resetting: %s", resetError);
|
||||
screenManager()->switchScreen(new MenuScreen());
|
||||
return;
|
||||
}
|
||||
host->BootDone();
|
||||
host->UpdateDisassembly();
|
||||
#ifdef _WIN32
|
||||
if (g_Config.bAutoRun) {
|
||||
Core_EnableStepping(false);
|
||||
} else {
|
||||
Core_EnableStepping(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "ui/screen.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "base/mutex.h"
|
||||
#include "FileUtil.h"
|
||||
#include "LogManager.h"
|
||||
#include "../../Core/PSPMixer.h"
|
||||
@ -60,6 +61,12 @@ ScreenManager *screenManager;
|
||||
std::string config_filename;
|
||||
std::string game_title;
|
||||
|
||||
recursive_mutex pendingMutex;
|
||||
static bool isMessagePending;
|
||||
static std::string pendingMessage;
|
||||
static std::string pendingValue;
|
||||
|
||||
|
||||
class AndroidLogger : public LogListener
|
||||
{
|
||||
public:
|
||||
@ -149,7 +156,7 @@ int NativeMix(short *audio, int num_samples)
|
||||
else
|
||||
{
|
||||
//memset(audio, 0, numSamples * 2);
|
||||
return num_samples;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +175,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
{
|
||||
EnableFZ();
|
||||
std::string user_data_path = savegame_directory;
|
||||
|
||||
isMessagePending = false;
|
||||
// We want this to be FIRST.
|
||||
#ifdef BLACKBERRY
|
||||
// Packed assets are included in app/native/ dir
|
||||
@ -362,6 +369,14 @@ void NativeRender()
|
||||
|
||||
void NativeUpdate(InputState &input)
|
||||
{
|
||||
{
|
||||
lock_guard lock(pendingMutex);
|
||||
if (isMessagePending) {
|
||||
screenManager->sendMessage(pendingMessage.c_str(), pendingValue.c_str());
|
||||
isMessagePending = false;
|
||||
}
|
||||
}
|
||||
|
||||
UIUpdateMouse(0, input.pointer_x[0], input.pointer_y[0], input.pointer_down[0]);
|
||||
screenManager->update(input);
|
||||
}
|
||||
@ -394,7 +409,13 @@ void NativeTouch(int finger, float x, float y, double time, TouchEvent event)
|
||||
|
||||
void NativeMessageReceived(const char *message, const char *value)
|
||||
{
|
||||
screenManager->sendMessage(message, value);
|
||||
// We can only have one message queued.
|
||||
lock_guard lock(pendingMutex);
|
||||
if (!isMessagePending) {
|
||||
pendingMessage = message;
|
||||
pendingValue = value;
|
||||
isMessagePending = true;
|
||||
}
|
||||
}
|
||||
|
||||
void NativeShutdownGraphics()
|
||||
|
@ -19,7 +19,7 @@ static volatile BOOL done = 0;
|
||||
#define SAMPLE_SIZE 44100
|
||||
static short stream[SAMPLE_SIZE];
|
||||
|
||||
int NativeMixCount(short *audio, int num_samples);
|
||||
int NativeMix(short *audio, int num_samples);
|
||||
|
||||
@interface AudioEngine ()
|
||||
|
||||
@ -124,7 +124,7 @@ int NativeMixCount(short *audio, int num_samples);
|
||||
{
|
||||
size_t frames_ready;
|
||||
if (![self playing])
|
||||
frames_ready = NativeMixCount(stream, SAMPLE_SIZE / 2);
|
||||
frames_ready = NativeMix(stream, SAMPLE_SIZE / 2);
|
||||
else
|
||||
frames_ready = 0;
|
||||
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit a47c3b465eb2a37f817dd0950cec8cd81375a2db
|
||||
Subproject commit 4f5a60d82b38dbb609084782211a272b9e4e53fb
|
Loading…
Reference in New Issue
Block a user