Stack reference bug fix

This commit is contained in:
Jack Andersen 2018-01-13 20:43:00 -10:00
parent 8593e06fa5
commit c06141af1e
2 changed files with 8 additions and 3 deletions

View File

@ -87,8 +87,9 @@ class Endpoint
public: public:
KawasedoChallenge() = default; KawasedoChallenge() = default;
KawasedoChallenge(Endpoint& endpoint, s32 paletteColor, s32 paletteSpeed, KawasedoChallenge(s32 paletteColor, s32 paletteSpeed,
const u8* programp, s32 length, u8* status, FGBACallback&& callback); const u8* programp, s32 length, u8* status, FGBACallback&& callback);
void start(Endpoint& endpoint);
bool started() const { return m_started; } bool started() const { return m_started; }
u8 percentComplete() const u8 percentComplete() const
{ {

View File

@ -388,10 +388,13 @@ void Endpoint::KawasedoChallenge::_8BootDone(ThreadLocalEndpoint& endpoint, EJoy
} }
} }
Endpoint::KawasedoChallenge::KawasedoChallenge(Endpoint& endpoint, s32 paletteColor, s32 paletteSpeed, Endpoint::KawasedoChallenge::KawasedoChallenge(s32 paletteColor, s32 paletteSpeed,
const u8* programp, s32 length, u8* status, FGBACallback&& callback) const u8* programp, s32 length, u8* status, FGBACallback&& callback)
: x0_pColor(paletteColor), x4_pSpeed(paletteSpeed), x8_progPtr(programp), xc_progLen(length), : x0_pColor(paletteColor), x4_pSpeed(paletteSpeed), x8_progPtr(programp), xc_progLen(length),
x10_statusPtr(status), x14_callback(std::move(callback)), x34_bytesSent(0), m_initialized(true) x10_statusPtr(status), x14_callback(std::move(callback)), x34_bytesSent(0), m_initialized(true)
{}
void Endpoint::KawasedoChallenge::start(Endpoint& endpoint)
{ {
if (endpoint.GBAGetStatusAsync(x10_statusPtr, if (endpoint.GBAGetStatusAsync(x10_statusPtr,
bindThis(&KawasedoChallenge::_0Reset)) != GBA_READY) bindThis(&KawasedoChallenge::_0Reset)) != GBA_READY)
@ -805,8 +808,9 @@ EJoyReturn Endpoint::GBAJoyBootAsync(s32 paletteColor, s32 paletteSpeed,
if (programp[0xac] * programp[0xac] * programp[0xac] * programp[0xac] == 0) if (programp[0xac] * programp[0xac] * programp[0xac] * programp[0xac] == 0)
return GBA_JOYBOOT_ERR_INVALID; return GBA_JOYBOOT_ERR_INVALID;
m_joyBoot = KawasedoChallenge(*this, paletteColor, paletteSpeed, programp, length, status, m_joyBoot = KawasedoChallenge(paletteColor, paletteSpeed, programp, length, status,
std::move(callback)); std::move(callback));
m_joyBoot.start(*this);
if (!m_joyBoot.started()) if (!m_joyBoot.started())
return GBA_NOT_READY; return GBA_NOT_READY;