cellJpgEnc, cellKey2char, cellSheap added

ModuleManager cleanup
This commit is contained in:
Nekotekina 2015-07-29 18:39:34 +03:00
parent 5a9896c78c
commit ae73330314
8 changed files with 154 additions and 94 deletions

View file

@ -24,6 +24,8 @@ extern Module cellHttp;
extern Module cellHttps;
extern Module cellHttpUtil;
extern Module cellJpgDec;
extern Module cellJpgEnc;
extern Module cellKey2char;
extern Module cellL10n;
extern Module cellMic;
extern Module cellNetCtl;
@ -38,6 +40,7 @@ extern Module cellSaveData;
extern Module cellMinisSaveData;
extern Module cellScreenshot;
extern Module cellSearch;
extern Module cellSheap;
extern Module cellSpurs;
extern Module cellSpursJq;
extern Module cellSsl;
@ -69,11 +72,26 @@ extern Module sys_lv2dbg;
struct ModuleInfo
{
s32 id; //-1 is used by module with only name
const char* name;
Module* module;
const s32 id; // -1 if the module doesn't have corresponding CELL_SYSMODULE_* id
const char* const name;
Module* const module;
explicit operator bool() const
{
return module != nullptr;
}
operator Module*() const
{
return module;
}
Module* operator ->() const
{
return module;
}
}
static const g_module_list[] =
const g_module_list[] =
{
{ 0x0000, "sys_net", &sys_net },
{ 0x0001, "cellHttp", &cellHttp },
@ -87,7 +105,7 @@ static const g_module_list[] =
{ 0x0009, "cellRtc", &cellRtc },
{ 0x000a, "cellSpurs", &cellSpurs },
{ 0x000b, "cellOvis", &cellOvis },
{ 0x000c, "cellSheap", nullptr },
{ 0x000c, "cellSheap", &cellSheap },
{ 0x000d, "cellSync", &cellSync },
{ 0x000e, "sys_fs", &cellFs },
{ 0x000f, "cellJpgDec", &cellJpgDec },
@ -108,7 +126,7 @@ static const g_module_list[] =
{ 0x001e, "cellL10n", &cellL10n },
{ 0x001f, "cellResc", &cellResc },
{ 0x0020, "cellDaisy", nullptr },
{ 0x0021, "cellKey2char", nullptr },
{ 0x0021, "cellKey2char", &cellKey2char },
{ 0x0022, "cellMic", &cellMic },
{ 0x0023, "cellCamera", &cellCamera },
{ 0x0024, "cellVdecMpeg2", nullptr },
@ -132,7 +150,7 @@ static const g_module_list[] =
{ 0x003a, "sceNpClans", &sceNpClans },
{ 0x003b, "cellSysutilOskExt", nullptr },
{ 0x003c, "cellVdecDivx", nullptr },
{ 0x003d, "cellJpgEnc", nullptr },
{ 0x003d, "cellJpgEnc", &cellJpgEnc },
{ 0x003e, "cellGame", &cellGame },
{ 0x003f, "cellBGDLUtility", &cellBGDL },
{ 0x0040, "cellFreetypeTT", nullptr },
@ -185,53 +203,58 @@ static const g_module_list[] =
void ModuleManager::Init()
{
if (initialized)
if (m_init)
{
Close();
}
clear_ppu_functions();
for (auto& m : g_module_list)
for (auto& module : g_module_list)
{
if (m.module)
if (module)
{
m.module->Init();
module->Init();
}
}
initialized = true;
m_init = true;
}
ModuleManager::ModuleManager()
: initialized(false)
{
}
ModuleManager::~ModuleManager()
{
Close();
}
void ModuleManager::Close()
{
for (auto& m : g_module_list)
if (!m_init)
{
if (m.module && m.module->on_stop)
return;
}
for (auto& module : g_module_list)
{
if (module && module->on_stop)
{
m.module->on_stop();
module->on_stop();
}
}
initialized = false;
m_init = false;
}
Module* ModuleManager::GetModuleByName(const char* name)
{
for (auto& m : g_module_list)
for (auto& module : g_module_list)
{
if (!strcmp(name, m.name))
if (!strcmp(name, module.name))
{
return m.module;
return module;
}
}
@ -240,11 +263,11 @@ Module* ModuleManager::GetModuleByName(const char* name)
Module* ModuleManager::GetModuleById(u16 id)
{
for (auto& m : g_module_list)
for (auto& module : g_module_list)
{
if (m.id == id)
if (module.id == id)
{
return m.module;
return module;
}
}
@ -253,9 +276,9 @@ Module* ModuleManager::GetModuleById(u16 id)
bool ModuleManager::CheckModuleId(u16 id)
{
for (auto& m : g_module_list)
for (auto& module : g_module_list)
{
if (m.id == id)
if (module.id == id)
{
return true;
}

View file

@ -4,7 +4,7 @@ class Module;
class ModuleManager
{
bool initialized;
bool m_init = false;
public:
ModuleManager();
@ -12,7 +12,8 @@ public:
void Init();
void Close();
Module* GetModuleByName(const char* name);
Module* GetModuleById(u16 id);
bool CheckModuleId(u16 id);
static Module* GetModuleByName(const char* name);
static Module* GetModuleById(u16 id);
static bool CheckModuleId(u16 id);
};

View file

@ -74,6 +74,11 @@ s32 cellGifDecOpen(
return CELL_OK;
}
s32 cellGifDecExtOpen()
{
throw EXCEPTION("");
}
s32 cellGifDecReadHeader(
CellGifDecMainHandle mainHandle,
CellGifDecSubHandle subHandle,
@ -131,6 +136,11 @@ s32 cellGifDecReadHeader(
return CELL_OK;
}
s32 cellGifDecExtReadHeader()
{
throw EXCEPTION("");
}
s32 cellGifDecSetParameter(
CellGifDecMainHandle mainHandle,
CellGifDecSubHandle subHandle,
@ -167,6 +177,11 @@ s32 cellGifDecSetParameter(
return CELL_OK;
}
s32 cellGifDecExtSetParameter()
{
throw EXCEPTION("");
}
s32 cellGifDecDecodeData(
CellGifDecMainHandle mainHandle,
CellGifDecSubHandle subHandle,
@ -293,6 +308,11 @@ s32 cellGifDecDecodeData(
return CELL_OK;
}
s32 cellGifDecExtDecodeData()
{
throw EXCEPTION("");
}
s32 cellGifDecClose(CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle)
{
cellGifDec.Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle);
@ -327,8 +347,8 @@ Module cellGifDec("cellGifDec", []()
REG_FUNC(cellGifDec, cellGifDecClose);
REG_FUNC(cellGifDec, cellGifDecDestroy);
/*REG_FUNC(cellGifDec, cellGifDecExtOpen);
REG_FUNC(cellGifDec, cellGifDecExtOpen);
REG_FUNC(cellGifDec, cellGifDecExtReadHeader);
REG_FUNC(cellGifDec, cellGifDecExtSetParameter);
REG_FUNC(cellGifDec, cellGifDecExtDecodeData);*/
REG_FUNC(cellGifDec, cellGifDecExtDecodeData);
});

View file

@ -68,6 +68,11 @@ s32 cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc
return CELL_OK;
}
s32 cellJpgDecExtOpen()
{
throw EXCEPTION("");
}
s32 cellJpgDecClose(u32 mainHandle, u32 subHandle)
{
cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle);
@ -157,6 +162,11 @@ s32 cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
return CELL_OK;
}
s32 cellJpgDecExtReadHeader()
{
throw EXCEPTION("");
}
s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::cptr<CellJpgDecDataCtrlParam> dataCtrlParam, vm::ptr<CellJpgDecDataOutInfo> dataOutInfo)
{
cellJpgDec.Log("cellJpgDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)", mainHandle, subHandle, data, dataCtrlParam, dataOutInfo);
@ -293,6 +303,11 @@ s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::cp
return CELL_OK;
}
s32 cellJpgDecExtDecodeData()
{
throw EXCEPTION("");
}
s32 cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptr<CellJpgDecInParam> inParam, vm::ptr<CellJpgDecOutParam> outParam)
{
cellJpgDec.Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam);
@ -338,6 +353,11 @@ s32 cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptr<CellJpgDecInP
return CELL_OK;
}
s32 cellJpgDecExtSetParameter()
{
throw EXCEPTION("");
}
Module cellJpgDec("cellJpgDec", []()
{
@ -350,8 +370,8 @@ Module cellJpgDec("cellJpgDec", []()
REG_FUNC(cellJpgDec, cellJpgDecClose);
REG_FUNC(cellJpgDec, cellJpgDecDestroy);
/*REG_FUNC(cellJpgDec, cellJpgDecExtOpen);
REG_FUNC(cellJpgDec, cellJpgDecExtOpen);
REG_FUNC(cellJpgDec, cellJpgDecExtReadHeader);
REG_FUNC(cellJpgDec, cellJpgDecExtSetParameter);
REG_FUNC(cellJpgDec, cellJpgDecExtDecodeData);*/
REG_FUNC(cellJpgDec, cellJpgDecExtDecodeData);
});

View file

@ -1,8 +1,8 @@
#include "stdafx.h"
#if 0
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"
void cellJpgEnc_init();
Module cellJpgEnc(0x003d, cellJpgEnc_init);
extern Module cellJpgEnc;
// Error Codes
enum
@ -15,67 +15,67 @@ enum
CELL_JPGENC_ERROR_FATAL = 0x80611196,
};
int cellJpgEncQueryAttr()
s32 cellJpgEncQueryAttr()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncOpen()
s32 cellJpgEncOpen()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncOpenEx()
s32 cellJpgEncOpenEx()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncClose()
s32 cellJpgEncClose()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncWaitForInput()
s32 cellJpgEncWaitForInput()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncEncodePicture()
s32 cellJpgEncEncodePicture()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncEncodePicture2()
s32 cellJpgEncEncodePicture2()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncWaitForOutput()
s32 cellJpgEncWaitForOutput()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncGetStreamInfo()
s32 cellJpgEncGetStreamInfo()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
int cellJpgEncReset()
s32 cellJpgEncReset()
{
UNIMPLEMENTED_FUNC(cellJpgEnc);
return CELL_OK;
}
void cellJpgEnc_init()
Module cellJpgEnc("cellJpgEnc", []()
{
REG_FUNC(cellJpgEnc, cellJpgEncQueryAttr);
REG_FUNC(cellJpgEnc, cellJpgEncOpen);
@ -87,5 +87,4 @@ void cellJpgEnc_init()
REG_FUNC(cellJpgEnc, cellJpgEncWaitForOutput);
REG_FUNC(cellJpgEnc, cellJpgEncGetStreamInfo);
REG_FUNC(cellJpgEnc, cellJpgEncReset);
}
#endif
});

View file

@ -1,8 +1,8 @@
#include "stdafx.h"
#if 0
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"
void cellKey2char_init();
Module cellKey2char(0x0021, cellKey2char_init);
extern Module cellKey2char;
// Return Codes
enum
@ -16,42 +16,41 @@ enum
CELL_K2C_ERROR_OTHER = 0x80121306,
};
int cellKey2CharOpen()
s32 cellKey2CharOpen()
{
UNIMPLEMENTED_FUNC(cellKey2char);
return CELL_OK;
}
int cellKey2CharClose()
s32 cellKey2CharClose()
{
UNIMPLEMENTED_FUNC(cellKey2char);
return CELL_OK;
}
int cellKey2CharGetChar()
s32 cellKey2CharGetChar()
{
UNIMPLEMENTED_FUNC(cellKey2char);
return CELL_OK;
}
int cellKey2CharSetMode()
s32 cellKey2CharSetMode()
{
UNIMPLEMENTED_FUNC(cellKey2char);
return CELL_OK;
}
int cellKey2CharSetArrangement()
s32 cellKey2CharSetArrangement()
{
UNIMPLEMENTED_FUNC(cellKey2char);
return CELL_OK;
}
void cellKey2char_init()
Module cellKey2char("cellKey2char", []()
{
REG_FUNC(cellKey2char, cellKey2CharOpen);
REG_FUNC(cellKey2char, cellKey2CharClose);
REG_FUNC(cellKey2char, cellKey2CharGetChar);
REG_FUNC(cellKey2char, cellKey2CharSetMode);
REG_FUNC(cellKey2char, cellKey2CharSetArrangement);
}
#endif
});

