Fix more style issues, and abstract most of the init code from MemMap.cpp.

This commit is contained in:
The Dax 2013-06-22 05:14:01 -04:00
parent 7ade9f6ceb
commit 695f7eeec5
6 changed files with 25 additions and 27 deletions

View File

@ -65,8 +65,7 @@ u32 g_MemoryMask;
u32 g_MemorySize;
// We don't declare the IO region in here since its handled by other means.
const int VIEWS_COUNT = 7;
static MemoryView views[VIEWS_COUNT] =
static MemoryView views[] =
{
{&m_pScratchPad, &m_pPhysicalScratchPad, 0x00010000, SCRATCHPAD_SIZE, 0},
{NULL, &m_pUncachedScratchPad, 0x40010000, SCRATCHPAD_SIZE, MV_MIRROR_PREVIOUS},
@ -82,27 +81,11 @@ static MemoryView views[VIEWS_COUNT] =
static const int num_views = sizeof(views) / sizeof(MemoryView);
void Init(std::string fileToStart)
void Init()
{
int flags = 0;
// Default memory settings
// TODO: Should DoubleTex really be initialized here?
// Seems to be the safest place currently..
g_MemoryEnd = 0x0A000000;
g_MemorySize = 0x2000000;
g_RemasterMode = false;
g_DoubleTextureCoordinates = false;
switch(Identify_File(fileToStart)) {
case FILETYPE_PSP_ISO:
case FILETYPE_PSP_ISO_NP:
InitGameISO(fileToStart);
break;
}
g_MemoryMask = g_MemorySize - 1;
for(int i = 0; i < VIEWS_COUNT; i++) {
for(int i = 0; i < ARRAY_SIZE(views); i++) {
if(views[i].size == 0)
views[i].size = g_MemorySize;
}
@ -126,6 +109,8 @@ void DoState(PointerWrap &p)
p.DoMarker("MemoryEnd");
p.Do(g_MemoryMask);
p.DoMarker("MemoryMask");
p.Do(g_DoubleTextureCoordinates); // TODO: Is there a more appropriate place for this?
p.DoMarker("DoubleTextureCoordinates");
}
void Shutdown()

View File

@ -102,7 +102,7 @@ enum
};
// Init and Shutdown
void Init(std::string fileToStart);
void Init();
void Shutdown();
void DoState(PointerWrap &p);
void Clear();

View File

@ -42,11 +42,18 @@
#include "Core/MemMap.h"
// TODO: Come up with a better name for this thing
// We gather the game info before actually loading/booting the ISO
// to determine if the emulator should enable extra memory and
// double-sized texture coordinates.
void InitGameISO(std::string fileToStart) {
void InitMemoryForGameISO(std::string fileToStart) {
// Default memory settings
// Seems to be the safest place currently..
Memory::g_MemoryEnd = 0x0A000000;
Memory::g_MemorySize = 0x2000000;
g_RemasterMode = false;
g_DoubleTextureCoordinates = false;
Memory::g_MemoryMask = Memory::g_MemorySize - 1;
ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(fileToStart.c_str()));
// Parse PARAM.SFO

View File

@ -23,4 +23,4 @@
bool Load_PSP_ISO(const char *filename, std::string *error_string);
bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string);
void InitGameISO(std::string fileToStart);
void InitMemoryForGameISO(std::string fileToStart);

View File

@ -44,6 +44,7 @@
#include "CoreParameter.h"
#include "FileSystems/MetaFileSystem.h"
#include "Loaders.h"
#include "PSPLoaders.h"
#include "ELF/ParamSFO.h"
#include "../Common/LogManager.h"
@ -72,7 +73,14 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
coreParameter = coreParam;
currentCPU = &mipsr4k;
numCPUs = 1;
Memory::Init(coreParam.fileToStart);
std::string filename = coreParameter.fileToStart;
EmuFileType type = Identify_File(filename);
if(type == FILETYPE_PSP_ISO || type == FILETYPE_PSP_ISO_NP)
InitMemoryForGameISO(filename);
Memory::Init();
mipsr4k.Reset();
mipsr4k.pc = 0;
@ -96,7 +104,6 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
// TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly
std::string filename = coreParameter.fileToStart;
if (!LoadFile(filename, error_string) || coreState == CORE_POWERDOWN)
{
pspFileSystem.Shutdown();

View File

@ -627,7 +627,6 @@ void VertexDecoder::SetVertexType(u32 fmt) {
steps_[numSteps_++] = throughmode ? tcstep_through[tc] : tcstep[tc];
switch (tc) {
case GE_VTYPE_TC_8BIT >> GE_VTYPE_TC_SHIFT:
decFmt.uvfmt = throughmode ? DEC_U8A_2 : DEC_U8_2;
break;