Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #695 from lioncash/ipl-string
Core: Use a std::string in EXI_DeviceIPL instead of a char buffer
  • Loading branch information
lioncash committed Aug 1, 2014
2 parents 4b32dcb + 3d95ed9 commit 6c923b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
23 changes: 6 additions & 17 deletions Source/Core/Core/HW/EXI_DeviceIPL.cpp
Expand Up @@ -82,11 +82,8 @@ CEXIIPL::CEXIIPL() :
m_uPosition(0),
m_uAddress(0),
m_uRWOffset(0),
m_count(0),
m_FontsLoaded(false)
{
memset(m_szBuffer,0,sizeof(m_szBuffer));

// Determine region
m_bNTSC = SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC;

Expand Down Expand Up @@ -114,7 +111,6 @@ CEXIIPL::CEXIIPL() :
// Clear RTC
memset(m_RTC, 0, sizeof(m_RTC));


// We Overwrite language selection here since it's possible on the GC to change the language as you please
g_SRAM.lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;

Expand All @@ -124,11 +120,6 @@ CEXIIPL::CEXIIPL() :

CEXIIPL::~CEXIIPL()
{
if (m_count > 0)
{
m_szBuffer[m_count] = 0x00;
}

FreeMemoryPages(m_pIPL, ROM_SIZE);
m_pIPL = nullptr;

Expand All @@ -142,8 +133,7 @@ void CEXIIPL::DoState(PointerWrap &p)
p.Do(m_uPosition);
p.Do(m_uAddress);
p.Do(m_uRWOffset);
p.Do(m_szBuffer);
p.Do(m_count);
p.Do(m_buffer);
p.Do(m_FontsLoaded);
}

Expand Down Expand Up @@ -274,13 +264,12 @@ void CEXIIPL::TransferByte(u8& _uByte)
if (IsWriteCommand())
{
if (_uByte != '\0')
m_szBuffer[m_count++] = _uByte;
if (m_count >= 255 || _uByte == '\r')
m_buffer += _uByte;

if (_uByte == '\r')
{
m_szBuffer[m_count] = '\0';
NOTICE_LOG(OSREPORT, "%s", m_szBuffer);
memset(m_szBuffer, 0, sizeof(m_szBuffer));
m_count = 0;
NOTICE_LOG(OSREPORT, "%s", m_buffer.c_str());
m_buffer.clear();
}
}
else
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/HW/EXI_DeviceIPL.h
Expand Up @@ -4,6 +4,8 @@

#pragma once

#include <string>

#include "Core/HW/EXI_Device.h"
#include "Core/HW/Sram.h"

Expand Down Expand Up @@ -58,8 +60,7 @@ class CEXIIPL : public IEXIDevice
u32 m_uAddress;
u32 m_uRWOffset;

char m_szBuffer[256];
int m_count;
std::string m_buffer;
bool m_FontsLoaded;

virtual void TransferByte(u8 &_uByte) override;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/State.cpp
Expand Up @@ -63,7 +63,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;

// Don't forget to increase this after doing changes on the savestate system
static const u32 STATE_VERSION = 29;
static const u32 STATE_VERSION = 30;

enum
{
Expand Down

0 comments on commit 6c923b7

Please sign in to comment.