View file

@ -1,8 +1,8 @@
#include "stdafx.h"
#if 0
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"
void cellSheap_init();
Module cellSheap(0x000c, cellSheap_init);
extern Module cellSheap;
// Return Codes
enum
@ -13,115 +13,115 @@ enum
CELL_SHEAP_ERROR_SHORTAGE = 0x80410312,
};
int cellSheapInitialize()
s32 cellSheapInitialize()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellSheapAllocate()
s32 cellSheapAllocate()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellSheapFree()
s32 cellSheapFree()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellSheapQueryMax()
s32 cellSheapQueryMax()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellSheapQueryFree()
s32 cellSheapQueryFree()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapInitialize()
s32 cellKeySheapInitialize()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapBufferNew()
s32 cellKeySheapBufferNew()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapBufferDelete()
s32 cellKeySheapBufferDelete()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapMutexNew()
s32 cellKeySheapMutexNew()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapMutexDelete()
s32 cellKeySheapMutexDelete()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapBarrierNew()
s32 cellKeySheapBarrierNew()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapBarrierDelete()
s32 cellKeySheapBarrierDelete()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapSemaphoreNew()
s32 cellKeySheapSemaphoreNew()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapSemaphoreDelete()
s32 cellKeySheapSemaphoreDelete()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapRwmNew()
s32 cellKeySheapRwmNew()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapRwmDelete()
s32 cellKeySheapRwmDelete()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapQueueNew()
s32 cellKeySheapQueueNew()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
int cellKeySheapQueueDelete()
s32 cellKeySheapQueueDelete()
{
UNIMPLEMENTED_FUNC(cellSheap);
return CELL_OK;
}
void cellSheap_init()
Module cellSheap("cellSheap", []()
{
REG_FUNC(cellSheap, cellSheapInitialize);
REG_FUNC(cellSheap, cellSheapAllocate);
@ -129,7 +129,6 @@ void cellSheap_init()
REG_FUNC(cellSheap, cellSheapQueryMax);
REG_FUNC(cellSheap, cellSheapQueryFree);
// (TODO: Some cellKeySheap* functions are missing)
REG_FUNC(cellSheap, cellKeySheapInitialize);
REG_FUNC(cellSheap, cellKeySheapBufferNew);
REG_FUNC(cellSheap, cellKeySheapBufferDelete);
@ -144,5 +143,4 @@ void cellSheap_init()
REG_FUNC(cellSheap, cellKeySheapRwmDelete);
REG_FUNC(cellSheap, cellKeySheapQueueNew);
REG_FUNC(cellSheap, cellKeySheapQueueDelete);
}
#endif
});

View file

@ -416,12 +416,6 @@
<ClCompile Include="Emu\SysCalls\Modules\cellImejp.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellJpgEnc.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellKey2char.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMusicDecode.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
@ -446,9 +440,6 @@
<ClCompile Include="Emu\SysCalls\Modules\cellSailRec.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSheap.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellUsbpspcm.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
@ -887,6 +878,15 @@
<ClCompile Include="Emu\SysCalls\Modules\cellSsl.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellJpgEnc.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSheap.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellKey2char.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Crypto\aes.h">