New debugging features, cellGame & minor changes

Two cellGame functions partially implemented:
- cellGameGetParamInt
- cellGameGetParamString

New debugging features:
- Call Stack viewer added
- Memory Viewer rewritten (Not finished yet)

Modified definition of UNIMPLEMENTED_FUNC to improve compatibility with
other compilers: Thanks @krofna

Replaced the "Compiler" menu entry with "Tools" and "Memory Viewer"
entry added.

NOTE: To "quickly" browse the memory using the Memory Viewer you can use
the scrollbar. Notice the irony of the word 'quickly' since the memory
viewer is actually slow as fuck. I will fix that soon. As you can see,
I'd like to add a Raw image viewer in the future in order to "see"
textures directly from memory.
This commit is contained in:
Alexandro Sánchez Bach 2013-11-23 05:47:19 +01:00
parent 62c1980cac
commit 5e1a958ee6
15 changed files with 376 additions and 78 deletions

View file

@ -2,6 +2,8 @@
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"
#include "Loader/PSF.h"
void cellGame_init();
Module cellGame(0x003e, cellGame_init);
@ -29,6 +31,41 @@ enum
CELL_GAME_ERROR_BOOTPATH = 0x8002cb50,
};
//Parameter IDs of PARAM.SFO
enum
{
//Integers
CELL_GAME_PARAMID_PARENTAL_LEVEL = 102,
CELL_GAME_PARAMID_RESOLUTION = 103,
CELL_GAME_PARAMID_SOUND_FORMAT = 104,
//Strings
CELL_GAME_PARAMID_TITLE = 0,
CELL_GAME_PARAMID_TITLE_DEFAULT = 1,
CELL_GAME_PARAMID_TITLE_JAPANESE = 2,
CELL_GAME_PARAMID_TITLE_ENGLISH = 3,
CELL_GAME_PARAMID_TITLE_FRENCH = 4,
CELL_GAME_PARAMID_TITLE_SPANISH = 5,
CELL_GAME_PARAMID_TITLE_GERMAN = 6,
CELL_GAME_PARAMID_TITLE_ITALIAN = 7,
CELL_GAME_PARAMID_TITLE_DUTCH = 8,
CELL_GAME_PARAMID_TITLE_PORTUGUESE = 9,
CELL_GAME_PARAMID_TITLE_RUSSIAN = 10,
CELL_GAME_PARAMID_TITLE_KOREAN = 11,
CELL_GAME_PARAMID_TITLE_CHINESE_T = 12,
CELL_GAME_PARAMID_TITLE_CHINESE_S = 13,
CELL_GAME_PARAMID_TITLE_FINNISH = 14,
CELL_GAME_PARAMID_TITLE_SWEDISH = 15,
CELL_GAME_PARAMID_TITLE_DANISH = 16,
CELL_GAME_PARAMID_TITLE_NORWEGIAN = 17,
CELL_GAME_PARAMID_TITLE_POLISH = 18,
CELL_GAME_PARAMID_TITLE_PORTUGUESE_BRAZIL = 19,
CELL_GAME_PARAMID_TITLE_ENGLISH_UK = 20,
CELL_GAME_PARAMID_TITLE_ID = 100,
CELL_GAME_PARAMID_VERSION = 101,
CELL_GAME_PARAMID_APP_VER = 106,
};
int cellGameBootCheck()
{
UNIMPLEMENTED_FUNC(cellGame);
@ -65,15 +102,87 @@ int cellGameDeleteGameData()
return CELL_OK;
}
int cellGameGetParamInt()
int cellGameGetParamInt(u32 id, mem32_t value)
{
UNIMPLEMENTED_FUNC(cellGame);
cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr());
if(!value.IsGood())
return CELL_GAME_ERROR_PARAM;
// TODO: Locate the PARAM.SFO. The following path is in most cases wrong.
vfsStream* f = Emu.GetVFS().Open("/app_home/PARAM.SFO", vfsRead);
PSFLoader psf(*f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
psf.Close();
switch(id)
{ // TODO: Is the endianness right?
case CELL_GAME_PARAMID_PARENTAL_LEVEL: value = psf.m_info.parental_lvl; break;
case CELL_GAME_PARAMID_RESOLUTION: value = psf.m_info.resolution; break;
case CELL_GAME_PARAMID_SOUND_FORMAT: value = psf.m_info.sound_format; break;
default:
return CELL_GAME_ERROR_INVALID_ID;
}
return CELL_OK;
}
int cellGameGetParamString()
int cellGameGetParamString(u32 id, mem_list_ptr_t<u8> buf, u32 bufsize)
{
UNIMPLEMENTED_FUNC(cellGame);
cellGame.Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.GetAddr(), bufsize);
if(!buf.IsGood())
return CELL_GAME_ERROR_PARAM;
// TODO: Locate the PARAM.SFO. The following path is in most cases wrong.
vfsStream* f = Emu.GetVFS().Open("/app_home/PARAM.SFO", vfsRead);
PSFLoader psf(*f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
psf.Close();
switch(id)
{
// WARNING: Is there any difference between all these "CELL_GAME_PARAMID_TITLE*" IDs?
case CELL_GAME_PARAMID_TITLE:
case CELL_GAME_PARAMID_TITLE_DEFAULT:
case CELL_GAME_PARAMID_TITLE_JAPANESE:
case CELL_GAME_PARAMID_TITLE_ENGLISH:
case CELL_GAME_PARAMID_TITLE_FRENCH:
case CELL_GAME_PARAMID_TITLE_SPANISH:
case CELL_GAME_PARAMID_TITLE_GERMAN:
case CELL_GAME_PARAMID_TITLE_ITALIAN:
case CELL_GAME_PARAMID_TITLE_DUTCH:
case CELL_GAME_PARAMID_TITLE_PORTUGUESE:
case CELL_GAME_PARAMID_TITLE_RUSSIAN:
case CELL_GAME_PARAMID_TITLE_KOREAN:
case CELL_GAME_PARAMID_TITLE_CHINESE_T:
case CELL_GAME_PARAMID_TITLE_CHINESE_S:
case CELL_GAME_PARAMID_TITLE_FINNISH:
case CELL_GAME_PARAMID_TITLE_SWEDISH:
case CELL_GAME_PARAMID_TITLE_DANISH:
case CELL_GAME_PARAMID_TITLE_NORWEGIAN:
case CELL_GAME_PARAMID_TITLE_POLISH:
case CELL_GAME_PARAMID_TITLE_PORTUGUESE_BRAZIL:
case CELL_GAME_PARAMID_TITLE_ENGLISH_UK:
Memory.WriteString(buf.GetAddr(), psf.m_info.name.Left(bufsize));
break;
case CELL_GAME_PARAMID_TITLE_ID:
Memory.WriteString(buf.GetAddr(), psf.m_info.serial.Left(bufsize));
break;
case CELL_GAME_PARAMID_VERSION:
Memory.WriteString(buf.GetAddr(), psf.m_info.fw.Left(bufsize));
break;
case CELL_GAME_PARAMID_APP_VER:
Memory.WriteString(buf.GetAddr(), psf.m_info.app_ver.Left(bufsize));
break;
default:
return CELL_GAME_ERROR_INVALID_ID;
}
return CELL_OK;
}