Change s8 typedef to int8_t

This commit is contained in:
Ziemas 2021-09-07 11:42:47 +02:00 committed by Kojin
parent 2175814acf
commit fc9beafc32
10 changed files with 15 additions and 18 deletions

View File

@ -31,10 +31,7 @@ class FastFormatUnicode;
// Basic Atomic Types // Basic Atomic Types
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// Note: char does not have a default sign, unlike other types. As we actually want typedef int8_t s8;
// char and not signed char in pcsx2, we define s8 to char
typedef char s8;
typedef int16_t s16; typedef int16_t s16;
typedef int32_t s32; typedef int32_t s32;
typedef int64_t s64; typedef int64_t s64;

View File

@ -957,7 +957,7 @@ void GSReplay(char* lpszCmdLine, int renderer)
freezeData fd; freezeData fd;
file->Read(&fd.size, 4); file->Read(&fd.size, 4);
fd.data = new char[fd.size]; fd.data = new u8[fd.size];
file->Read(fd.data, fd.size); file->Read(fd.data, fd.size);
GSfreeze(FreezeAction::Load, &fd); GSfreeze(FreezeAction::Load, &fd);

View File

@ -2375,14 +2375,14 @@ void GSState::Transfer(const uint8* mem, uint32 size)
} }
template <class T> template <class T>
static void WriteState(char*& dst, T* src, size_t len = sizeof(T)) static void WriteState(u8*& dst, T* src, size_t len = sizeof(T))
{ {
memcpy(dst, src, len); memcpy(dst, src, len);
dst += len; dst += len;
} }
template <class T> template <class T>
static void ReadState(T* dst, char*& src, size_t len = sizeof(T)) static void ReadState(T* dst, u8*& src, size_t len = sizeof(T))
{ {
memcpy(dst, src, len); memcpy(dst, src, len);
src += len; src += len;
@ -2403,7 +2403,7 @@ int GSState::Freeze(freezeData* fd, bool sizeonly)
Flush(); Flush();
char* data = fd->data; u8* data = fd->data;
WriteState(data, &m_version); WriteState(data, &m_version);
WriteState(data, &m_env.PRIM); WriteState(data, &m_env.PRIM);
@ -2482,7 +2482,7 @@ int GSState::Defrost(const freezeData* fd)
return -1; return -1;
} }
char* data = fd->data; u8* data = fd->data;
int version; int version;

View File

@ -516,7 +516,7 @@ void GSRenderer::VSync(int field)
{ {
freezeData fd = {0, nullptr}; freezeData fd = {0, nullptr};
Freeze(&fd, true); Freeze(&fd, true);
fd.data = new char[fd.size]; fd.data = new u8[fd.size];
Freeze(&fd, false); Freeze(&fd, false);
if (m_control_key) if (m_control_key)

View File

@ -42,7 +42,7 @@ static const u32 g_SaveVersion = (0x9A23 << 16) | 0x0000;
typedef struct typedef struct
{ {
int size; int size;
s8 *data; u8 *data;
} freezeData; } freezeData;
// this function is meant to be used in the place of GSfreeze, and provides a safe layer // this function is meant to be used in the place of GSfreeze, and provides a safe layer

View File

@ -385,7 +385,7 @@ s32 USBfreeze(FreezeAction mode, freezeData* data)
// restore USBPacket for OHCIState // restore USBPacket for OHCIState
usb_packet_init(&qemu_ohci->usb_packet); usb_packet_init(&qemu_ohci->usb_packet);
s8* ptr = data->data + sizeof(USBfreezeData); u8* ptr = data->data + sizeof(USBfreezeData);
RegisterDevice& regInst = RegisterDevice::instance(); RegisterDevice& regInst = RegisterDevice::instance();
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -535,7 +535,7 @@ s32 USBfreeze(FreezeAction mode, freezeData* data)
usbd.cycles = clocks; usbd.cycles = clocks;
usbd.remaining = remaining; usbd.remaining = remaining;
s8* ptr = data->data + sizeof(USBfreezeData); u8* ptr = data->data + sizeof(USBfreezeData);
// Save the state of the attached devices // Save the state of the attached devices
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)

View File

@ -729,7 +729,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
m_dump_file->Read(state_data.get(), ss); m_dump_file->Read(state_data.get(), ss);
m_dump_file->Read(&regs, 8192); m_dump_file->Read(&regs, 8192);
freezeData fd = {(int)ss, (s8*)state_data.get()}; freezeData fd = {(int)ss, (u8*)state_data.get()};
m_root_window->m_dump_packets.clear(); m_root_window->m_dump_packets.clear();
while (m_dump_file->Tell() < m_dump_file->Length()) while (m_dump_file->Tell() < m_dump_file->Length())

View File

@ -389,7 +389,7 @@ namespace Implementations
freezeData fP = {0, nullptr}; freezeData fP = {0, nullptr};
MTGS_FreezeData sstate = {&fP, 0}; MTGS_FreezeData sstate = {&fP, 0};
GetMTGS().Freeze(FreezeAction::Size, sstate); GetMTGS().Freeze(FreezeAction::Size, sstate);
fP.data = new char[fP.size]; fP.data = new u8[fP.size];
GetMTGS().Freeze(FreezeAction::Save, sstate); GetMTGS().Freeze(FreezeAction::Save, sstate);
GetMTGS().Suspend(true); GetMTGS().Suspend(true);
renderswitch = !renderswitch; renderswitch = !renderswitch;

View File

@ -101,7 +101,7 @@ void MainEmuFrame::Menu_GSSettings_Click(wxCommandEvent& event)
if (is_frame_init) if (is_frame_init)
{ {
GetMTGS().Freeze(FreezeAction::Size, sstate); GetMTGS().Freeze(FreezeAction::Size, sstate);
fP.data = new char[fP.size]; fP.data = new u8[fP.size];
GetMTGS().Freeze(FreezeAction::Save, sstate); GetMTGS().Freeze(FreezeAction::Save, sstate);
GetMTGS().Suspend(true); GetMTGS().Suspend(true);
} }

View File

@ -68,7 +68,7 @@ static constexpr SysState_Component GS{"GS", SysState_MTGSFreeze};
void SysState_ComponentFreezeOutRoot(void* dest, SysState_Component comp) void SysState_ComponentFreezeOutRoot(void* dest, SysState_Component comp)
{ {
freezeData fP = {0, (char*)dest}; freezeData fP = {0, (u8*)dest};
if (comp.freeze(FreezeAction::Size, &fP) != 0) if (comp.freeze(FreezeAction::Size, &fP) != 0)
return; return;
if (!fP.size) if (!fP.size)
@ -98,7 +98,7 @@ void SysState_ComponentFreezeIn(pxInputStream& infp, SysState_Component comp)
return; return;
} }
ScopedAlloc<s8> data(fP.size); ScopedAlloc<u8> data(fP.size);
fP.data = data.GetPtr(); fP.data = data.GetPtr();
infp.Read(fP.data, fP.size); infp.Read(fP.data, fP.size);