Update API.

Use u32 rather than uint32_t in CRandom16
This commit is contained in:
Phillip Stephens 2015-11-08 19:43:11 -08:00
parent 812967ffbf
commit 9cb8b10fda
9 changed files with 46 additions and 48 deletions

@ -1 +1 @@
Subproject commit 40ca0c32191ca691c8a2d8b645a22616bff751aa Subproject commit 8937bfc0c61e8e0f2d4a43026b49e5ef2025160d

View File

@ -1,7 +1,7 @@
#ifndef RETRO_CRANDOM16_HPP #ifndef RETRO_CRANDOM16_HPP
#define RETRO_CRANDOM16_HPP #define RETRO_CRANDOM16_HPP
#include <stdint.h> #include "GCNTypes.hpp"
namespace Retro namespace Retro
{ {
@ -11,22 +11,22 @@ extern class CGlobalRandom* GLOBAL_RANDOM_TOKEN;
class CRandom16 class CRandom16
{ {
uint32_t m_seed; u32 m_seed;
public: public:
CRandom16(uint32_t p) : m_seed(p) {} CRandom16(u32 p) : m_seed(p) {}
inline uint32_t Next() inline u32 Next()
{ {
m_seed = (m_seed * 0x41c64e6d) + 0x00003039; m_seed = (m_seed * 0x41c64e6d) + 0x00003039;
return m_seed >> 16; return m_seed >> 16;
} }
inline uint32_t GetSeed() const inline u32 GetSeed() const
{ {
return m_seed; return m_seed;
} }
inline void SetSeed(uint32_t p) inline void SetSeed(u32 p)
{ {
m_seed = p; m_seed = p;
} }
@ -41,12 +41,12 @@ public:
return min + Float() * (max - min); return min + Float() * (max - min);
} }
inline int32_t Range(int32_t min, int32_t max) inline s32 Range(s32 min, s32 max)
{ {
int64_t diff = max - min; s32 diff = max - min;
int64_t rand = -1; s32 rand = -1;
while (rand < 0) while (rand < 0)
rand = int32_t((Next() << 16) | Next()); rand = s32((Next() << 16) | Next());
return rand % diff + min; return rand % diff + min;
} }

View File

@ -157,18 +157,18 @@ CFinalInput::CFinalInput(int cIdx, float dt,
x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown()), x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown()),
x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger()), x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger()),
x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger()), x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger()),
x2c_b24_A(data.m_mouseButtons[boo::IWindowCallback::BUTTON_PRIMARY]), x2c_b24_A(data.m_mouseButtons[boo::BUTTON_PRIMARY]),
x2c_b25_B(data.m_charKeys[' ']), x2c_b25_B(data.m_charKeys[' ']),
x2c_b26_X(data.m_charKeys['c']), x2c_b26_X(data.m_charKeys['c']),
x2c_b27_Y(data.m_mouseButtons[boo::IWindowCallback::BUTTON_SECONDARY]), x2c_b27_Y(data.m_mouseButtons[boo::BUTTON_SECONDARY]),
x2c_b28_Z(data.m_charKeys['\t']), x2c_b28_Z(data.m_charKeys['\t']),
x2c_b29_L(data.m_charKeys['q']), x2c_b29_L(data.m_charKeys['q']),
x2c_b30_R(data.m_charKeys['e']), x2c_b30_R(data.m_charKeys['e']),
x2c_b31_DPUp(data.m_specialKeys[boo::IWindowCallback::KEY_UP]), x2c_b31_DPUp(data.m_specialKeys[boo::KEY_UP]),
x2d_b24_DPRight(data.m_specialKeys[boo::IWindowCallback::KEY_RIGHT]), x2d_b24_DPRight(data.m_specialKeys[boo::KEY_RIGHT]),
x2d_b25_DPDown(data.m_specialKeys[boo::IWindowCallback::KEY_DOWN]), x2d_b25_DPDown(data.m_specialKeys[boo::KEY_DOWN]),
x2d_b26_DPLeft(data.m_specialKeys[boo::IWindowCallback::KEY_LEFT]), x2d_b26_DPLeft(data.m_specialKeys[boo::KEY_LEFT]),
x2d_b27_Start(data.m_specialKeys[boo::IWindowCallback::KEY_ESC]), x2d_b27_Start(data.m_specialKeys[boo::KEY_ESC]),
x2d_b28_PA(DA() && !prevInput.DA()), x2d_b28_PA(DA() && !prevInput.DA()),
x2d_b29_PB(DB() && !prevInput.DB()), x2d_b29_PB(DB() && !prevInput.DB()),
x2d_b30_PX(DX() && !prevInput.DX()), x2d_b30_PX(DX() && !prevInput.DX()),

