mirror of https://github.com/AxioDL/metaforce.git
Lots of Windows fixes; add D3D12; more boo decoupling
This commit is contained in:
parent
54330e43b6
commit
c33674b9ab
|
@ -605,12 +605,12 @@ void CNESEmulator::ProcessUserInput(const CFinalInput& input, int) {
|
||||||
|
|
||||||
if (GetPasswordEntryState() != EPasswordEntryState::NotPasswordScreen) {
|
if (GetPasswordEntryState() != EPasswordEntryState::NotPasswordScreen) {
|
||||||
// Don't swap A/B
|
// Don't swap A/B
|
||||||
inValReads[BUTTON_A] = input.DA() || input.DSpecialKey(boo::ESpecialKey::Enter) ||
|
inValReads[BUTTON_A] = input.DA() || input.DSpecialKey(aurora::SpecialKey::Enter) ||
|
||||||
input.DMouseButton(boo::EMouseButton::Primary);
|
input.DMouseButton(EMouseButton::Primary);
|
||||||
inValReads[BUTTON_B] = input.DB() || input.DSpecialKey(boo::ESpecialKey::Esc);
|
inValReads[BUTTON_B] = input.DB() || input.DSpecialKey(aurora::SpecialKey::Esc);
|
||||||
} else {
|
} else {
|
||||||
// Prime controls (B jumps, A shoots)
|
// Prime controls (B jumps, A shoots)
|
||||||
inValReads[BUTTON_B] = input.DA() || input.DY() || input.DMouseButton(boo::EMouseButton::Primary);
|
inValReads[BUTTON_B] = input.DA() || input.DY() || input.DMouseButton(EMouseButton::Primary);
|
||||||
inValReads[BUTTON_A] = input.DB() || input.DX() || input.DKey(' ');
|
inValReads[BUTTON_A] = input.DB() || input.DX() || input.DKey(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ void CNESEmulator::ProcessUserInput(const CFinalInput& input, int) {
|
||||||
inValReads[BUTTON_LEFT] = input.DDPLeft() || input.DLALeft();
|
inValReads[BUTTON_LEFT] = input.DDPLeft() || input.DLALeft();
|
||||||
inValReads[BUTTON_RIGHT] = input.DDPRight() || input.DLARight();
|
inValReads[BUTTON_RIGHT] = input.DDPRight() || input.DLARight();
|
||||||
inValReads[BUTTON_SELECT] = input.DZ() || input.DKey('\t');
|
inValReads[BUTTON_SELECT] = input.DZ() || input.DKey('\t');
|
||||||
inValReads[BUTTON_START] = input.DStart() || input.DSpecialKey(boo::ESpecialKey::Esc);
|
inValReads[BUTTON_START] = input.DStart() || input.DSpecialKey(aurora::SpecialKey::Esc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNESEmulator::CheckForGameOver(const u8* vram, u8* passwordOut) {
|
bool CNESEmulator::CheckForGameOver(const u8* vram, u8* passwordOut) {
|
||||||
|
|
|
@ -490,7 +490,7 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa
|
||||||
std::array<float, 4> dirs{};
|
std::array<float, 4> dirs{};
|
||||||
bool mouseHeld = false;
|
bool mouseHeld = false;
|
||||||
if (const auto& kbm = input.GetKBM()) {
|
if (const auto& kbm = input.GetKBM()) {
|
||||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
if (kbm->m_mouseButtons[size_t(EMouseButton::Primary)]) {
|
||||||
mouseHeld = true;
|
mouseHeld = true;
|
||||||
if (float(m_mouseDelta.x()) < 0.f)
|
if (float(m_mouseDelta.x()) < 0.f)
|
||||||
dirs[3] = -m_mouseDelta.x();
|
dirs[3] = -m_mouseDelta.x();
|
||||||
|
@ -662,8 +662,8 @@ void CAutoMapper::ProcessMapPanInput(const CFinalInput& input, const CStateManag
|
||||||
|
|
||||||
bool mouseHeld = false;
|
bool mouseHeld = false;
|
||||||
if (const auto& kbm = input.GetKBM()) {
|
if (const auto& kbm = input.GetKBM()) {
|
||||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Middle)] ||
|
if (kbm->m_mouseButtons[size_t(EMouseButton::Middle)] ||
|
||||||
kbm->m_mouseButtons[size_t(boo::EMouseButton::Secondary)]) {
|
kbm->m_mouseButtons[size_t(EMouseButton::Secondary)]) {
|
||||||
mouseHeld = true;
|
mouseHeld = true;
|
||||||
if (float(m_mouseDelta.x()) < 0.f)
|
if (float(m_mouseDelta.x()) < 0.f)
|
||||||
right += -m_mouseDelta.x();
|
right += -m_mouseDelta.x();
|
||||||
|
@ -789,10 +789,10 @@ void CAutoMapper::SetShouldRotatingSoundBePlaying(bool shouldBePlaying) {
|
||||||
void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, CStateManager& mgr) {
|
void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, CStateManager& mgr) {
|
||||||
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
||||||
if (x1bc_state == EAutoMapperState::MapScreen) {
|
if (x1bc_state == EAutoMapperState::MapScreen) {
|
||||||
if ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter)) && x328_ == 0 && HasCurrentMapUniverseWorld())
|
if ((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter)) && x328_ == 0 && HasCurrentMapUniverseWorld())
|
||||||
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
|
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
|
||||||
} else if (x1bc_state == EAutoMapperState::MapScreenUniverse &&
|
} else if (x1bc_state == EAutoMapperState::MapScreenUniverse &&
|
||||||
(input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter))) {
|
(input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter))) {
|
||||||
const CMapUniverse::CMapWorldData& mapuWld = x8_mapu->GetMapWorldData(x9c_worldIdx);
|
const CMapUniverse::CMapWorldData& mapuWld = x8_mapu->GetMapWorldData(x9c_worldIdx);
|
||||||
zeus::CVector3f pointLocal = mapuWld.GetWorldTransform().inverse() * xa8_renderStates[0].x20_areaPoint;
|
zeus::CVector3f pointLocal = mapuWld.GetWorldTransform().inverse() * xa8_renderStates[0].x20_areaPoint;
|
||||||
if (mapuWld.GetWorldAssetId() != g_GameState->CurrentWorldAssetId()) {
|
if (mapuWld.GetWorldAssetId() != g_GameState->CurrentWorldAssetId()) {
|
||||||
|
@ -807,7 +807,7 @@ void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, CStateManager&
|
||||||
}
|
}
|
||||||
|
|
||||||
x2f4_aButtonPos = 0;
|
x2f4_aButtonPos = 0;
|
||||||
if (input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter))
|
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter))
|
||||||
x2f4_aButtonPos = 1;
|
x2f4_aButtonPos = 1;
|
||||||
|
|
||||||
if (IsInPlayerControlState()) {
|
if (IsInPlayerControlState()) {
|
||||||
|
@ -1084,7 +1084,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.PZ() || input.PKey('\t') || input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) {
|
if (input.PZ() || input.PKey('\t') || input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||||
if (x328_ == 0) {
|
if (x328_ == 0) {
|
||||||
if (CanLeaveMapScreenInternal(mgr)) {
|
if (CanLeaveMapScreenInternal(mgr)) {
|
||||||
LeaveMapScreen(mgr);
|
LeaveMapScreen(mgr);
|
||||||
|
|
|
@ -181,8 +181,8 @@ private:
|
||||||
|
|
||||||
std::optional<zeus::CVector2f> m_lastMouseCoord;
|
std::optional<zeus::CVector2f> m_lastMouseCoord;
|
||||||
zeus::CVector2f m_mouseDelta;
|
zeus::CVector2f m_mouseDelta;
|
||||||
boo::SScrollDelta m_lastAccumScroll;
|
SScrollDelta m_lastAccumScroll;
|
||||||
boo::SScrollDelta m_mapScroll;
|
SScrollDelta m_mapScroll;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static void SetResLockState(T& list, bool lock) {
|
static void SetResLockState(T& list, bool lock) {
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "Runtime/Graphics/Shaders/CMapSurfaceShader.hpp"
|
#include "Runtime/Graphics/Shaders/CMapSurfaceShader.hpp"
|
||||||
#include "Runtime/RetroTypes.hpp"
|
#include "Runtime/RetroTypes.hpp"
|
||||||
|
|
||||||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
|
||||||
|
|
||||||
#include <zeus/CAABox.hpp>
|
#include <zeus/CAABox.hpp>
|
||||||
#include <zeus/CVector3f.hpp>
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#else
|
#else
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
struct _stat64;
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Runtime/GCNTypes.hpp"
|
#include "Runtime/GCNTypes.hpp"
|
||||||
|
|
|
@ -12,11 +12,21 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#ifndef NOMINMAX
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <nowide/stackstring.hpp>
|
||||||
#ifndef _WIN32_IE
|
#ifndef _WIN32_IE
|
||||||
#define _WIN32_IE 0x0400
|
#define _WIN32_IE 0x0400
|
||||||
#endif
|
#endif
|
||||||
#include <shlobj.h>
|
#include <ShlObj.h>
|
||||||
|
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
|
||||||
|
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
|
@ -191,7 +201,7 @@ void CBasics::Swap8Bytes(u8* v) {
|
||||||
#if __GNUC__
|
#if __GNUC__
|
||||||
*val = __builtin_bswap64(*val);
|
*val = __builtin_bswap64(*val);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
*val = _byteswap_uint64(val);
|
*val = _byteswap_uint64(*val);
|
||||||
#else
|
#else
|
||||||
*val = ((val & 0xFF00000000000000ULL) >> 56) | ((val & 0x00FF000000000000ULL) >> 40) |
|
*val = ((val & 0xFF00000000000000ULL) >> 56) | ((val & 0x00FF000000000000ULL) >> 40) |
|
||||||
((val & 0x0000FF0000000000ULL) >> 24) | ((val & 0x000000FF00000000ULL) >> 8) |
|
((val & 0x0000FF0000000000ULL) >> 24) | ((val & 0x000000FF00000000ULL) >> 8) |
|
||||||
|
|
|
@ -446,7 +446,7 @@ void CGameOptions::TryRestoreDefaults(const CFinalInput& input, int category, in
|
||||||
if (options.second[option].option != EGameOption::RestoreDefaults)
|
if (options.second[option].option != EGameOption::RestoreDefaults)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!forceRestore && !input.PA() && !input.PSpecialKey(boo::ESpecialKey::Enter))
|
if (!forceRestore && !input.PA() && !input.PSpecialKey(aurora::SpecialKey::Enter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (frontend) {
|
if (frontend) {
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#ifndef NOMINMAX
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "logvisor/logvisor.hpp"
|
#include "logvisor/logvisor.hpp"
|
||||||
|
|
||||||
#include "ImGuiEngine.hpp"
|
#include "ImGuiEngine.hpp"
|
||||||
|
@ -156,7 +166,7 @@ private:
|
||||||
// m_imguiCallback.resized(rect, sync);
|
// m_imguiCallback.resized(rect, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) override {
|
void mouseDown(const boo::SWindowCoord& coord, EMouseButton button, boo::EModifierKey mods) override {
|
||||||
// if (!ImGuiWindowCallback::m_mouseCaptured && g_mainMP1) {
|
// if (!ImGuiWindowCallback::m_mouseCaptured && g_mainMP1) {
|
||||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||||
// as->mouseDown(coord, button, mods);
|
// as->mouseDown(coord, button, mods);
|
||||||
|
@ -165,7 +175,7 @@ private:
|
||||||
// m_imguiCallback.mouseDown(coord, button, mods);
|
// m_imguiCallback.mouseDown(coord, button, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) override {
|
void mouseUp(const boo::SWindowCoord& coord, EMouseButton button, boo::EModifierKey mods) override {
|
||||||
if (g_mainMP1) {
|
if (g_mainMP1) {
|
||||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||||
as->mouseUp(coord, button, mods);
|
as->mouseUp(coord, button, mods);
|
||||||
|
@ -214,23 +224,23 @@ private:
|
||||||
// m_imguiCallback.charKeyUp(charCode, mods);
|
// m_imguiCallback.charKeyUp(charCode, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat) override {
|
void specialKeyDown(aurora::SpecialKey key, boo::EModifierKey mods, bool isRepeat) override {
|
||||||
// if (!ImGuiWindowCallback::m_keyboardCaptured && g_mainMP1) {
|
// if (!ImGuiWindowCallback::m_keyboardCaptured && g_mainMP1) {
|
||||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||||
// as->specialKeyDown(key, mods, isRepeat);
|
// as->specialKeyDown(key, mods, isRepeat);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if (True(mods & boo::EModifierKey::Alt)) {
|
// if (True(mods & boo::EModifierKey::Alt)) {
|
||||||
// if (key == boo::ESpecialKey::Enter) {
|
// if (key == aurora::SpecialKey::Enter) {
|
||||||
// m_fullscreenToggleRequested = true;
|
// m_fullscreenToggleRequested = true;
|
||||||
// } else if (key == boo::ESpecialKey::F4) {
|
// } else if (key == aurora::SpecialKey::F4) {
|
||||||
// m_windowInvalid = true;
|
// m_windowInvalid = true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// m_imguiCallback.specialKeyDown(key, mods, isRepeat);
|
// m_imguiCallback.specialKeyDown(key, mods, isRepeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods) override {
|
void specialKeyUp(aurora::SpecialKey key, boo::EModifierKey mods) override {
|
||||||
// if (g_mainMP1) {
|
// if (g_mainMP1) {
|
||||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||||
// as->specialKeyUp(key, mods);
|
// as->specialKeyUp(key, mods);
|
||||||
|
@ -272,7 +282,7 @@ public:
|
||||||
Application(FileStoreManager& fileMgr, CVarManager& cvarMgr, CVarCommons& cvarCmns)
|
Application(FileStoreManager& fileMgr, CVarManager& cvarMgr, CVarCommons& cvarCmns)
|
||||||
: m_fileMgr(fileMgr), m_cvarManager(cvarMgr), m_cvarCommons(cvarCmns), m_imGuiConsole(cvarMgr, cvarCmns) {}
|
: m_fileMgr(fileMgr), m_cvarManager(cvarMgr), m_cvarCommons(cvarCmns), m_imGuiConsole(cvarMgr, cvarCmns) {}
|
||||||
|
|
||||||
void onAppLaunched() override {
|
void onAppLaunched() noexcept override {
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
auto backend = static_cast<std::string>(aurora::get_backend_string());
|
auto backend = static_cast<std::string>(aurora::get_backend_string());
|
||||||
|
|
|
@ -2,11 +2,23 @@
|
||||||
|
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
#include "Runtime/IMain.hpp"
|
#include "Runtime/IMain.hpp"
|
||||||
|
#include "Runtime/CBasics.hpp"
|
||||||
|
|
||||||
#include <shlobj.h>
|
#include <ShlObj.h>
|
||||||
|
#include <SDL_filesystem.h>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
|
static std::optional<std::string> GetPrefPath(const char* app) {
|
||||||
|
char* path = SDL_GetPrefPath(nullptr, app);
|
||||||
|
if (path == nullptr) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
std::string str{path};
|
||||||
|
SDL_free(path);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
#if WINDOWS_STORE
|
#if WINDOWS_STORE
|
||||||
using namespace Windows::Storage;
|
using namespace Windows::Storage;
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,8 +65,8 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
||||||
|
|
||||||
path += fmt::format(FMT_STRING("/GC/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format(FMT_STRING("/GC/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
|
|
||||||
hecl::Sstat theStat;
|
struct _stat64 theStat{};
|
||||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
if (_stat64(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@ -101,26 +113,33 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path += "/GC";
|
path += "/GC";
|
||||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
if (CBasics::RecursiveMakeDir(path.c_str()) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
path += fmt::format(FMT_STRING("/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format(FMT_STRING("/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
const nowide::wstackstring wpath(path);
|
||||||
|
FILE* fp = _wfopen(wpath.get(), L"wb");
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
} else {
|
} else {
|
||||||
std::string path = _GetDolphinCardPath(slot);
|
std::string path = _GetDolphinCardPath(slot);
|
||||||
hecl::SanitizePath(path);
|
|
||||||
if (path.find('/') == std::string::npos) {
|
if (path.find('/') == std::string::npos) {
|
||||||
path = hecl::GetcwdStr() + "/" + _GetDolphinCardPath(slot);
|
auto prefPath = GetPrefPath("Metaforce");
|
||||||
|
if (!prefPath) {
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
std::string tmpPath = path.substr(0, path.find_last_of("/"));
|
path = *prefPath + _GetDolphinCardPath(slot);
|
||||||
hecl::RecursiveMakeDir(tmpPath.c_str());
|
}
|
||||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
std::string tmpPath = path.substr(0, path.find_last_of('/'));
|
||||||
|
CBasics::RecursiveMakeDir(tmpPath.c_str());
|
||||||
|
const nowide::wstackstring wpath(path);
|
||||||
|
FILE* fp = _wfopen(wpath.get(), L"wb");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
fclose(fp);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
|
|
||||||
#include "logvisor/logvisor.hpp"
|
#include <logvisor/logvisor.hpp>
|
||||||
|
#if _WIN32
|
||||||
|
#include <nowide/convert.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#include <ShlObj.h>
|
#include <ShlObj.h>
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include <boo/System.hpp>
|
|
||||||
#include <logvisor/logvisor.hpp>
|
#include <logvisor/logvisor.hpp>
|
||||||
#include <zeus/CColor.hpp>
|
#include <zeus/CColor.hpp>
|
||||||
#include <zeus/CUnitVector.hpp>
|
#include <zeus/CUnitVector.hpp>
|
||||||
|
|
|
@ -9,11 +9,7 @@
|
||||||
|
|
||||||
#include "GX.hpp"
|
#include "GX.hpp"
|
||||||
|
|
||||||
//#include <boo/graphicsdev/IGraphicsCommandQueue.hpp>
|
|
||||||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
|
||||||
|
|
||||||
#include "ConsoleVariables/CVar.hpp"
|
#include "ConsoleVariables/CVar.hpp"
|
||||||
//#include <hecl/Runtime.hpp>
|
|
||||||
|
|
||||||
#include <zeus/CColor.hpp>
|
#include <zeus/CColor.hpp>
|
||||||
#include <zeus/CTransform.hpp>
|
#include <zeus/CTransform.hpp>
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
#include "Runtime/rstl.hpp"
|
#include "Runtime/rstl.hpp"
|
||||||
#include "Runtime/Graphics/CGraphics.hpp"
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
|
|
||||||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
|
||||||
|
|
||||||
//#include <hecl/UniformBufferPool.hpp>
|
|
||||||
//#include <hecl/VertexBufferPool.hpp>
|
|
||||||
|
|
||||||
#include <zeus/CColor.hpp>
|
#include <zeus/CColor.hpp>
|
||||||
#include <zeus/CVector2f.hpp>
|
#include <zeus/CVector2f.hpp>
|
||||||
#include <zeus/CVector3f.hpp>
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "Runtime/Streams/IOStreams.hpp"
|
#include "Runtime/Streams/IOStreams.hpp"
|
||||||
#include "Runtime/Graphics/CGraphics.hpp"
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
|
|
||||||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CVParamTransfer;
|
class CVParamTransfer;
|
||||||
class CTextureInfo;
|
class CTextureInfo;
|
||||||
|
|
|
@ -216,7 +216,7 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
|
||||||
m_lastMouseOverWidget = hit;
|
m_lastMouseOverWidget = hit;
|
||||||
}
|
}
|
||||||
if (hit && hit->m_lastScroll) {
|
if (hit && hit->m_lastScroll) {
|
||||||
boo::SScrollDelta delta = kbm->m_accumScroll - *hit->m_lastScroll;
|
SScrollDelta delta = kbm->m_accumScroll - *hit->m_lastScroll;
|
||||||
hit->m_lastScroll.emplace(kbm->m_accumScroll);
|
hit->m_lastScroll.emplace(kbm->m_accumScroll);
|
||||||
if (!delta.isZero()) {
|
if (!delta.isZero()) {
|
||||||
hit->m_integerScroll += delta;
|
hit->m_integerScroll += delta;
|
||||||
|
@ -226,7 +226,7 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
|
||||||
hit->m_integerScroll.delta[1] -= std::trunc(hit->m_integerScroll.delta[1]);
|
hit->m_integerScroll.delta[1] -= std::trunc(hit->m_integerScroll.delta[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_inMouseDown && kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
if (!m_inMouseDown && kbm->m_mouseButtons[size_t(EMouseButton::Primary)]) {
|
||||||
m_inMouseDown = true;
|
m_inMouseDown = true;
|
||||||
m_inCancel = false;
|
m_inCancel = false;
|
||||||
m_mouseDownWidget = hit;
|
m_mouseDownWidget = hit;
|
||||||
|
@ -234,7 +234,7 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
|
||||||
m_mouseDownCb(hit, false);
|
m_mouseDownCb(hit, false);
|
||||||
if (hit)
|
if (hit)
|
||||||
return true;
|
return true;
|
||||||
} else if (m_inMouseDown && !kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
} else if (m_inMouseDown && !kbm->m_mouseButtons[size_t(EMouseButton::Primary)]) {
|
||||||
m_inMouseDown = false;
|
m_inMouseDown = false;
|
||||||
m_inCancel = false;
|
m_inCancel = false;
|
||||||
if (m_mouseDownWidget == m_lastMouseOverWidget) {
|
if (m_mouseDownWidget == m_lastMouseOverWidget) {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#include "Runtime/GuiSys/CGuiWidgetIdDB.hpp"
|
#include "Runtime/GuiSys/CGuiWidgetIdDB.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
||||||
|
|
||||||
#include <boo/IWindow.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CBooModel;
|
class CBooModel;
|
||||||
class CGuiCamera;
|
class CGuiCamera;
|
||||||
|
@ -54,7 +52,7 @@ private:
|
||||||
std::function<void(CGuiWidget*, CGuiWidget*)> m_mouseOverChangeCb;
|
std::function<void(CGuiWidget*, CGuiWidget*)> m_mouseOverChangeCb;
|
||||||
std::function<void(CGuiWidget*, bool)> m_mouseDownCb;
|
std::function<void(CGuiWidget*, bool)> m_mouseDownCb;
|
||||||
std::function<void(CGuiWidget*, bool)> m_mouseUpCb;
|
std::function<void(CGuiWidget*, bool)> m_mouseUpCb;
|
||||||
std::function<void(CGuiWidget*, const boo::SScrollDelta&, int, int)> m_mouseScrollCb;
|
std::function<void(CGuiWidget*, const SScrollDelta&, int, int)> m_mouseScrollCb;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
|
CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
|
||||||
|
@ -87,7 +85,7 @@ public:
|
||||||
}
|
}
|
||||||
void SetMouseDownCallback(std::function<void(CGuiWidget*, bool)>&& cb) { m_mouseDownCb = std::move(cb); }
|
void SetMouseDownCallback(std::function<void(CGuiWidget*, bool)>&& cb) { m_mouseDownCb = std::move(cb); }
|
||||||
void SetMouseUpCallback(std::function<void(CGuiWidget*, bool)>&& cb) { m_mouseUpCb = std::move(cb); }
|
void SetMouseUpCallback(std::function<void(CGuiWidget*, bool)>&& cb) { m_mouseUpCb = std::move(cb); }
|
||||||
void SetMouseScrollCallback(std::function<void(CGuiWidget*, const boo::SScrollDelta&, int, int)>&& cb) {
|
void SetMouseScrollCallback(std::function<void(CGuiWidget*, const SScrollDelta&, int, int)>&& cb) {
|
||||||
m_mouseScrollCb = std::move(cb);
|
m_mouseScrollCb = std::move(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,9 @@ bool CGuiSliderGroup::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVect
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiSliderGroup::ProcessUserInput(const CFinalInput& input) {
|
void CGuiSliderGroup::ProcessUserInput(const CFinalInput& input) {
|
||||||
if (input.DMouseButton(boo::EMouseButton::Primary) && m_mouseInside)
|
if (input.DMouseButton(EMouseButton::Primary) && m_mouseInside)
|
||||||
m_mouseDown = true;
|
m_mouseDown = true;
|
||||||
else if (!input.DMouseButton(boo::EMouseButton::Primary))
|
else if (!input.DMouseButton(EMouseButton::Primary))
|
||||||
m_mouseDown = false;
|
m_mouseDown = false;
|
||||||
if (input.DLALeft()) {
|
if (input.DLALeft()) {
|
||||||
StartDecreasing();
|
StartDecreasing();
|
||||||
|
|
|
@ -32,9 +32,9 @@ CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int elementCount, i
|
||||||
, xd0_selectWraparound(selectWraparound) {}
|
, xd0_selectWraparound(selectWraparound) {}
|
||||||
|
|
||||||
void CGuiTableGroup::ProcessUserInput(const CFinalInput& input) {
|
void CGuiTableGroup::ProcessUserInput(const CFinalInput& input) {
|
||||||
if (input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter)) {
|
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter)) {
|
||||||
DoAdvance();
|
DoAdvance();
|
||||||
} else if (input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) {
|
} else if (input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||||
DoCancel();
|
DoCancel();
|
||||||
} else {
|
} else {
|
||||||
bool decrement;
|
bool decrement;
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
#include "Runtime/GCNTypes.hpp"
|
#include "Runtime/GCNTypes.hpp"
|
||||||
#include "Runtime/Streams/IOStreams.hpp"
|
#include "Runtime/Streams/IOStreams.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiObject.hpp"
|
#include "Runtime/GuiSys/CGuiObject.hpp"
|
||||||
|
#include "Runtime/Input/CKeyboardMouseController.hpp"
|
||||||
#include <boo/IWindow.hpp>
|
|
||||||
|
|
||||||
#include <zeus/CColor.hpp>
|
#include <zeus/CColor.hpp>
|
||||||
#include <zeus/CTransform.hpp>
|
#include <zeus/CTransform.hpp>
|
||||||
|
@ -84,8 +83,8 @@ protected:
|
||||||
bool xb7_25_ : 1 = true;
|
bool xb7_25_ : 1 = true;
|
||||||
bool m_mouseActive : 1 = false;
|
bool m_mouseActive : 1 = false;
|
||||||
|
|
||||||
std::optional<boo::SScrollDelta> m_lastScroll;
|
std::optional<SScrollDelta> m_lastScroll;
|
||||||
boo::SScrollDelta m_integerScroll;
|
SScrollDelta m_integerScroll;
|
||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void CScanDisplay::ProcessInput(const CFinalInput& input) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (xc_state == EScanState::DownloadComplete && x1a4_xAlpha == 0.f) {
|
if (xc_state == EScanState::DownloadComplete && x1a4_xAlpha == 0.f) {
|
||||||
if (input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary)) {
|
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||||
if (xa8_message->TextSupport().GetCurTime() < xa8_message->TextSupport().GetTotalAnimationTime()) {
|
if (xa8_message->TextSupport().GetCurTime() < xa8_message->TextSupport().GetTotalAnimationTime()) {
|
||||||
xa8_message->TextSupport().SetCurTime(xa8_message->TextSupport().GetTotalAnimationTime());
|
xa8_message->TextSupport().SetCurTime(xa8_message->TextSupport().GetTotalAnimationTime());
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +94,7 @@ void CScanDisplay::ProcessInput(const CFinalInput& input) {
|
||||||
} else if (xc_state == EScanState::ViewingScan) {
|
} else if (xc_state == EScanState::ViewingScan) {
|
||||||
int oldCounter = x1ac_pageCounter;
|
int oldCounter = x1ac_pageCounter;
|
||||||
int totalPages = xac_scrollMessage->TextSupport().GetTotalPageCount();
|
int totalPages = xac_scrollMessage->TextSupport().GetTotalPageCount();
|
||||||
if ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary)) &&
|
if ((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) &&
|
||||||
totalPages != -1) {
|
totalPages != -1) {
|
||||||
CGuiTextSupport& supp = !x1ac_pageCounter ? xa8_message->TextSupport() : xac_scrollMessage->TextSupport();
|
CGuiTextSupport& supp = !x1ac_pageCounter ? xa8_message->TextSupport() : xac_scrollMessage->TextSupport();
|
||||||
if (supp.GetCurTime() < supp.GetTotalAnimationTime())
|
if (supp.GetCurTime() < supp.GetTotalAnimationTime())
|
||||||
|
|
|
@ -9,11 +9,6 @@
|
||||||
#include "Runtime/GuiSys/CFontImageDef.hpp"
|
#include "Runtime/GuiSys/CFontImageDef.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
||||||
|
|
||||||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
|
||||||
//
|
|
||||||
//#include <hecl/UniformBufferPool.hpp>
|
|
||||||
//#include <hecl/VertexBufferPool.hpp>
|
|
||||||
|
|
||||||
#include <zeus/CColor.hpp>
|
#include <zeus/CColor.hpp>
|
||||||
#include <zeus/CMatrix4f.hpp>
|
#include <zeus/CMatrix4f.hpp>
|
||||||
#include <zeus/CVector2f.hpp>
|
#include <zeus/CVector2f.hpp>
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <amuse/amuse.hpp>
|
#include <amuse/amuse.hpp>
|
||||||
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||||
#include <boo/boo.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class Console;
|
class Console;
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct CFinalInput {
|
||||||
std::optional<CKeyboardMouseControllerData> m_kbm;
|
std::optional<CKeyboardMouseControllerData> m_kbm;
|
||||||
|
|
||||||
std::array<bool, 256> m_PCharKeys{};
|
std::array<bool, 256> m_PCharKeys{};
|
||||||
std::array<bool, 26> m_PSpecialKeys{};
|
std::array<bool, size_t(aurora::SpecialKey::MAX)> m_PSpecialKeys{};
|
||||||
std::array<bool, 6> m_PMouseButtons{};
|
std::array<bool, 6> m_PMouseButtons{};
|
||||||
|
|
||||||
float m_leftMul = 1.f;
|
float m_leftMul = 1.f;
|
||||||
|
@ -173,14 +173,14 @@ struct CFinalInput {
|
||||||
CFinalInput ScaleAnalogueSticks(float leftDiv, float rightDiv) const;
|
CFinalInput ScaleAnalogueSticks(float leftDiv, float rightDiv) const;
|
||||||
|
|
||||||
bool PKey(char k) const { return m_kbm && m_PCharKeys[size_t(k)]; }
|
bool PKey(char k) const { return m_kbm && m_PCharKeys[size_t(k)]; }
|
||||||
bool PSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_PSpecialKeys[size_t(k)]; }
|
bool PSpecialKey(aurora::SpecialKey k) const { return m_kbm && m_PSpecialKeys[size_t(k)]; }
|
||||||
bool PMouseButton(boo::EMouseButton k) const { return m_kbm && m_PMouseButtons[size_t(k)]; }
|
bool PMouseButton(EMouseButton k) const { return m_kbm && m_PMouseButtons[size_t(k)]; }
|
||||||
bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[size_t(k)]; }
|
bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[size_t(k)]; }
|
||||||
bool DSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[size_t(k)]; }
|
bool DSpecialKey(aurora::SpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[size_t(k)]; }
|
||||||
bool DMouseButton(boo::EMouseButton k) const { return m_kbm && m_kbm->m_mouseButtons[size_t(k)]; }
|
bool DMouseButton(EMouseButton k) const { return m_kbm && m_kbm->m_mouseButtons[size_t(k)]; }
|
||||||
float AKey(char k) const { return DKey(k) ? 1.f : 0.f; }
|
float AKey(char k) const { return DKey(k) ? 1.f : 0.f; }
|
||||||
float ASpecialKey(boo::ESpecialKey k) const { return DSpecialKey(k) ? 1.f : 0.f; }
|
float ASpecialKey(aurora::SpecialKey k) const { return DSpecialKey(k) ? 1.f : 0.f; }
|
||||||
float AMouseButton(boo::EMouseButton k) const { return DMouseButton(k) ? 1.f : 0.f; }
|
float AMouseButton(EMouseButton k) const { return DMouseButton(k) ? 1.f : 0.f; }
|
||||||
|
|
||||||
const std::optional<CKeyboardMouseControllerData>& GetKBM() const { return m_kbm; }
|
const std::optional<CKeyboardMouseControllerData>& GetKBM() const { return m_kbm; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
#include "Runtime/CArchitectureMessage.hpp"
|
#include "Runtime/CArchitectureMessage.hpp"
|
||||||
#include "Runtime/CArchitectureQueue.hpp"
|
#include "Runtime/CArchitectureQueue.hpp"
|
||||||
#include "imgui/magic_enum.hpp"
|
|
||||||
|
#include <magic_enum.hpp>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
void CInputGenerator::Update(float dt, CArchitectureQueue& queue) {
|
void CInputGenerator::Update(float dt, CArchitectureQueue& queue) {
|
||||||
|
@ -49,8 +51,7 @@ void CInputGenerator::controllerAdded(uint32_t which) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputGenerator::controllerRemoved(uint32_t which) noexcept {
|
void CInputGenerator::controllerRemoved(uint32_t which) noexcept {
|
||||||
auto* it =
|
auto it = std::find_if(m_state.begin(), m_state.end(), [&which](const auto& s) { return s.m_which == which; });
|
||||||
std::find_if(m_state.begin(), m_state.end(), [&which](const auto& s) { return s.m_which == which; });
|
|
||||||
if (it == m_state.end()) {
|
if (it == m_state.end()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#include "Runtime/Input/CFinalInput.hpp"
|
#include "Runtime/Input/CFinalInput.hpp"
|
||||||
#include "Runtime/Input/CKeyboardMouseController.hpp"
|
#include "Runtime/Input/CKeyboardMouseController.hpp"
|
||||||
|
|
||||||
#include <boo/boo.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CArchitectureQueue;
|
class CArchitectureQueue;
|
||||||
|
|
||||||
|
@ -58,14 +56,14 @@ public:
|
||||||
* at the start of each frame, invoking these methods. No atomic locking
|
* at the start of each frame, invoking these methods. No atomic locking
|
||||||
* is necessary, only absolute state tracking. */
|
* is necessary, only absolute state tracking. */
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey) {
|
void mouseDown(const SWindowCoord&, EMouseButton button, EModifierKey) {
|
||||||
m_data.m_mouseButtons[size_t(button)] = true;
|
m_data.m_mouseButtons[size_t(button)] = true;
|
||||||
}
|
}
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey) {
|
void mouseUp(const SWindowCoord&, EMouseButton button, EModifierKey) {
|
||||||
m_data.m_mouseButtons[size_t(button)] = false;
|
m_data.m_mouseButtons[size_t(button)] = false;
|
||||||
}
|
}
|
||||||
void mouseMove(const boo::SWindowCoord& coord) { m_data.m_mouseCoord = coord; }
|
void mouseMove(const SWindowCoord& coord) { m_data.m_mouseCoord = coord; }
|
||||||
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta& scroll) { m_data.m_accumScroll += scroll; }
|
void scroll(const SWindowCoord&, const SScrollDelta& scroll) { m_data.m_accumScroll += scroll; }
|
||||||
|
|
||||||
void charKeyDown(uint8_t charCode, aurora::ModifierKey, bool) {
|
void charKeyDown(uint8_t charCode, aurora::ModifierKey, bool) {
|
||||||
charCode = tolower(charCode);
|
charCode = tolower(charCode);
|
||||||
|
|
|
@ -3,17 +3,64 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include <aurora/aurora.hpp>
|
#include <aurora/aurora.hpp>
|
||||||
#include <boo/IWindow.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
|
// TODO: copied from boo; should be rewritten and included from from aurora
|
||||||
|
enum class EMouseButton { None = 0, Primary = 1, Secondary = 2, Middle = 3, Aux1 = 4, Aux2 = 5 };
|
||||||
|
enum class EModifierKey {
|
||||||
|
None = 0,
|
||||||
|
Ctrl = 1 << 0,
|
||||||
|
Alt = 1 << 2,
|
||||||
|
Shift = 1 << 3,
|
||||||
|
Command = 1 << 4,
|
||||||
|
CtrlCommand = EModifierKey::Ctrl | EModifierKey::Command
|
||||||
|
};
|
||||||
|
ENABLE_BITWISE_ENUM(EModifierKey)
|
||||||
|
struct SWindowCoord {
|
||||||
|
std::array<int, 2> pixel;
|
||||||
|
std::array<int, 2> virtualPixel;
|
||||||
|
std::array<float, 2> norm;
|
||||||
|
};
|
||||||
|
struct SScrollDelta {
|
||||||
|
std::array<double, 2> delta{};
|
||||||
|
bool isFine = false; /* Use system-scale fine-scroll (for scrollable-trackpads) */
|
||||||
|
bool isAccelerated = false; /* System performs acceleration computation */
|
||||||
|
|
||||||
|
constexpr SScrollDelta operator+(const SScrollDelta& other) const noexcept {
|
||||||
|
SScrollDelta ret;
|
||||||
|
ret.delta[0] = delta[0] + other.delta[0];
|
||||||
|
ret.delta[1] = delta[1] + other.delta[1];
|
||||||
|
ret.isFine = isFine || other.isFine;
|
||||||
|
ret.isAccelerated = isAccelerated || other.isAccelerated;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
constexpr SScrollDelta operator-(const SScrollDelta& other) const noexcept {
|
||||||
|
SScrollDelta ret;
|
||||||
|
ret.delta[0] = delta[0] - other.delta[0];
|
||||||
|
ret.delta[1] = delta[1] - other.delta[1];
|
||||||
|
ret.isFine = isFine || other.isFine;
|
||||||
|
ret.isAccelerated = isAccelerated || other.isAccelerated;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
constexpr SScrollDelta& operator+=(const SScrollDelta& other) noexcept {
|
||||||
|
delta[0] += other.delta[0];
|
||||||
|
delta[1] += other.delta[1];
|
||||||
|
isFine |= other.isFine;
|
||||||
|
isAccelerated |= other.isAccelerated;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
constexpr void zeroOut() noexcept { delta = {}; }
|
||||||
|
constexpr bool isZero() const noexcept { return delta[0] == 0.0 && delta[1] == 0.0; }
|
||||||
|
};
|
||||||
|
|
||||||
struct CKeyboardMouseControllerData {
|
struct CKeyboardMouseControllerData {
|
||||||
std::array<bool, 256> m_charKeys{};
|
std::array<bool, 256> m_charKeys{};
|
||||||
std::array<bool, static_cast<size_t>(aurora::SpecialKey::MAX)> m_specialKeys{};
|
std::array<bool, static_cast<size_t>(aurora::SpecialKey::MAX)> m_specialKeys{};
|
||||||
std::array<bool, 6> m_mouseButtons{};
|
std::array<bool, 6> m_mouseButtons{};
|
||||||
aurora::ModifierKey m_modMask = aurora::ModifierKey::None;
|
aurora::ModifierKey m_modMask = aurora::ModifierKey::None;
|
||||||
boo::SWindowCoord m_mouseCoord;
|
SWindowCoord m_mouseCoord;
|
||||||
boo::SScrollDelta m_accumScroll;
|
SScrollDelta m_accumScroll;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
|
@ -156,8 +156,8 @@ constexpr std::array<ControlMapper::EKBMFunctionList, 70> skKBMMapping{
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 's', // LookUp,
|
ControlMapper::EKBMFunctionList::KeyPress + 's', // LookUp,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'w', // LookDown,
|
ControlMapper::EKBMFunctionList::KeyPress + 'w', // LookDown,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + ' ', // JumpOrBoost = 10,
|
ControlMapper::EKBMFunctionList::KeyPress + ' ', // JumpOrBoost = 10,
|
||||||
ControlMapper::EKBMFunctionList::MousePress + boo::EMouseButton::Primary, // FireOrBomb = 11,
|
ControlMapper::EKBMFunctionList::MousePress + EMouseButton::Primary, // FireOrBomb = 11,
|
||||||
ControlMapper::EKBMFunctionList::MousePress + boo::EMouseButton::Secondary, // MissileOrPowerBomb = 12,
|
ControlMapper::EKBMFunctionList::MousePress + EMouseButton::Secondary, // MissileOrPowerBomb = 12,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'c', // Morph,
|
ControlMapper::EKBMFunctionList::KeyPress + 'c', // Morph,
|
||||||
ControlMapper::EKBMFunctionList::None, // AimUp,
|
ControlMapper::EKBMFunctionList::None, // AimUp,
|
||||||
ControlMapper::EKBMFunctionList::None, // AimDown,
|
ControlMapper::EKBMFunctionList::None, // AimDown,
|
||||||
|
@ -187,18 +187,18 @@ constexpr std::array<ControlMapper::EKBMFunctionList, 70> skKBMMapping{
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'w', // MapCircleDown,
|
ControlMapper::EKBMFunctionList::KeyPress + 'w', // MapCircleDown,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'a', // MapCircleLeft,
|
ControlMapper::EKBMFunctionList::KeyPress + 'a', // MapCircleLeft,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'd', // MapCircleRight,
|
ControlMapper::EKBMFunctionList::KeyPress + 'd', // MapCircleRight,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Up, // MapMoveForward,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Up, // MapMoveForward,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Down, // MapMoveBack,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Down, // MapMoveBack,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Left, // MapMoveLeft,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Left, // MapMoveLeft,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Right, // MapMoveRight,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Right, // MapMoveRight,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'e', // MapZoomIn,
|
ControlMapper::EKBMFunctionList::KeyPress + 'e', // MapZoomIn,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'q', // MapZoomOut,
|
ControlMapper::EKBMFunctionList::KeyPress + 'q', // MapZoomOut,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'e', // SpiderBall,
|
ControlMapper::EKBMFunctionList::KeyPress + 'e', // SpiderBall,
|
||||||
ControlMapper::EKBMFunctionList::KeyPress + 'q', // ChaseCamera,
|
ControlMapper::EKBMFunctionList::KeyPress + 'q', // ChaseCamera,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Right, // XrayVisor = 50,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Right, // XrayVisor = 50,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Down, // ThermoVisor = 51,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Down, // ThermoVisor = 51,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Left, // InviroVisor = 52,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Left, // InviroVisor = 52,
|
||||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + boo::ESpecialKey::Up, // NoVisor = 53,
|
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Up, // NoVisor = 53,
|
||||||
ControlMapper::EKBMFunctionList::None, // VisorMenu,
|
ControlMapper::EKBMFunctionList::None, // VisorMenu,
|
||||||
ControlMapper::EKBMFunctionList::None, // VisorUp,
|
ControlMapper::EKBMFunctionList::None, // VisorUp,
|
||||||
ControlMapper::EKBMFunctionList::None, // VisorDown,
|
ControlMapper::EKBMFunctionList::None, // VisorDown,
|
||||||
|
@ -307,10 +307,10 @@ static float KBToWASDY(const CKeyboardMouseControllerData& data) {
|
||||||
|
|
||||||
static float KBToArrowsX(const CKeyboardMouseControllerData& data) {
|
static float KBToArrowsX(const CKeyboardMouseControllerData& data) {
|
||||||
float retval = 0.0;
|
float retval = 0.0;
|
||||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Left)]) {
|
if (data.m_specialKeys[size_t(aurora::SpecialKey::Left)]) {
|
||||||
retval -= 1.0;
|
retval -= 1.0;
|
||||||
}
|
}
|
||||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Right)]) {
|
if (data.m_specialKeys[size_t(aurora::SpecialKey::Right)]) {
|
||||||
retval += 1.0;
|
retval += 1.0;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -318,10 +318,10 @@ static float KBToArrowsX(const CKeyboardMouseControllerData& data) {
|
||||||
|
|
||||||
static float KBToArrowsY(const CKeyboardMouseControllerData& data) {
|
static float KBToArrowsY(const CKeyboardMouseControllerData& data) {
|
||||||
float retval = 0.0;
|
float retval = 0.0;
|
||||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Down)]) {
|
if (data.m_specialKeys[size_t(aurora::SpecialKey::Down)]) {
|
||||||
retval -= 1.0;
|
retval -= 1.0;
|
||||||
}
|
}
|
||||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Up)]) {
|
if (data.m_specialKeys[size_t(aurora::SpecialKey::Up)]) {
|
||||||
retval += 1.0;
|
retval += 1.0;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include <boo/IWindow.hpp>
|
#include "Input/CKeyboardMouseController.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
struct CFinalInput;
|
struct CFinalInput;
|
||||||
|
@ -126,12 +126,12 @@ constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionL
|
||||||
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, boo::ESpecialKey b) {
|
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, aurora::SpecialKey b) {
|
||||||
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
|
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
|
||||||
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, boo::EMouseButton b) {
|
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, EMouseButton b) {
|
||||||
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
|
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
|
||||||
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
||||||
}
|
}
|
||||||
|
|
|
@ -843,11 +843,11 @@ CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::ProcessUserInput(const CFinalInpu
|
||||||
case EUIType::LinkFailed:
|
case EUIType::LinkFailed:
|
||||||
case EUIType::LinkCompleteOrLinking:
|
case EUIType::LinkCompleteOrLinking:
|
||||||
case EUIType::TurnOffGBA:
|
case EUIType::TurnOffGBA:
|
||||||
if (input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary) ||
|
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary) ||
|
||||||
tbAction == CFrontEndUITouchBar::EAction::Confirm) {
|
tbAction == CFrontEndUITouchBar::EAction::Confirm) {
|
||||||
PlayAdvanceSfx();
|
PlayAdvanceSfx();
|
||||||
SetUIText(NextLinkUI[size_t(x0_uiType)]);
|
SetUIText(NextLinkUI[size_t(x0_uiType)]);
|
||||||
} else if (input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
} else if (input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||||
tbAction == CFrontEndUITouchBar::EAction::Back) {
|
tbAction == CFrontEndUITouchBar::EAction::Back) {
|
||||||
const EUIType prevUi = PrevLinkUI[size_t(x0_uiType)];
|
const EUIType prevUi = PrevLinkUI[size_t(x0_uiType)];
|
||||||
if (prevUi == EUIType::Empty) {
|
if (prevUi == EUIType::Empty) {
|
||||||
|
@ -1375,7 +1375,7 @@ void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input,
|
||||||
switch (x0_mode) {
|
switch (x0_mode) {
|
||||||
case EMode::Emulator:
|
case EMode::Emulator:
|
||||||
x4_nesEmu->ProcessUserInput(input, 4);
|
x4_nesEmu->ProcessUserInput(input, 4);
|
||||||
if ((input.ControllerIdx() == 0 && input.PL()) || input.PSpecialKey(boo::ESpecialKey::Esc))
|
if ((input.ControllerIdx() == 0 && input.PL()) || input.PSpecialKey(aurora::SpecialKey::Esc))
|
||||||
SetMode(EMode::QuitNESMetroid);
|
SetMode(EMode::QuitNESMetroid);
|
||||||
break;
|
break;
|
||||||
case EMode::SaveProgress:
|
case EMode::SaveProgress:
|
||||||
|
@ -1717,7 +1717,7 @@ bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& inp
|
||||||
if (sui)
|
if (sui)
|
||||||
sui->ProcessUserInput(input);
|
sui->ProcessUserInput(input);
|
||||||
if (x1c_loadedFrame && x134_24_visible) {
|
if (x1c_loadedFrame && x134_24_visible) {
|
||||||
if ((input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) && x24_tablegroup_leftmenu->GetIsActive()) {
|
if ((input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) && x24_tablegroup_leftmenu->GetIsActive()) {
|
||||||
x134_25_exitOptions = true;
|
x134_25_exitOptions = true;
|
||||||
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2186,8 +2186,8 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
|
||||||
|
|
||||||
if (x50_curScreen != x54_nextScreen) {
|
if (x50_curScreen != x54_nextScreen) {
|
||||||
if (x54_nextScreen == EScreen::AttractMovie &&
|
if (x54_nextScreen == EScreen::AttractMovie &&
|
||||||
(input.PStart() || input.PA() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
(input.PStart() || input.PA() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||||
input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary) ||
|
input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary) ||
|
||||||
touchBarAction == CFrontEndUITouchBar::EAction::Start)) {
|
touchBarAction == CFrontEndUITouchBar::EAction::Start)) {
|
||||||
/* Player wants to return to opening credits from attract movie */
|
/* Player wants to return to opening credits from attract movie */
|
||||||
SetFadeBlackTimer(std::min(1.f, x58_fadeBlackTimer));
|
SetFadeBlackTimer(std::min(1.f, x58_fadeBlackTimer));
|
||||||
|
@ -2195,8 +2195,8 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.PA() || input.PStart() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
if (input.PA() || input.PStart() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||||
input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary) ||
|
input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary) ||
|
||||||
touchBarAction == CFrontEndUITouchBar::EAction::Start) {
|
touchBarAction == CFrontEndUITouchBar::EAction::Start) {
|
||||||
if (x50_curScreen == EScreen::OpenCredits && x54_nextScreen == EScreen::Title && x58_fadeBlackTimer > 1.f) {
|
if (x50_curScreen == EScreen::OpenCredits && x54_nextScreen == EScreen::Title && x58_fadeBlackTimer > 1.f) {
|
||||||
/* Player is too impatient to view opening credits */
|
/* Player is too impatient to view opening credits */
|
||||||
|
@ -2207,8 +2207,8 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (x50_curScreen == EScreen::Title) {
|
if (x50_curScreen == EScreen::Title) {
|
||||||
if (input.PStart() || input.PA() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
if (input.PStart() || input.PA() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||||
input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary) ||
|
input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary) ||
|
||||||
touchBarAction == CFrontEndUITouchBar::EAction::Start) {
|
touchBarAction == CFrontEndUITouchBar::EAction::Start) {
|
||||||
if (x58_fadeBlackTimer < 30.f - g_tweakGame->GetPressStartDelay()) {
|
if (x58_fadeBlackTimer < 30.f - g_tweakGame->GetPressStartDelay()) {
|
||||||
/* Proceed to file select UI */
|
/* Proceed to file select UI */
|
||||||
|
|
|
@ -132,7 +132,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
if (const auto& kbm = input.GetKBM()) {
|
if (const auto& kbm = input.GetKBM()) {
|
||||||
m_lastMouseCoord = zeus::CVector2f(kbm->m_mouseCoord.norm[0], kbm->m_mouseCoord.norm[1]);
|
m_lastMouseCoord = zeus::CVector2f(kbm->m_mouseCoord.norm[0], kbm->m_mouseCoord.norm[1]);
|
||||||
m_lastAccumScroll = kbm->m_accumScroll;
|
m_lastAccumScroll = kbm->m_accumScroll;
|
||||||
m_dollScroll = boo::SScrollDelta();
|
m_dollScroll = SScrollDelta();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
if (input.PStart()) {
|
if (input.PStart()) {
|
||||||
x19c_samusDoll->BeginViewInterpolate(false);
|
x19c_samusDoll->BeginViewInterpolate(false);
|
||||||
x198_26_exitPauseScreen = true;
|
x198_26_exitPauseScreen = true;
|
||||||
} else if (input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) {
|
} else if (input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||||
x19c_samusDoll->BeginViewInterpolate(false);
|
x19c_samusDoll->BeginViewInterpolate(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
m_lastMouseCoord = mouseCoord;
|
m_lastMouseCoord = mouseCoord;
|
||||||
mouseDelta.x() *= g_Viewport.aspect;
|
mouseDelta.x() *= g_Viewport.aspect;
|
||||||
mouseDelta *= 100.f;
|
mouseDelta *= 100.f;
|
||||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Middle)] ||
|
if (kbm->m_mouseButtons[size_t(EMouseButton::Middle)] ||
|
||||||
kbm->m_mouseButtons[size_t(boo::EMouseButton::Secondary)]) {
|
kbm->m_mouseButtons[size_t(EMouseButton::Secondary)]) {
|
||||||
if (float(mouseDelta.x()) < 0.f)
|
if (float(mouseDelta.x()) < 0.f)
|
||||||
moveRight += -mouseDelta.x();
|
moveRight += -mouseDelta.x();
|
||||||
else if (float(mouseDelta.x()) > 0.f)
|
else if (float(mouseDelta.x()) > 0.f)
|
||||||
|
@ -178,7 +178,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
else if (float(mouseDelta.y()) > 0.f)
|
else if (float(mouseDelta.y()) > 0.f)
|
||||||
moveBack += mouseDelta.y();
|
moveBack += mouseDelta.y();
|
||||||
}
|
}
|
||||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
if (kbm->m_mouseButtons[size_t(EMouseButton::Primary)]) {
|
||||||
if (float(mouseDelta.x()) < 0.f)
|
if (float(mouseDelta.x()) < 0.f)
|
||||||
circleRight += -mouseDelta.x();
|
circleRight += -mouseDelta.x();
|
||||||
else if (float(mouseDelta.x()) > 0.f)
|
else if (float(mouseDelta.x()) > 0.f)
|
||||||
|
@ -220,7 +220,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
if (input.PLAUp() || m_bodyUpClicked)
|
if (input.PLAUp() || m_bodyUpClicked)
|
||||||
newPage = std::max(oldPage - 1, 0);
|
newPage = std::max(oldPage - 1, 0);
|
||||||
else if (input.PLADown() || m_bodyDownClicked ||
|
else if (input.PLADown() || m_bodyDownClicked ||
|
||||||
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
||||||
newPage = std::min(oldPage + 1, totalCount - 1);
|
newPage = std::min(oldPage + 1, totalCount - 1);
|
||||||
x174_textpane_body->TextSupport().SetPage(newPage);
|
x174_textpane_body->TextSupport().SetPage(newPage);
|
||||||
if (oldPage != newPage)
|
if (oldPage != newPage)
|
||||||
|
@ -233,8 +233,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
}
|
}
|
||||||
if (!x1ac_textLeaveRequested)
|
if (!x1ac_textLeaveRequested)
|
||||||
x1ac_textLeaveRequested =
|
x1ac_textLeaveRequested =
|
||||||
input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||||
((input.PA() || m_bodyClicked || input.PSpecialKey(boo::ESpecialKey::Enter)) && lastPage);
|
((input.PA() || m_bodyClicked || input.PSpecialKey(aurora::SpecialKey::Enter)) && lastPage);
|
||||||
x1ad_textViewing = !x1ac_textLeaveRequested;
|
x1ad_textViewing = !x1ac_textLeaveRequested;
|
||||||
} else {
|
} else {
|
||||||
x198_29_pulseTextArrowBottom = false;
|
x198_29_pulseTextArrowBottom = false;
|
||||||
|
|
|
@ -24,8 +24,8 @@ class CInventoryScreen : public CPauseScreenBase {
|
||||||
bool x1ad_textViewing;
|
bool x1ad_textViewing;
|
||||||
|
|
||||||
zeus::CVector2f m_lastMouseCoord;
|
zeus::CVector2f m_lastMouseCoord;
|
||||||
boo::SScrollDelta m_lastAccumScroll;
|
SScrollDelta m_lastAccumScroll;
|
||||||
boo::SScrollDelta m_dollScroll;
|
SScrollDelta m_dollScroll;
|
||||||
|
|
||||||
void UpdateSamusDollPulses();
|
void UpdateSamusDollPulses();
|
||||||
bool HasLeftInventoryItem(int idx) const;
|
bool HasLeftInventoryItem(int idx) const;
|
||||||
|
|
|
@ -338,7 +338,7 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
if (input.PLAUp() || m_bodyUpClicked)
|
if (input.PLAUp() || m_bodyUpClicked)
|
||||||
newPage = std::max(oldPage - 1, 0);
|
newPage = std::max(oldPage - 1, 0);
|
||||||
else if (input.PLADown() || m_bodyDownClicked ||
|
else if (input.PLADown() || m_bodyDownClicked ||
|
||||||
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
||||||
newPage = std::min(oldPage + 1, pageCount - 1);
|
newPage = std::min(oldPage + 1, pageCount - 1);
|
||||||
x174_textpane_body->TextSupport().SetPage(newPage);
|
x174_textpane_body->TextSupport().SetPage(newPage);
|
||||||
if (oldPage != newPage)
|
if (oldPage != newPage)
|
||||||
|
@ -352,8 +352,8 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
|
|
||||||
if (!x260_26_exitTextScroll)
|
if (!x260_26_exitTextScroll)
|
||||||
x260_26_exitTextScroll =
|
x260_26_exitTextScroll =
|
||||||
input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||||
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && lastPage);
|
((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || m_bodyClicked) && lastPage);
|
||||||
|
|
||||||
if (g_tweakGui->GetLatchArticleText())
|
if (g_tweakGui->GetLatchArticleText())
|
||||||
x260_25_inTextScroll = !x260_26_exitTextScroll;
|
x260_25_inTextScroll = !x260_26_exitTextScroll;
|
||||||
|
|
|
@ -125,7 +125,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch
|
||||||
if (input.ControllerIdx() == 0) {
|
if (input.ControllerIdx() == 0) {
|
||||||
const CEntity* cam = x14_stateManager->GetCameraManager()->GetCurrentCamera(*x14_stateManager);
|
const CEntity* cam = x14_stateManager->GetCameraManager()->GetCurrentCamera(*x14_stateManager);
|
||||||
TCastToConstPtr<CCinematicCamera> cineCam = cam;
|
TCastToConstPtr<CCinematicCamera> cineCam = cam;
|
||||||
if (input.PStart() || input.PSpecialKey(boo::ESpecialKey::Esc)) {
|
if (input.PStart() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||||
if (cineCam && x14_stateManager->GetSkipCinematicSpecialFunction() != kInvalidUniqueId) {
|
if (cineCam && x14_stateManager->GetSkipCinematicSpecialFunction() != kInvalidUniqueId) {
|
||||||
CMidiManager::StopAll();
|
CMidiManager::StopAll();
|
||||||
x28_skippedCineCam = cineCam->GetUniqueId();
|
x28_skippedCineCam = cineCam->GetUniqueId();
|
||||||
|
|
|
@ -18,7 +18,7 @@ CMessageScreen::CMessageScreen(CAssetId msg, float delayTime) : x74_delayTime(de
|
||||||
|
|
||||||
void CMessageScreen::ProcessControllerInput(const CFinalInput& input) {
|
void CMessageScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
if (!x18_loadedMsgScreen || x74_delayTime > 0.f ||
|
if (!x18_loadedMsgScreen || x74_delayTime > 0.f ||
|
||||||
!(input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary)))
|
!(input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (x1c_textpane_message->TextSupport().GetCurTime() < x1c_textpane_message->TextSupport().GetTotalAnimationTime()) {
|
if (x1c_textpane_message->TextSupport().GetCurTime() < x1c_textpane_message->TextSupport().GetTotalAnimationTime()) {
|
||||||
|
|
|
@ -153,7 +153,7 @@ void COptionsScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||||
CGameOptions::TryRestoreDefaults(input, x70_tablegroup_leftlog->GetUserSelection(), x1c_rightSel, false,
|
CGameOptions::TryRestoreDefaults(input, x70_tablegroup_leftlog->GetUserSelection(), x1c_rightSel, false,
|
||||||
rightClicked);
|
rightClicked);
|
||||||
if (x70_tablegroup_leftlog->GetUserSelection() == 4 &&
|
if (x70_tablegroup_leftlog->GetUserSelection() == 4 &&
|
||||||
(input.PA() || leftClicked || input.PSpecialKey(boo::ESpecialKey::Enter)))
|
(input.PA() || leftClicked || input.PSpecialKey(aurora::SpecialKey::Enter)))
|
||||||
x19c_quitGame = std::make_unique<CQuitGameScreen>(EQuitType::QuitGame);
|
x19c_quitGame = std::make_unique<CQuitGameScreen>(EQuitType::QuitGame);
|
||||||
} else {
|
} else {
|
||||||
CPauseScreenBase::ResetMouseState();
|
CPauseScreenBase::ResetMouseState();
|
||||||
|
|
|
@ -202,7 +202,7 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
|
||||||
|
|
||||||
if (InputEnabled()) {
|
if (InputEnabled()) {
|
||||||
bool invalid = x8_curSubscreen == ESubScreen::ToGame;
|
bool invalid = x8_curSubscreen == ESubScreen::ToGame;
|
||||||
if (useInput.PStart() || ((useInput.PB() || useInput.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) ||
|
if (useInput.PStart() || ((useInput.PB() || useInput.PSpecialKey(aurora::SpecialKey::Esc)) && bExits) ||
|
||||||
(x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) {
|
(x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) {
|
||||||
CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||||
StartTransition(0.5f, mgr, ESubScreen::ToGame, 2);
|
StartTransition(0.5f, mgr, ESubScreen::ToGame, 2);
|
||||||
|
|
|
@ -169,7 +169,7 @@ void CPauseScreenBase::InitializeFrameGlue() {
|
||||||
x194_tablegroup_triple->SetMenuSelectionChangeCallback({});
|
x194_tablegroup_triple->SetMenuSelectionChangeCallback({});
|
||||||
|
|
||||||
x8_frame.SetMouseUpCallback([this](CGuiWidget* widget, bool cancel) { OnWidgetMouseUp(widget, cancel); });
|
x8_frame.SetMouseUpCallback([this](CGuiWidget* widget, bool cancel) { OnWidgetMouseUp(widget, cancel); });
|
||||||
x8_frame.SetMouseScrollCallback([this](CGuiWidget* widget, const boo::SScrollDelta& delta, int accumX, int accumY) {
|
x8_frame.SetMouseScrollCallback([this](CGuiWidget* widget, const SScrollDelta& delta, int accumX, int accumY) {
|
||||||
OnWidgetScroll(widget, delta, accumX, accumY);
|
OnWidgetScroll(widget, delta, accumX, accumY);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPauseScreenBase::OnWidgetScroll(CGuiWidget* widget, const boo::SScrollDelta& delta, int accumX, int accumY) {
|
void CPauseScreenBase::OnWidgetScroll(CGuiWidget* widget, const SScrollDelta& delta, int accumX, int accumY) {
|
||||||
if (!widget || accumY == 0)
|
if (!widget || accumY == 0)
|
||||||
return;
|
return;
|
||||||
if (widget->GetParent() == x84_tablegroup_rightlog) {
|
if (widget->GetParent() == x84_tablegroup_rightlog) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ protected:
|
||||||
void OnRightTableCancel(CGuiTableGroup* caller);
|
void OnRightTableCancel(CGuiTableGroup* caller);
|
||||||
|
|
||||||
void OnWidgetMouseUp(CGuiWidget* widget, bool cancel);
|
void OnWidgetMouseUp(CGuiWidget* widget, bool cancel);
|
||||||
void OnWidgetScroll(CGuiWidget* widget, const boo::SScrollDelta& delta, int accumX, int accumY);
|
void OnWidgetScroll(CGuiWidget* widget, const SScrollDelta& delta, int accumX, int accumY);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::string GetImagePaneName(size_t i);
|
static std::string GetImagePaneName(size_t i);
|
||||||
|
|
|
@ -106,7 +106,7 @@ void CQuitGameScreen::ProcessUserInput(const CFinalInput& input) {
|
||||||
x10_loadedFrame->ProcessMouseInput(
|
x10_loadedFrame->ProcessMouseInput(
|
||||||
input, CGuiWidgetDrawParms{1.f, zeus::CVector3f{0.f, 0.f, VerticalOffsets[size_t(x0_type)]}});
|
input, CGuiWidgetDrawParms{1.f, zeus::CVector3f{0.f, 0.f, VerticalOffsets[size_t(x0_type)]}});
|
||||||
x10_loadedFrame->ProcessUserInput(input);
|
x10_loadedFrame->ProcessUserInput(input);
|
||||||
if ((input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) && x0_type != EQuitType::ContinueFromLastSave) {
|
if ((input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) && x0_type != EQuitType::ContinueFromLastSave) {
|
||||||
x18_action = EQuitAction::No;
|
x18_action = EQuitAction::No;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,29 @@
|
||||||
#include <discord_rpc.h>
|
#include <discord_rpc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
inline void* memmem(const void* haystack, size_t hlen, const void* needle, size_t nlen) {
|
||||||
|
int needle_first;
|
||||||
|
const uint8_t* p = static_cast<const uint8_t*>(haystack);
|
||||||
|
size_t plen = hlen;
|
||||||
|
|
||||||
|
if (!nlen)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
needle_first = *(unsigned char*)needle;
|
||||||
|
|
||||||
|
while (plen >= nlen && (p = static_cast<const uint8_t*>(memchr(p, needle_first, plen - nlen + 1)))) {
|
||||||
|
if (!memcmp(p, needle, nlen))
|
||||||
|
return (void*)p;
|
||||||
|
|
||||||
|
p++;
|
||||||
|
plen = hlen - (p - static_cast<const uint8_t*>(haystack));
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
namespace {
|
namespace {
|
||||||
struct AudioGroupInfo {
|
struct AudioGroupInfo {
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef MP1_USE_BOO
|
|
||||||
#define MP1_USE_BOO 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Runtime/IMain.hpp"
|
#include "Runtime/IMain.hpp"
|
||||||
#include "Runtime/MP1/CTweaks.hpp"
|
#include "Runtime/MP1/CTweaks.hpp"
|
||||||
#include "Runtime/MP1/CPlayMovie.hpp"
|
#include "Runtime/MP1/CPlayMovie.hpp"
|
||||||
|
@ -114,12 +110,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if MP1_USE_BOO
|
class CGameArchitectureSupport {
|
||||||
class CGameArchitectureSupport : public boo::IWindowCallback
|
|
||||||
#else
|
|
||||||
class CGameArchitectureSupport
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
friend class CMain;
|
friend class CMain;
|
||||||
CMain& m_parent;
|
CMain& m_parent;
|
||||||
CArchitectureQueue x4_archQueue;
|
CArchitectureQueue x4_archQueue;
|
||||||
|
@ -133,12 +124,12 @@ class CGameArchitectureSupport
|
||||||
EAudioLoadStatus x88_audioLoadStatus = EAudioLoadStatus::Uninitialized;
|
EAudioLoadStatus x88_audioLoadStatus = EAudioLoadStatus::Uninitialized;
|
||||||
std::vector<TToken<CAudioGroupSet>> x8c_pendingAudioGroups;
|
std::vector<TToken<CAudioGroupSet>> x8c_pendingAudioGroups;
|
||||||
|
|
||||||
boo::SWindowRect m_windowRect;
|
aurora::WindowSize m_windowRect;
|
||||||
bool m_rectIsDirty = false;
|
bool m_rectIsDirty = false;
|
||||||
|
|
||||||
void destroyed() { x4_archQueue.Push(MakeMsg::CreateRemoveAllIOWins(EArchMsgTarget::IOWinManager)); }
|
void destroyed() { x4_archQueue.Push(MakeMsg::CreateRemoveAllIOWins(EArchMsgTarget::IOWinManager)); }
|
||||||
|
|
||||||
void resized(const boo::SWindowRect& rect) {
|
void resized(const aurora::WindowSize& rect) {
|
||||||
m_windowRect = rect;
|
m_windowRect = rect;
|
||||||
m_rectIsDirty = true;
|
m_rectIsDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -147,16 +138,14 @@ public:
|
||||||
CGameArchitectureSupport(CMain& parent, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend);
|
CGameArchitectureSupport(CMain& parent, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend);
|
||||||
~CGameArchitectureSupport();
|
~CGameArchitectureSupport();
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) {
|
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
|
||||||
x30_inputGenerator.mouseDown(coord, button, mods);
|
x30_inputGenerator.mouseDown(coord, button, mods);
|
||||||
}
|
}
|
||||||
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) {
|
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
|
||||||
x30_inputGenerator.mouseUp(coord, button, mods);
|
x30_inputGenerator.mouseUp(coord, button, mods);
|
||||||
}
|
}
|
||||||
void mouseMove(const boo::SWindowCoord& coord) { x30_inputGenerator.mouseMove(coord); }
|
void mouseMove(const SWindowCoord& coord) { x30_inputGenerator.mouseMove(coord); }
|
||||||
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll) {
|
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) { x30_inputGenerator.scroll(coord, scroll); }
|
||||||
x30_inputGenerator.scroll(coord, scroll);
|
|
||||||
}
|
|
||||||
void charKeyDown(uint8_t charCode, aurora::ModifierKey mods, bool isRepeat);
|
void charKeyDown(uint8_t charCode, aurora::ModifierKey mods, bool isRepeat);
|
||||||
void charKeyUp(uint8_t charCode, aurora::ModifierKey mods) { x30_inputGenerator.charKeyUp(charCode, mods); }
|
void charKeyUp(uint8_t charCode, aurora::ModifierKey mods) { x30_inputGenerator.charKeyUp(charCode, mods); }
|
||||||
void specialKeyDown(aurora::SpecialKey key, aurora::ModifierKey mods, bool isRepeat);
|
void specialKeyDown(aurora::SpecialKey key, aurora::ModifierKey mods, bool isRepeat);
|
||||||
|
@ -173,7 +162,7 @@ public:
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
bool isRectDirty() const { return m_rectIsDirty; }
|
bool isRectDirty() const { return m_rectIsDirty; }
|
||||||
const boo::SWindowRect& getWindowRect() {
|
const aurora::WindowSize& getWindowRect() {
|
||||||
m_rectIsDirty = false;
|
m_rectIsDirty = false;
|
||||||
return m_windowRect;
|
return m_windowRect;
|
||||||
}
|
}
|
||||||
|
@ -181,25 +170,9 @@ public:
|
||||||
CIOWinManager& GetIOWinManager() { return x58_ioWinManager; }
|
CIOWinManager& GetIOWinManager() { return x58_ioWinManager; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if MP1_USE_BOO
|
class CMain : public IMain {
|
||||||
class CMain : public boo::IApplicationCallback,
|
|
||||||
public IMain
|
|
||||||
#else
|
|
||||||
class CMain : public IMain
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
friend class CGameArchitectureSupport;
|
friend class CGameArchitectureSupport;
|
||||||
#if MP1_USE_BOO
|
|
||||||
boo::IWindow* mainWindow;
|
|
||||||
int appMain(boo::IApplication* app);
|
|
||||||
void appQuitting(boo::IApplication*) { xe8_b24_finished = true; }
|
|
||||||
void appFilesOpen(boo::IApplication*, const std::vector<std::string>& paths) {
|
|
||||||
fmt::print(stderr, FMT_STRING("OPENING: "));
|
|
||||||
for (const std::string& path : paths)
|
|
||||||
fprintf(stderr, "%s ", path.c_str());
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
private:
|
private:
|
||||||
struct BooSetter {
|
struct BooSetter {
|
||||||
BooSetter();
|
BooSetter();
|
||||||
|
@ -279,8 +252,8 @@ public:
|
||||||
|
|
||||||
// int RsMain(int argc, char** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator&
|
// int RsMain(int argc, char** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator&
|
||||||
// backend);
|
// backend);
|
||||||
void Init(const FileStoreManager& storeMgr, CVarManager* cvarManager,
|
void Init(const FileStoreManager& storeMgr, CVarManager* cvarManager, boo::IAudioVoiceEngine* voiceEngine,
|
||||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) override;
|
amuse::IBackendVoiceAllocator& backend) override;
|
||||||
void WarmupShaders() override;
|
void WarmupShaders() override;
|
||||||
bool Proc(float dt) override;
|
bool Proc(float dt) override;
|
||||||
void Draw() override;
|
void Draw() override;
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class COutputStream {
|
class COutputStream {
|
||||||
friend class coutput_stream_helper;
|
template <typename T>
|
||||||
|
friend void coutput_stream_helper(const T& t, COutputStream& out);
|
||||||
u32 x4_position = 0;
|
u32 x4_position = 0;
|
||||||
u32 x8_bufLen = 0;
|
u32 x8_bufLen = 0;
|
||||||
u8* xc_ptr = nullptr;
|
u8* xc_ptr = nullptr;
|
||||||
|
@ -16,9 +17,9 @@ class COutputStream {
|
||||||
u8 x1c_scratch[96]{};
|
u8 x1c_scratch[96]{};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void DoFlush();
|
void DoFlush();
|
||||||
void DoPut(const u8* ptr, u32 len);
|
void DoPut(const u8* ptr, u32 len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
COutputStream(u8* ptr, s32 unk);
|
COutputStream(u8* ptr, s32 unk);
|
||||||
virtual ~COutputStream();
|
virtual ~COutputStream();
|
||||||
|
@ -85,4 +86,4 @@ template <>
|
||||||
void coutput_stream_helper(const double& t, COutputStream& out);
|
void coutput_stream_helper(const double& t, COutputStream& out);
|
||||||
template <>
|
template <>
|
||||||
void coutput_stream_helper(const std::string& t, COutputStream& out);
|
void coutput_stream_helper(const std::string& t, COutputStream& out);
|
||||||
}
|
} // namespace metaforce
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
if (WIN32)
|
||||||
|
set(SDL_LIBC ON CACHE BOOL "Use the system C library" FORCE)
|
||||||
|
endif ()
|
||||||
add_subdirectory(../extern/SDL SDL2 EXCLUDE_FROM_ALL)
|
add_subdirectory(../extern/SDL SDL2 EXCLUDE_FROM_ALL)
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
target_compile_options(SDL2-static PRIVATE -Wno-implicit-fallthrough)
|
target_compile_options(SDL2-static PRIVATE -Wno-implicit-fallthrough)
|
||||||
|
@ -35,6 +38,11 @@ if (APPLE)
|
||||||
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_METAL)
|
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_METAL)
|
||||||
target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm)
|
target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm)
|
||||||
set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||||
|
elseif (WIN32)
|
||||||
|
target_compile_definitions(aurora PRIVATE
|
||||||
|
DAWN_ENABLE_BACKEND_D3D12
|
||||||
|
DAWN_ENABLE_BACKEND_VULKAN)
|
||||||
|
target_sources(aurora PRIVATE lib/dawn/D3D12Binding.cpp lib/dawn/VulkanBinding.cpp)
|
||||||
else ()
|
else ()
|
||||||
target_compile_definitions(aurora PRIVATE
|
target_compile_definitions(aurora PRIVATE
|
||||||
DAWN_ENABLE_BACKEND_VULKAN
|
DAWN_ENABLE_BACKEND_VULKAN
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "BackendBinding.hpp"
|
||||||
|
|
||||||
|
#include <SDL_syswm.h>
|
||||||
|
#include <dawn/native/D3D12Backend.h>
|
||||||
|
|
||||||
|
namespace aurora::gpu::utils {
|
||||||
|
class D3D12Binding : public BackendBinding {
|
||||||
|
public:
|
||||||
|
D3D12Binding(SDL_Window* window, WGPUDevice device) : BackendBinding(window, device) {}
|
||||||
|
|
||||||
|
uint64_t GetSwapChainImplementation() override {
|
||||||
|
if (m_swapChainImpl.userData == nullptr) {
|
||||||
|
CreateSwapChainImpl();
|
||||||
|
}
|
||||||
|
return reinterpret_cast<uint64_t>(&m_swapChainImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
WGPUTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||||
|
if (m_swapChainImpl.userData == nullptr) {
|
||||||
|
CreateSwapChainImpl();
|
||||||
|
}
|
||||||
|
return dawn::native::d3d12::GetNativeSwapChainPreferredFormat(&m_swapChainImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
DawnSwapChainImplementation m_swapChainImpl{};
|
||||||
|
|
||||||
|
void CreateSwapChainImpl() {
|
||||||
|
SDL_SysWMinfo wmInfo;
|
||||||
|
SDL_VERSION(&wmInfo.version);
|
||||||
|
SDL_GetWindowWMInfo(m_window, &wmInfo);
|
||||||
|
m_swapChainImpl = dawn::native::d3d12::CreateNativeSwapChainImpl(m_device, wmInfo.info.win.window);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
BackendBinding* CreateD3D12Binding(SDL_Window* window, WGPUDevice device) { return new D3D12Binding(window, device); }
|
||||||
|
} // namespace aurora::gpu::utils
|
|
@ -268,6 +268,14 @@ void shutdown() {
|
||||||
g_pipelineThreadEnd = true;
|
g_pipelineThreadEnd = true;
|
||||||
g_pipelineCv.notify_all();
|
g_pipelineCv.notify_all();
|
||||||
g_pipelineThread.join();
|
g_pipelineThread.join();
|
||||||
|
|
||||||
|
g_cachedBindGroups.clear();
|
||||||
|
g_pipelines.clear();
|
||||||
|
g_vertexBuffer = {};
|
||||||
|
g_uniformBuffer = {};
|
||||||
|
g_indexBuffer = {};
|
||||||
|
|
||||||
|
g_state = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void render(const wgpu::RenderPassEncoder& pass) {
|
void render(const wgpu::RenderPassEncoder& pass) {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "dawn/BackendBinding.hpp"
|
#include "dawn/BackendBinding.hpp"
|
||||||
|
|
||||||
|
// TODO this hack doesn't link on Windows?
|
||||||
|
#ifndef _WIN32
|
||||||
// TODO HACK: dawn doesn't expose device toggles
|
// TODO HACK: dawn doesn't expose device toggles
|
||||||
#include "../extern/dawn/src/dawn/native/Toggles.h"
|
#include "../extern/dawn/src/dawn/native/Toggles.h"
|
||||||
namespace dawn::native {
|
namespace dawn::native {
|
||||||
|
@ -17,6 +19,7 @@ public:
|
||||||
void SetToggle(Toggle toggle, bool isEnabled);
|
void SetToggle(Toggle toggle, bool isEnabled);
|
||||||
};
|
};
|
||||||
} // namespace dawn::native
|
} // namespace dawn::native
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace aurora::gpu {
|
namespace aurora::gpu {
|
||||||
static logvisor::Module Log("aurora::gpu");
|
static logvisor::Module Log("aurora::gpu");
|
||||||
|
@ -148,9 +151,11 @@ void initialize(SDL_Window* window) {
|
||||||
};
|
};
|
||||||
g_device = wgpu::Device::Acquire(g_Adapter.CreateDevice(&deviceDescriptor));
|
g_device = wgpu::Device::Acquire(g_Adapter.CreateDevice(&deviceDescriptor));
|
||||||
g_device.SetUncapturedErrorCallback(&error_callback, nullptr);
|
g_device.SetUncapturedErrorCallback(&error_callback, nullptr);
|
||||||
|
#ifndef _WIN32
|
||||||
// TODO HACK: dawn doesn't expose device toggles
|
// TODO HACK: dawn doesn't expose device toggles
|
||||||
static_cast<dawn::native::DeviceBase*>(static_cast<void*>(g_device.Get()))
|
static_cast<dawn::native::DeviceBase*>(static_cast<void*>(g_device.Get()))
|
||||||
->SetToggle(dawn::native::Toggle::UseUserDefinedLabelsInBackend, true);
|
->SetToggle(dawn::native::Toggle::UseUserDefinedLabelsInBackend, true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
g_queue = g_device.GetQueue();
|
g_queue = g_device.GetQueue();
|
||||||
|
|
||||||
|
@ -192,6 +197,9 @@ void initialize(SDL_Window* window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdown() {
|
void shutdown() {
|
||||||
|
g_frameBuffer = {};
|
||||||
|
g_frameBufferResolved = {};
|
||||||
|
g_depthBuffer = {};
|
||||||
wgpuSwapChainRelease(g_swapChain.Release());
|
wgpuSwapChainRelease(g_swapChain.Release());
|
||||||
wgpuQueueRelease(g_queue.Release());
|
wgpuQueueRelease(g_queue.Release());
|
||||||
g_BackendBinding.reset();
|
g_BackendBinding.reset();
|
||||||
|
|
|
@ -31,7 +31,9 @@ struct TextureWithSampler {
|
||||||
wgpu::Sampler sampler;
|
wgpu::Sampler sampler;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DAWN_ENABLE_BACKEND_VULKAN
|
#ifdef DAWN_ENABLE_BACKEND_D3D12
|
||||||
|
static const wgpu::BackendType preferredBackendType = wgpu::BackendType::D3D12;
|
||||||
|
#elif DAWN_ENABLE_BACKEND_VULKAN
|
||||||
static const wgpu::BackendType preferredBackendType = wgpu::BackendType::Vulkan;
|
static const wgpu::BackendType preferredBackendType = wgpu::BackendType::Vulkan;
|
||||||
#elif DAWN_ENABLE_BACKEND_METAL
|
#elif DAWN_ENABLE_BACKEND_METAL
|
||||||
static const wgpu::BackendType preferredBackendType = wgpu::BackendType::Metal;
|
static const wgpu::BackendType preferredBackendType = wgpu::BackendType::Metal;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 89986bdd650685261311a87b37f504baee342eff
|
Subproject commit 101746f2688f0b8f66b574cd492ab41c0f7eec4f
|
|
@ -1 +1 @@
|
||||||
Subproject commit e13b498266d69d12883f36d35d284cd3dbfa53c1
|
Subproject commit f27a63f312ba15b986e186b993d9d201d63a118b
|
|
@ -1 +1 @@
|
||||||
Subproject commit e458d1999cb613c5dc221c9805c81cf7e8a24fb6
|
Subproject commit 94d11cb32884cfc90a0f13f6ff98a1c7637f8312
|
|
@ -1 +1 @@
|
||||||
Subproject commit 883681cafb2563de3b8af270726e30e83f240721
|
Subproject commit 5772c54b9935f5e294c522ef5741ce888f33457c
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2252e6c3c391dc162ed1245a5d348c1f9a587a4b
|
Subproject commit 32090b4d4ab70dbfa07f1f2994964f983ab43a69
|
|
@ -1 +1 @@
|
||||||
Subproject commit 30697375adee818e9c14015584c6629e12d27ab4
|
Subproject commit 72893dcacb02ebff11b354832c55f3763ab523b7
|
|
@ -6,13 +6,6 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if _WIN32
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <Windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace hecl {
|
namespace hecl {
|
||||||
|
|
||||||
class MultiProgressPrinter {
|
class MultiProgressPrinter {
|
||||||
|
@ -22,7 +15,7 @@ class MultiProgressPrinter {
|
||||||
|
|
||||||
struct TermInfo {
|
struct TermInfo {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
HANDLE console;
|
void* console;
|
||||||
#endif
|
#endif
|
||||||
int width;
|
int width;
|
||||||
bool xtermColor = false;
|
bool xtermColor = false;
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#define FOREGROUND_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
|
#define FOREGROUND_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace hecl {
|
namespace hecl {
|
||||||
|
|
Loading…
Reference in New Issue