More fixes and fixes to previous fixes

This commit is contained in:
Raul Tambre 2015-01-26 21:01:47 +02:00
commit 78a92c7d43
8 changed files with 135 additions and 121 deletions

View file

@ -206,8 +206,6 @@ namespace fmt
{ {
throw "Invalid formatting (u8): " + std::string(fmt, len); throw "Invalid formatting (u8): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -228,8 +226,6 @@ namespace fmt
{ {
throw "Invalid formatting (u16): " + std::string(fmt, len); throw "Invalid formatting (u16): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -250,8 +246,6 @@ namespace fmt
{ {
throw "Invalid formatting (u32): " + std::string(fmt, len); throw "Invalid formatting (u32): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -272,8 +266,6 @@ namespace fmt
{ {
throw "Invalid formatting (u64): " + std::string(fmt, len); throw "Invalid formatting (u64): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -294,8 +286,6 @@ namespace fmt
{ {
throw "Invalid formatting (s8): " + std::string(fmt, len); throw "Invalid formatting (s8): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -316,8 +306,6 @@ namespace fmt
{ {
throw "Invalid formatting (s16): " + std::string(fmt, len); throw "Invalid formatting (s16): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -378,8 +366,6 @@ namespace fmt
{ {
throw "Invalid formatting (float): " + std::string(fmt, len); throw "Invalid formatting (float): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -400,8 +386,6 @@ namespace fmt
{ {
throw "Invalid formatting (double): " + std::string(fmt, len); throw "Invalid formatting (double): " + std::string(fmt, len);
} }
return{};
} }
}; };
@ -426,8 +410,6 @@ namespace fmt
{ {
throw "Invalid formatting (bool): " + std::string(fmt, len); throw "Invalid formatting (bool): " + std::string(fmt, len);
} }
return{};
} }
}; };

View file

@ -62,7 +62,8 @@ public:
public: public:
iterator(vfsDirBase* parent) iterator(vfsDirBase* parent)
: data(parent->First()) : parent(parent)
, data(parent->First())
{ {
} }

View file

@ -289,7 +289,7 @@ u16 RSXVertexTexture::GetMipmap() const
u8 RSXVertexTexture::GetWrapS() const u8 RSXVertexTexture::GetWrapS() const
{ {
return 1; return 1;
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)]) & 0xf); //return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)]) & 0xf);
} }
u8 RSXVertexTexture::GetWrapT() const u8 RSXVertexTexture::GetWrapT() const
@ -301,7 +301,7 @@ u8 RSXVertexTexture::GetWrapT() const
u8 RSXVertexTexture::GetWrapR() const u8 RSXVertexTexture::GetWrapR() const
{ {
return 1; return 1;
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 16) & 0xf); //return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 16) & 0xf);
} }
u8 RSXVertexTexture::GetUnsignedRemap() const u8 RSXVertexTexture::GetUnsignedRemap() const

View file

@ -542,16 +542,15 @@ int cellGcmSetSecondVFrequency(u32 freq)
switch (freq) switch (freq)
{ {
case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ: case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ:
cellGcmSys->Todo("Unimplemented display frequency: 59.94Hz"); break; Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys->Todo("Unimplemented display frequency: 59.94Hz"); break;
case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT: case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT:
cellGcmSys->Todo("Unimplemented display frequency: Scanout"); break; Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys->Todo("Unimplemented display frequency: Scanout"); break;
case CELL_GCM_DISPLAY_FREQUENCY_DISABLE: case CELL_GCM_DISPLAY_FREQUENCY_DISABLE:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; break; Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys->Todo("Unimplemented display frequency: Disabled"); break;
default: cellGcmSys->Error("Improper display frequency specified!"); return;
default: return CELL_EINVAL;
} }
return CELL_OK; return;
} }
int cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) int cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank)

View file