View File

@ -39,52 +39,52 @@ public:
{ {
CKeyboardMouseControllerData m_data; CKeyboardMouseControllerData m_data;
void mouseDown(const SWindowCoord&, EMouseButton button, EModifierKey) void mouseDown(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey)
{ {
m_data.m_mouseButtons[button] = true; m_data.m_mouseButtons[button] = true;
} }
void mouseUp(const SWindowCoord&, EMouseButton button, EModifierKey) void mouseUp(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey)
{ {
m_data.m_mouseButtons[button] = false; m_data.m_mouseButtons[button] = false;
} }
void mouseMove(const SWindowCoord& coord) void mouseMove(const boo::SWindowCoord& coord)
{ {
m_data.m_mouseCoord = coord; m_data.m_mouseCoord = coord;
} }
void scroll(const SWindowCoord&, const SScrollDelta& scroll) void scroll(const boo::SWindowCoord&, const boo::SScrollDelta& scroll)
{ {
m_data.m_accumScroll += scroll; m_data.m_accumScroll += scroll;
} }
void charKeyDown(unsigned long charCode, EModifierKey, bool) void charKeyDown(unsigned long charCode, boo::EModifierKey, bool)
{ {
charCode = tolower(charCode); charCode = tolower(charCode);
if (charCode > 255) if (charCode > 255)
return; return;
m_data.m_charKeys[charCode] = true; m_data.m_charKeys[charCode] = true;
} }
void charKeyUp(unsigned long charCode, EModifierKey mods) void charKeyUp(unsigned long charCode, boo::EModifierKey mods)
{ {
charCode = tolower(charCode); charCode = tolower(charCode);
if (charCode > 255) if (charCode > 255)
return; return;
m_data.m_charKeys[charCode] = false; m_data.m_charKeys[charCode] = false;
} }
void specialKeyDown(ESpecialKey key, EModifierKey, bool) void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey, bool)
{ {
m_data.m_specialKeys[key] = true; m_data.m_specialKeys[key] = true;
} }
void specialKeyUp(ESpecialKey key, EModifierKey) void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey)
{ {
m_data.m_specialKeys[key] = false; m_data.m_specialKeys[key] = false;
} }
void modKeyDown(EModifierKey mod, bool) void modKeyDown(boo::EModifierKey mod, bool)
{ {
m_data.m_modMask = EModifierKey(m_data.m_modMask | mod); m_data.m_modMask = boo::EModifierKey(m_data.m_modMask | mod);
} }
void modKeyUp(EModifierKey mod) void modKeyUp(boo::EModifierKey mod)
{ {
m_data.m_modMask = EModifierKey(m_data.m_modMask & ~mod); m_data.m_modMask = boo::EModifierKey(m_data.m_modMask & ~mod);
} }
void reset() void reset()

View File

@ -11,9 +11,9 @@ struct CKeyboardMouseControllerData
bool m_charKeys[256] = {}; bool m_charKeys[256] = {};
bool m_specialKeys[26] = {}; bool m_specialKeys[26] = {};
bool m_mouseButtons[6] = {}; bool m_mouseButtons[6] = {};
boo::IWindowCallback::EModifierKey m_modMask = boo::IWindowCallback::MKEY_NONE; boo::EModifierKey m_modMask = boo::MKEY_NONE;
boo::IWindowCallback::SWindowCoord m_mouseCoord; boo::SWindowCoord m_mouseCoord;
boo::IWindowCallback::SScrollDelta m_accumScroll; boo::SScrollDelta m_accumScroll;
}; };
} }

View File