@ -11,17 +11,24 @@ extern Module *sys_io;
int cellKbInit(u32 max_connect) int cellKbInit(u32 max_connect)
{ {
sys_io->Warning("cellKbInit(max_connect=%d)", max_connect); sys_io->Warning("cellKbInit(max_connect=%d)", max_connect);
if(Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_ALREADY_INITIALIZED;
if(max_connect > 7) return CELL_KB_ERROR_INVALID_PARAMETER; if (Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_ALREADY_INITIALIZED;
if (max_connect > 7)
return CELL_KB_ERROR_INVALID_PARAMETER;
Emu.GetKeyboardManager().Init(max_connect); Emu.GetKeyboardManager().Init(max_connect);
return CELL_OK; return CELL_OK;
} }
int cellKbEnd() int cellKbEnd()
{ {
sys_io->Log("cellKbEnd()"); sys_io->Log("cellKbEnd()");
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED;
Emu.GetKeyboardManager().Close(); Emu.GetKeyboardManager().Close();
return CELL_OK; return CELL_OK;
} }
@ -29,8 +36,12 @@ int cellKbEnd()
int cellKbClearBuf(u32 port_no) int cellKbClearBuf(u32 port_no)
{ {
sys_io->Log("cellKbClearBuf(port_no=%d)", port_no); sys_io->Log("cellKbClearBuf(port_no=%d)", port_no);
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetKeyboardManager().GetKeyboards().size()) return CELL_KB_ERROR_INVALID_PARAMETER; if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED;
if (port_no >= Emu.GetKeyboardManager().GetKeyboards().size())
return CELL_KB_ERROR_INVALID_PARAMETER;
//? //?
@ -42,9 +53,7 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode)
sys_io->Log("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode); sys_io->Log("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode);
// CELL_KB_RAWDAT // CELL_KB_RAWDAT
if ((rawcode >= 0x00 && rawcode <= 0x03) || rawcode == 0x29 || rawcode == 0x35 || if (rawcode <= 0x03 || rawcode == 0x29 || rawcode == 0x35 || (rawcode >= 0x39 && rawcode <= 0x53) || rawcode == 0x65 || rawcode == 0x88 || rawcode == 0x8A || rawcode == 0x8B)
(rawcode >= 0x39 && rawcode <= 0x53) || rawcode == 0x65 || rawcode == 0x88 ||
rawcode == 0x8A || rawcode == 0x8B)
{ {
return rawcode | 0x8000; return rawcode | 0x8000;
} }
@ -88,13 +97,16 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode)
int cellKbGetInfo(vm::ptr<CellKbInfo> info) int cellKbGetInfo(vm::ptr<CellKbInfo> info)
{ {
sys_io->Log("cellKbGetInfo(info_addr=0x%x)", info.addr()); sys_io->Log("cellKbGetInfo(info_addr=0x%x)", info.addr());
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED;
const KbInfo& current_info = Emu.GetKeyboardManager().GetInfo(); const KbInfo& current_info = Emu.GetKeyboardManager().GetInfo();
info->max_connect = current_info.max_connect; info->max_connect = current_info.max_connect;
info->now_connect = current_info.now_connect; info->now_connect = current_info.now_connect;
info->info = current_info.info; info->info = current_info.info;
for(u32 i=0; i<CELL_KB_MAX_KEYBOARDS; i++)
for (u32 i=0; i<CELL_KB_MAX_KEYBOARDS; i++)
{ {
info->status[i] = current_info.status[i]; info->status[i] = current_info.status[i];
} }
@ -107,14 +119,18 @@ int cellKbRead(u32 port_no, vm::ptr<CellKbData> data)
sys_io->Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.addr()); sys_io->Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.addr());
const std::vector<Keyboard>& keyboards = Emu.GetKeyboardManager().GetKeyboards(); const std::vector<Keyboard>& keyboards = Emu.GetKeyboardManager().GetKeyboards();
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; if (!Emu.GetKeyboardManager().IsInited())
if(port_no >= keyboards.size()) return CELL_KB_ERROR_INVALID_PARAMETER; return CELL_KB_ERROR_UNINITIALIZED;
if (port_no >= keyboards.size())
return CELL_KB_ERROR_INVALID_PARAMETER;
KbData& current_data = Emu.GetKeyboardManager().GetData(port_no); KbData& current_data = Emu.GetKeyboardManager().GetData(port_no);
data->led = current_data.led; data->led = current_data.led;
data->mkey = current_data.mkey; data->mkey = current_data.mkey;
data->len = std::min((u32)current_data.len, CELL_KB_MAX_KEYCODES); data->len = std::min((u32)current_data.len, CELL_KB_MAX_KEYCODES);
for(s32 i=0; i<current_data.len; i++)
for (s32 i=0; i<current_data.len; i++)
{ {
data->keycode[i] = current_data.keycode[i]; data->keycode[i] = current_data.keycode[i];
} }
@ -127,7 +143,9 @@ int cellKbRead(u32 port_no, vm::ptr<CellKbData> data)
int cellKbSetCodeType(u32 port_no, u32 type) int cellKbSetCodeType(u32 port_no, u32 type)
{ {
sys_io->Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type); sys_io->Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type);
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED;
KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
current_config.code_type = type; current_config.code_type = type;
@ -143,7 +161,9 @@ int cellKbSetLEDStatus(u32 port_no, u8 led)
int cellKbSetReadMode(u32 port_no, u32 rmode) int cellKbSetReadMode(u32 port_no, u32 rmode)
{ {
sys_io->Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode); sys_io->Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode);
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED;
KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
current_config.read_mode = rmode; current_config.read_mode = rmode;
@ -154,7 +174,9 @@ int cellKbSetReadMode(u32 port_no, u32 rmode)
int cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config) int cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config)
{ {
sys_io->Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.addr()); sys_io->Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.addr());
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED;
const KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); const KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
config->arrange = current_config.arrange; config->arrange = current_config.arrange;

View file

@ -127,8 +127,8 @@ s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
{ {
switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE) switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE)
{ {
case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: LOG_WARNING(TTY, "%s\n", msg.c_str()); break; case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: LOG_WARNING(HLE, "%s", msg.c_str()); break;
case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: LOG_ERROR(TTY, "%s\n", msg.c_str()); break; case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: LOG_ERROR(HLE, "%s", msg.c_str()); break;
} }
switch (type & CELL_MSGDIALOG_TYPE_SE_MUTE) // TODO switch (type & CELL_MSGDIALOG_TYPE_SE_MUTE) // TODO
@ -264,7 +264,11 @@ s32 cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> cal
} }
char errorCodeHex[12]; char errorCodeHex[12];
#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
sprintf_s(errorCodeHex, "\n(%08x)", errorCode); sprintf_s(errorCodeHex, "\n(%08x)", errorCode);
#else
sprintf(errorCodeHex, "\n(%08x)", errorCode);
#endif
errorMessage.append(errorCodeHex); errorMessage.append(errorCodeHex);
u64 status; u64 status;

View file

@ -1060,8 +1060,11 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
res = CELL_SYNC_ERROR_AGAIN; res = CELL_SYNC_ERROR_AGAIN;
if (!push.m_h7.data() || res) if (!push.m_h7.data() || res)
{ {
// TODO: This condition is always true - wrong implementation?
return res; return res;
} }
break;
} }
else if (!useEventQueue) else if (!useEventQueue)
{ {
@ -1436,8 +1439,11 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
res = CELL_SYNC_ERROR_AGAIN; res = CELL_SYNC_ERROR_AGAIN;
if (!pop.m_h3.data() || res) if (!pop.m_h3.data() || res)
{ {
// TODO: This condition is always true - wrong implementation?
return res; return res;
} }
break;
} }
else if (!useEventQueue) else if (!useEventQueue)
{ {

View file

@ -210,91 +210,91 @@ void CompilerELF::OnUpdate(wxCommandEvent& event)
DoAnalyzeCode(false); DoAnalyzeCode(false);
return; return;
/*asm_list->Freeze(); //asm_list->Freeze();
asm_list->SetStyle(0, asm_list->GetValue().Len(), wxTextAttr("Black")); //asm_list->SetStyle(0, asm_list->GetValue().Len(), wxTextAttr("Black"));
/* ///*
for(u32 i=0; i<instr_count; ++i) //for(u32 i=0; i<instr_count; ++i)
{ //{
SetOpStyle(m_instructions[i].name, "Blue"); // SetOpStyle(m_instructions[i].name, "Blue");
} //}
*/ //*/
//
//SetOpStyle(".int", "Blue");
//SetOpStyle(".string", "Blue");
//SetOpStyle(".strlen", "Blue");
//SetOpStyle(".buf", "Blue");
//SetOpStyle(".srl", "Blue");
//SetOpStyle(".srr", "Blue");
//SetOpStyle(".mul", "Blue");
//SetOpStyle(".div", "Blue");
//SetOpStyle(".add", "Blue");
//SetOpStyle(".sub", "Blue");
//SetOpStyle(".and", "Blue");
//SetOpStyle(".or", "Blue");
//SetOpStyle(".xor", "Blue");
//SetOpStyle(".not", "Blue");
//SetOpStyle(".nor", "Blue");
/*SetOpStyle(".int", "Blue"); //SetTextStyle("[", "Red");
SetOpStyle(".string", "Blue"); //SetTextStyle("]", "Red");
SetOpStyle(".strlen", "Blue"); //SetTextStyle(":", "Red");
SetOpStyle(".buf", "Blue"); //SetTextStyle(",", "Red");
SetOpStyle(".srl", "Blue");
SetOpStyle(".srr", "Blue");
SetOpStyle(".mul", "Blue");
SetOpStyle(".div", "Blue");
SetOpStyle(".add", "Blue");
SetOpStyle(".sub", "Blue");
SetOpStyle(".and", "Blue");
SetOpStyle(".or", "Blue");
SetOpStyle(".xor", "Blue");
SetOpStyle(".not", "Blue");
SetOpStyle(".nor", "Blue");
SetTextStyle("[", "Red"); //for(int p=0; (p = asm_list->GetValue().find('#', p)) >= 0;)
SetTextStyle("]", "Red"); //{
SetTextStyle(":", "Red"); // const int from = p++;
SetTextStyle(",", "Red"); // p = asm_list->GetValue().find('\n', p);
for(int p=0; (p = asm_list->GetValue().find('#', p)) >= 0;) // if(p < 0) p = asm_list->GetValue().Len();
{
const int from = p++;
p = asm_list->GetValue().find('\n', p);
if(p < 0) p = asm_list->GetValue().Len(); // asm_list->SetStyle(from, p, wxTextAttr(0x009900));
//}
//
//for(int p=0; (p = asm_list->GetValue().find('"', p)) >= 0;)
//{
// const int from = p++;
// const int p1 = asm_list->GetValue().find('\n', p);
asm_list->SetStyle(from, p, wxTextAttr(0x009900)); // int p2 = p;
} // for(;;)
// {
// p2 = asm_list->GetValue().find('"', p2);
// if(p2 == -1) break;
for(int p=0; (p = asm_list->GetValue().find('"', p)) >= 0;) // if(asm_list->GetValue()[p2 - 1] == '\\')
{ // {
const int from = p++; // if(p2 > 2 && asm_list->GetValue()[p2 - 2] == '\\') break;
const int p1 = asm_list->GetValue().find('\n', p);
int p2 = p; // p2++;
for(;;) // continue;
{ // }
p2 = asm_list->GetValue().find('"', p2); // break;
if(p2 == -1) break; // }
if(asm_list->GetValue()[p2 - 1] == '\\') // if(p1 < 0 && p2 < 0)
{ // {
if(p2 > 2 && asm_list->GetValue()[p2 - 2] == '\\') break; // p = asm_list->GetValue().Len();
// }
// else if(p1 >= 0 && p2 < 0)
// {
// p = p1;
// }
// else if(p2 >= 0 && p1 < 0)
// {
// p = p2 + 1;
// }
// else
// {
// p = p1 > p2 ? p2 + 1 : p1;
// }
p2++; // asm_list->SetStyle(from, p, wxTextAttr(0x000099));
continue; //}
}
break;
}
if(p1 < 0 && p2 < 0) //asm_list->Thaw();
{
p = asm_list->GetValue().Len();
}
else if(p1 >= 0 && p2 < 0)
{
p = p1;
}
else if(p2 >= 0 && p1 < 0)
{
p = p2 + 1;
}
else
{
p = p1 > p2 ? p2 + 1 : p1;
}
asm_list->SetStyle(from, p, wxTextAttr(0x000099)); //UpdateScroll(true, wxVERTICAL);
}
asm_list->Thaw();
UpdateScroll(true, wxVERTICAL);*/
} }
void CompilerELF::OnScroll(wxScrollWinEvent& event) void CompilerELF::OnScroll(wxScrollWinEvent& event)