@ -29,11 +29,9 @@ class WindowCallback : public boo::IWindowCallback
class CMain : public boo::IApplicationCallback class CMain : public boo::IApplicationCallback
{ {
boo::IWindow* mainWindow; boo::IWindow* mainWindow;
//ApplicationDeviceFinder devFinder;
WindowCallback windowCallback;
int appMain(boo::IApplication* app); int appMain(boo::IApplication* app);
void appQuitting(boo::IApplication*) void appQuitting(boo::IApplication*)
{} { xe8_b24_finished = true; }
void appFilesOpen(boo::IApplication*, const std::vector<std::string>& paths) void appFilesOpen(boo::IApplication*, const std::vector<std::string>& paths)
{ {
fprintf(stderr, "OPENING: "); fprintf(stderr, "OPENING: ");

View File

@ -32,6 +32,7 @@
#include "GameGlobalObjects.hpp" #include "GameGlobalObjects.hpp"
#include "CArchitectureQueue.hpp" #include "CArchitectureQueue.hpp"
#include "CMain.hpp" #include "CMain.hpp"
#include "CTimeProvider.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
@ -114,6 +115,7 @@ public:
m_inputGenerator(0.0f /*g_tweakPlayer->GetLeftLogicalThreshold()*/, m_inputGenerator(0.0f /*g_tweakPlayer->GetLeftLogicalThreshold()*/,
0.0f /*g_tweakPlayer->GetRightLogicalThreshold()*/) 0.0f /*g_tweakPlayer->GetRightLogicalThreshold()*/)
{ {
m_inputGenerator.startScanning();
} }
bool Update() bool Update()
{ {
@ -148,13 +150,8 @@ void CMain::AddWorldPaks()
while (i <= 255) while (i <= 255)
{ {
std::string pakName = CBasics::Stringize("%s%i.pak", g_tweakGame->GetWorldPrefix().c_str(), i); std::string pakName = CBasics::Stringize("%s%i.pak", g_tweakGame->GetWorldPrefix().c_str(), i);
if (!CDvdFile::FileExists(pakName.c_str())) if (CDvdFile::FileExists(pakName.c_str()))
{ g_ResFactory->GetLoader().AddPakFile(pakName, false);
i++;
continue;
}
g_ResFactory->GetLoader().AddPakFile(pakName, false);
i++; i++;
} }
#endif #endif
@ -171,9 +168,7 @@ int CMain::appMain(boo::IApplication* app)
{ {
Zeus::detectCPU(); Zeus::detectCPU();
mainWindow = app->newWindow("Metroid Prime 1 Reimplementation vZygote"); mainWindow = app->newWindow("Metroid Prime 1 Reimplementation vZygote");
mainWindow->setCallback(&windowCallback);
mainWindow->showWindow(); mainWindow->showWindow();
//devFinder.startScanning();
TOneStatic<CGameGlobalObjects> globalObjs; TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems(); InitializeSubsystems();
globalObjs->PostInitialize(x6c_memSys); globalObjs->PostInitialize(x6c_memSys);
@ -187,14 +182,20 @@ int CMain::appMain(boo::IApplication* app)
float rgba[4] = { 0.5f, 0.5f, 0.5f, 1.0f}; float rgba[4] = { 0.5f, 0.5f, 0.5f, 1.0f};
gfxQ->setClearColor(rgba); gfxQ->setClearColor(rgba);
float time = 0.0f;
int frame = 0;
CTimeProvider test(time);
while (!xe8_b24_finished) while (!xe8_b24_finished)
{ {
mainWindow->waitForRetrace(); mainWindow->waitForRetrace();
xe8_b24_finished = archSupport->Update(); xe8_b24_finished = archSupport->Update();
gfxQ->clearTarget(); gfxQ->clearTarget();
gfxQ->present();
gfxQ->execute(); gfxQ->execute();
time = (frame++) / 60.f;
//fprintf(stderr, "%f\n", test.x0_currentTime);
} }
return 0; return 0;
} }

View File

@ -12,7 +12,6 @@ class CElementGen : public CParticleGen
float x78_generatorRate; float x78_generatorRate;
Zeus::CVector3f x88_globalTranslation; Zeus::CVector3f x88_globalTranslation;
Zeus::CTransform x1d8_globalOrientation; Zeus::CTransform x1d8_globalOrientation;
std::vector<CElementGen> x238_children;
std::vector<CElementGen> x240_children; std::vector<CElementGen> x240_children;
std::vector<CElementGen> x254_children; std::vector<CElementGen> x254_children;
public: public:

2
libBoo

@ -1 +1 @@
Subproject commit 4f650ce5f558b68e06cb120648be0b8d8619a93a Subproject commit 2be32d6ca42a59d254874578248b7d4e91a1ee99