Clean up some warnings

This commit is contained in:
zilmar 2021-01-19 16:28:59 +10:30
parent eb986259f2
commit cd16a8cc48
41 changed files with 215 additions and 378 deletions

View File

@ -34,7 +34,8 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PrecompiledHeader /> <PrecompiledHeader />
<DisableSpecificWarnings>4127;%(DisableSpecificWarnings)</DisableSpecificWarnings> <WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4127;4456;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,8 @@
#include "connection.h" #include "connection.h"
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif
#define NOMCX #define NOMCX
#define NOSERVICE #define NOSERVICE
#define NOIME #define NOIME

View File

@ -1,7 +1,9 @@
#include "discord_rpc.h" #include "discord_rpc.h"
#include "discord_register.h" #include "discord_register.h"
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif
#define NOMCX #define NOMCX
#define NOSERVICE #define NOSERVICE
#define NOIME #define NOIME

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="duktape"
ProjectGUID=""
RootNamespace="duktape"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="4"
InheritedPropertySheets="..\..\..\PropertySheets\Win32.Debug.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
WarningLevel="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="4"
InheritedPropertySheets="..\..\..\PropertySheets\Win32.Release.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
WarningLevel="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;fi;fd"
>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
>
</Filter>
<Filter
Name="Minizip"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -34,7 +34,7 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings> <DisableSpecificWarnings>
</DisableSpecificWarnings> </DisableSpecificWarnings>
</ClCompile> </ClCompile>

View File

@ -34,9 +34,8 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4100;4127;4131;4189;4244;4701;4703;4996</DisableSpecificWarnings> <DisableSpecificWarnings>4005;4006;4100;4127;4131;4189;4244;4701;4703;4996</DisableSpecificWarnings>
<!-- Fix for later VC versions on XP: 45KB + 436 --> <!-- Fix for later VC versions on XP: 45KB + 436 -->
<PreprocessorDefinitions>Z_BUFSIZE=46516;$(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>Z_BUFSIZE=46516;$(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
@ -59,8 +58,6 @@
<ClCompile Include="zutil.c" /> <ClCompile Include="zutil.c" />
<ClCompile Include="contrib\minizip\ioapi.c" /> <ClCompile Include="contrib\minizip\ioapi.c" />
<ClCompile Include="contrib\minizip\iowin32.c" /> <ClCompile Include="contrib\minizip\iowin32.c" />
<ClCompile Include="contrib\minizip\miniunz.c" />
<ClCompile Include="contrib\minizip\minizip.c" />
<ClCompile Include="contrib\minizip\mztools.c" /> <ClCompile Include="contrib\minizip\mztools.c" />
<ClCompile Include="contrib\minizip\unzip.c" /> <ClCompile Include="contrib\minizip\unzip.c" />
<ClCompile Include="contrib\minizip\zip.c" /> <ClCompile Include="contrib\minizip\zip.c" />

View File

@ -78,12 +78,6 @@
<ClCompile Include="contrib\minizip\zip.c"> <ClCompile Include="contrib\minizip\zip.c">
<Filter>Minizip</Filter> <Filter>Minizip</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="contrib\minizip\miniunz.c">
<Filter>Minizip</Filter>
</ClCompile>
<ClCompile Include="contrib\minizip\minizip.c">
<Filter>Minizip</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="crc32.h"> <ClInclude Include="crc32.h">

View File

@ -33,6 +33,8 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

View File

@ -107,15 +107,15 @@ void MD5::update(const uint1 *input, uint4 input_length)
void MD5::update(FILE *file) void MD5::update(FILE *file)
{ {
unsigned char buffer[1024]; unsigned char update_buffer[1024];
int len; int len;
do do
{ {
len = (int)fread(buffer, 1, 1024, file); len = (int)fread(update_buffer, 1, 1024, file);
if (len) if (len)
{ {
update(buffer, len); update(update_buffer, len);
} }
} while (len); } while (len);

View File

@ -53,7 +53,7 @@ void CEnhancements::ApplyActive(CMipsMemoryVM & MMU, bool UpdateChanges)
} }
} }
void CEnhancements::ApplyGSButton(CMipsMemoryVM & MMU, bool UpdateChanges) void CEnhancements::ApplyGSButton(CMipsMemoryVM & MMU, bool /*UpdateChanges*/)
{ {
for (size_t i = 0, n = m_ActiveCodes.size(); i < n; i++) for (size_t i = 0, n = m_ActiveCodes.size(); i < n; i++)
{ {

View File

@ -2232,7 +2232,7 @@ void R4300iOp::REGIMM_TGEIU()
int64_t imm64; int64_t imm64;
imm64 = imm32; imm64 = imm32;
if (_GPR[m_Opcode.rs].DW >= (uint64_t)imm64) if (_GPR[m_Opcode.rs].UDW >= (uint64_t)imm64)
{ {
g_Reg->DoTrapException(m_NextInstruction == JUMP); g_Reg->DoTrapException(m_NextInstruction == JUMP);
} }
@ -2252,7 +2252,7 @@ void R4300iOp::REGIMM_TLTIU()
int64_t imm64; int64_t imm64;
imm64 = imm32; imm64 = imm32;
if (_GPR[m_Opcode.rs].DW < (uint64_t)imm64) if (_GPR[m_Opcode.rs].UDW < (uint64_t)imm64)
{ {
g_Reg->DoTrapException(m_NextInstruction == JUMP); g_Reg->DoTrapException(m_NextInstruction == JUMP);
} }

View File

@ -343,13 +343,13 @@ void DiskBMUpdate()
} }
} }
bool DiskBMReadWrite(bool write) bool DiskBMReadWrite(bool /*write*/)
{ {
//Returns true if error //Returns true if error
uint16_t head = ((g_Reg->ASIC_CUR_TK >> 16) / 0x1000) & 1; uint16_t head = ((g_Reg->ASIC_CUR_TK >> 16) / 0x1000) & 1;
uint16_t track = (g_Reg->ASIC_CUR_TK >> 16) & 0xFFF; uint16_t track = (g_Reg->ASIC_CUR_TK >> 16) & 0xFFF;
uint16_t block = dd_start_block; uint16_t block = (uint16_t)dd_start_block;
uint16_t sector = dd_current; uint16_t sector = (uint16_t)dd_current;
uint16_t sectorsize = (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1); uint16_t sectorsize = (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
uint32_t addr = g_Disk->GetDiskAddressBlock(head, track, block, sector, sectorsize); uint32_t addr = g_Disk->GetDiskAddressBlock(head, track, block, sector, sectorsize);

View File

@ -308,7 +308,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
{ {
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
data[i] = gb_cart->rtc_latch_data[gb_cart->ram_bank - 0x08]; data[i] = (uint8_t)(gb_cart->rtc_latch_data[gb_cart->ram_bank - 0x08]);
} }
} }
else else
@ -316,7 +316,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
memoryUpdateMBC3Clock(gb_cart); memoryUpdateMBC3Clock(gb_cart);
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
data[i] = gb_cart->rtc_data[gb_cart->ram_bank - 0x08]; data[i] = (uint8_t)(gb_cart->rtc_data[gb_cart->ram_bank - 0x08]);
} }
} }
} }
@ -390,17 +390,17 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
} }
} }
static void read_gb_cart_mbc4(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_mbc4(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void write_gb_cart_mbc4(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) static void write_gb_cart_mbc4(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void read_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_mbc5(struct gb_cart * gb_cart, uint16_t address, uint8_t * data)
{ {
size_t offset; size_t offset;
@ -468,17 +468,17 @@ static void write_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, const
} }
} }
static void read_gb_cart_mmm01(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_mmm01(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void write_gb_cart_mmm01(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) static void write_gb_cart_mmm01(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void read_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_pocket_cam(struct gb_cart * gb_cart, uint16_t address, uint8_t * data)
{ {
size_t offset; size_t offset;
@ -569,32 +569,32 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
} }
} }
static void read_gb_cart_bandai_tama5(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_bandai_tama5(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void write_gb_cart_bandai_tama5(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) static void write_gb_cart_bandai_tama5(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void read_gb_cart_huc1(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_huc1(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void write_gb_cart_huc1(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) static void write_gb_cart_huc1(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void read_gb_cart_huc3(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_huc3(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
static void write_gb_cart_huc3(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) static void write_gb_cart_huc3(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }

View File

@ -516,7 +516,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
{ {
case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break; case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break;
case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break; case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break;
case PLUGIN_TANSFER_PAK: Transferpak::ReadFrom(address, data); break; case PLUGIN_TANSFER_PAK: Transferpak::ReadFrom((uint16_t)address, data); break;
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break; case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
default: default:
memset(&Command[5], 0, 0x20); memset(&Command[5], 0, 0x20);
@ -548,7 +548,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
g_Notify->DisplayError("What am I meant to do with this Controller Command"); g_Notify->DisplayError("What am I meant to do with this Controller Command");
} }
} }
if (Controllers[Control].Present == true) if (Controllers[Control].Present != 0)
{ {
uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0); uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0);
uint8_t* data = &Command[5]; uint8_t* data = &Command[5];
@ -557,7 +557,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
{ {
case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break; case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break;
case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break; case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break;
case PLUGIN_TANSFER_PAK: Transferpak::WriteTo(address, data); break; case PLUGIN_TANSFER_PAK: Transferpak::WriteTo((uint16_t)address, data); break;
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break; case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
} }

View File

@ -46,10 +46,8 @@ bool CSram::LoadSram()
return true; return true;
} }
void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len) void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len)
{ {
uint32_t i;
if (!m_File.IsOpen()) if (!m_File.IsOpen())
{ {
if (!LoadSram()) if (!LoadSram())
@ -68,7 +66,7 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len)
} }
else else
{ {
for (i = 0; i < len; i++) for (uint32_t i = 0; i < len; i++)
{ {
m_File.Seek((StartOffset + i) ^ 3, CFile::begin); m_File.Seek((StartOffset + i) ^ 3, CFile::begin);
m_File.Read((uint8_t*)(((uint32_t)dest + i) ^ 3), 1); m_File.Read((uint8_t*)(((uint32_t)dest + i) ^ 3), 1);
@ -76,10 +74,8 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len)
} }
} }
void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, int32_t len) void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len)
{ {
uint32_t i;
if (m_ReadOnly) if (m_ReadOnly)
{ {
return; return;
@ -103,7 +99,7 @@ void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, int32_t len)
} }
else else
{ {
for (i = 0; i < len; i++) for (uint32_t i = 0; i < len; i++)
{ {
m_File.Seek((StartOffset + i) ^ 3, CFile::begin); m_File.Seek((StartOffset + i) ^ 3, CFile::begin);
m_File.Write((uint8_t*)(((uint32_t)Source + i) ^ 3), 1); m_File.Write((uint8_t*)(((uint32_t)Source + i) ^ 3), 1);

View File

@ -16,8 +16,8 @@ public:
CSram(bool ReadOnly); CSram(bool ReadOnly);
~CSram(); ~CSram();
void DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len); void DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len);
void DmaToSram(uint8_t * Source, int32_t StartOffset, int32_t len); void DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len);
private: private:
CSram(void); // Disable default constructor CSram(void); // Disable default constructor

View File

@ -914,7 +914,6 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
bool CN64System::SetActiveSystem(bool bActive) bool CN64System::SetActiveSystem(bool bActive)
{ {
bool bReset = false;
bool bRes = true; bool bRes = true;
if (bActive && g_System == this) if (bActive && g_System == this)

View File

@ -645,14 +645,18 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b
if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0) if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0)
{ {
uint16_t block = offset / (BLOCKSIZE(0)); uint16_t AddressBlock = (uint16_t)(offset / (BLOCKSIZE(0)));
uint16_t block_sys = m_DiskSysAddress / (BLOCKSIZE(0)); uint16_t block_sys = (uint16_t)(m_DiskSysAddress / (BLOCKSIZE(0)));
uint16_t block_id = m_DiskIDAddress / (BLOCKSIZE(0)); uint16_t block_id = (uint16_t)(m_DiskIDAddress / (BLOCKSIZE(0)));
if (block < 12 && block != block_sys) if (AddressBlock < 12 && AddressBlock != block_sys)
{
offset = 0xFFFFFFFF; offset = 0xFFFFFFFF;
else if (block > 12 && block < 16 && block != block_id) }
else if (AddressBlock > 12 && AddressBlock < 16 && AddressBlock != block_id)
{
offset = 0xFFFFFFFF; offset = 0xFFFFFFFF;
}
} }
} }
else if (m_DiskFormat == DiskFormatSDK) else if (m_DiskFormat == DiskFormatSDK)
@ -662,14 +666,18 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b
if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0) if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0)
{ {
uint16_t block = offset / (BLOCKSIZE(0)); uint16_t AddressBlock = (uint16_t)(offset / (BLOCKSIZE(0)));
uint16_t block_sys = m_DiskSysAddress / (BLOCKSIZE(0)); uint16_t block_sys = (uint16_t)(m_DiskSysAddress / (BLOCKSIZE(0)));
uint16_t block_id = m_DiskIDAddress / (BLOCKSIZE(0)); uint16_t block_id = (uint16_t)(m_DiskIDAddress / (BLOCKSIZE(0)));
if (block < 12 && block != block_sys) if (AddressBlock < 12 && AddressBlock != block_sys)
{
offset = 0xFFFFFFFF; offset = 0xFFFFFFFF;
else if (block > 12 && block < 16 && block != block_id) }
else if (AddressBlock > 12 && AddressBlock < 16 && AddressBlock != block_id)
{
offset = 0xFFFFFFFF; offset = 0xFFFFFFFF;
}
} }
} }
else else
@ -771,7 +779,7 @@ bool CN64Disk::IsSysSectorGood(uint32_t block, uint32_t sectorsize)
//Checks if all sectors are identical (meant only to be used for System Area for MAME and SDK formats) //Checks if all sectors are identical (meant only to be used for System Area for MAME and SDK formats)
for (int j = 1; j < SECTORS_PER_BLOCK; j++) for (int j = 1; j < SECTORS_PER_BLOCK; j++)
{ {
for (int k = 0; k < sectorsize; k++) for (uint32_t k = 0; k < sectorsize; k++)
{ {
if (m_DiskImage[(block * 0x4D08) + (j * sectorsize) + k] != m_DiskImage[(block * 0x4D08) + k]) if (m_DiskImage[(block * 0x4D08) + (j * sectorsize) + k] != m_DiskImage[(block * 0x4D08) + k])
{ {
@ -889,6 +897,7 @@ uint32_t CN64Disk::LBAToVZone(uint32_t lba)
return vzone; return vzone;
} }
} }
return 0;
}; };
uint32_t CN64Disk::LBAToByte(uint32_t lba, uint32_t nlbas) uint32_t CN64Disk::LBAToByte(uint32_t lba, uint32_t nlbas)
@ -896,7 +905,7 @@ uint32_t CN64Disk::LBAToByte(uint32_t lba, uint32_t nlbas)
bool init_flag = true; bool init_flag = true;
uint32_t totalbytes = 0; uint32_t totalbytes = 0;
uint32_t blocksize = 0; uint32_t blocksize = 0;
uint32_t vzone, pzone = 0; uint32_t vzone = 0, pzone = 0;
if (nlbas != 0) if (nlbas != 0)
{ {
for (; nlbas != 0; nlbas--) for (; nlbas != 0; nlbas--)
@ -935,7 +944,7 @@ uint16_t CN64Disk::LBAToPhys(uint32_t lba)
block = 0; block = 0;
//Get Virtual & Physical Disk Zones //Get Virtual & Physical Disk Zones
uint16_t vzone = LBAToVZone(lba); uint16_t vzone = (uint16_t)LBAToVZone(lba);
uint16_t pzone = VZoneToPZone(vzone, m_DiskType); uint16_t pzone = VZoneToPZone(vzone, m_DiskType);
//Get Disk Head //Get Disk Head
@ -952,7 +961,7 @@ uint16_t CN64Disk::LBAToPhys(uint32_t lba)
vzone_lba = VZONE_LBA_TBL[m_DiskType][vzone - 1]; vzone_lba = VZONE_LBA_TBL[m_DiskType][vzone - 1];
//Calculate Physical Track //Calculate Physical Track
uint16_t track = (lba - vzone_lba) >> 1; uint16_t track = (uint16_t)((lba - vzone_lba) >> 1);
//Get the start track from current zone //Get the start track from current zone
uint16_t track_zone_start = SCYL_ZONE_TBL[0][pzone]; uint16_t track_zone_start = SCYL_ZONE_TBL[0][pzone];

View File

@ -319,12 +319,12 @@ void CX86RegInfo::Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Forma
else else
{ {
x86FpuValues RegPos = x86_ST_Unknown; x86FpuValues RegPos = x86_ST_Unknown;
for (uint32_t i = 0; i < 8; i++) for (uint32_t z = 0; z < 8; z++)
{ {
if (m_x86fpu_MappedTo[i] == Reg) if (m_x86fpu_MappedTo[z] == Reg)
{ {
RegPos = (x86FpuValues)i; RegPos = (x86FpuValues)i;
i = 8; z = 8;
} }
} }

View File

@ -18,9 +18,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> // offsetof #include <stddef.h> // offsetof
#include <Common/MemTest.h> #include <Common/MemTest.h>
#include "rdp.h"
#include "Config.h" #include "Config.h"
#include "Settings.h" #include "Settings.h"
#include "rdp.h"
#if defined __VISUALC__ #if defined __VISUALC__
#define GLIDE64_TRY __try #define GLIDE64_TRY __try

View File

@ -11,6 +11,11 @@
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
****************************************************************************/ ****************************************************************************/
#ifdef _WIN32
#include <Windows.h>
#include <commctrl.h>
#endif
#include <Project64-video/Renderer/Renderer.h> #include <Project64-video/Renderer/Renderer.h>
#include <string.h> #include <string.h>
#include <Common/StdString.h> #include <Common/StdString.h>
@ -35,12 +40,6 @@
#include "DepthBufferRender.h" #include "DepthBufferRender.h"
#include "trace.h" #include "trace.h"
#include "ScreenResolution.h" #include "ScreenResolution.h"
#ifdef _WIN32
#include <Windows.h>
#include <commctrl.h>
#endif
#include <stdarg.h> #include <stdarg.h>
#ifdef ANDROID #ifdef ANDROID

View File

@ -44,6 +44,7 @@
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">NO_ASM;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">NO_ASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)'=='Debug'">RDP_LOGGING;RDP_ERROR_LOG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)'=='Debug'">RDP_LOGGING;RDP_ERROR_LOG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader /> <PrecompiledHeader />
<DisableSpecificWarnings>4611</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(SolutionDir)Source\Script\UpdateVersion.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)Source\Project64-video\Version.h.in" "$(SolutionDir)Source\Project64-video\Version.h"</Command> <Command>"$(SolutionDir)Source\Script\UpdateVersion.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)Source\Project64-video\Version.h.in" "$(SolutionDir)Source\Project64-video\Version.h"</Command>

View File

@ -1561,8 +1561,8 @@ bool gfxLfbReadRegion(gfxBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, ui
{ {
unsigned char *buf; unsigned char *buf;
unsigned int i, j; unsigned int i, j;
unsigned short *frameBuffer = (unsigned short*)dst_data; unsigned short *TargetFrameBuffer = (unsigned short*)dst_data;
unsigned short *depthBuffer = (unsigned short*)dst_data; unsigned short *TargetDepthBuffer = (unsigned short*)dst_data;
WriteTrace(TraceGlitch, TraceDebug, "src_buffer: %d src_x: %d src_y: %d src_width: %d src_height: %d dst_stride: %d", src_buffer, src_x, src_y, src_width, src_height, dst_stride); WriteTrace(TraceGlitch, TraceDebug, "src_buffer: %d src_x: %d src_y: %d src_width: %d src_height: %d dst_stride: %d", src_buffer, src_x, src_y, src_width, src_height, dst_stride);
switch (src_buffer) switch (src_buffer)
@ -1590,7 +1590,7 @@ bool gfxLfbReadRegion(gfxBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, ui
{ {
for (i = 0; i < src_width; i++) for (i = 0; i < src_width; i++)
{ {
frameBuffer[j*(dst_stride / 2) + i] = TargetFrameBuffer[j*(dst_stride / 2) + i] =
((buf[(src_height - j - 1)*src_width * 4 + i * 4 + 0] >> 3) << 11) | ((buf[(src_height - j - 1)*src_width * 4 + i * 4 + 0] >> 3) << 11) |
((buf[(src_height - j - 1)*src_width * 4 + i * 4 + 1] >> 2) << 5) | ((buf[(src_height - j - 1)*src_width * 4 + i * 4 + 1] >> 2) << 5) |
(buf[(src_height - j - 1)*src_width * 4 + i * 4 + 2] >> 3); (buf[(src_height - j - 1)*src_width * 4 + i * 4 + 2] >> 3);
@ -1608,7 +1608,7 @@ bool gfxLfbReadRegion(gfxBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, ui
{ {
for (i = 0; i < src_width; i++) for (i = 0; i < src_width; i++)
{ {
depthBuffer[j*(dst_stride / 2) + i] = TargetDepthBuffer[j*(dst_stride / 2) + i] =
((unsigned short*)buf)[(src_height - j - 1)*src_width * 4 + i * 4]; ((unsigned short*)buf)[(src_height - j - 1)*src_width * 4 + i * 4];
} }
} }

View File

@ -11,10 +11,10 @@
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Settings/Settings.h> #include <Settings/Settings.h>
#include <Project64-video/trace.h> #include <Project64-video/trace.h>
#include "Gfx_1.3.h"
#include "ScreenResolution.h" #include "ScreenResolution.h"
#include "SettingsID.h" #include "SettingsID.h"
#include "trace.h" #include "trace.h"
#include "Gfx_1.3.h"
CSettings::CSettings() : CSettings::CSettings() :
m_Set_basic_mode(0), m_Set_basic_mode(0),
@ -749,7 +749,7 @@ void CSettings::ReadGameSettings(const char * name)
m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0; m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0;
m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0; m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0;
m_force_calc_sphere = GetSetting(Set_force_calc_sphere) != 0; m_force_calc_sphere = GetSetting(Set_force_calc_sphere) != 0;
m_correct_viewport = GetSetting(Set_correct_viewport); m_correct_viewport = GetSetting(Set_correct_viewport) != 0;
m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0;
m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0;
m_texture_correction = GetSetting(Set_texture_correction) != 0; m_texture_correction = GetSetting(Set_texture_correction) != 0;
@ -762,9 +762,9 @@ void CSettings::ReadGameSettings(const char * name)
m_clip_zmin = GetSetting(Set_clip_zmin) != 0; m_clip_zmin = GetSetting(Set_clip_zmin) != 0;
m_clip_zmax = GetSetting(Set_clip_zmax) != 0; m_clip_zmax = GetSetting(Set_clip_zmax) != 0;
m_fast_crc = GetSetting(Set_fast_crc) != 0; m_fast_crc = GetSetting(Set_fast_crc) != 0;
m_adjust_aspect = GetSetting(Set_adjust_aspect); m_adjust_aspect = GetSetting(Set_adjust_aspect) != 0;
m_zmode_compare_less = GetSetting(Set_zmode_compare_less); m_zmode_compare_less = GetSetting(Set_zmode_compare_less) != 0;
m_old_style_adither = GetSetting(Set_old_style_adither); m_old_style_adither = GetSetting(Set_old_style_adither) != 0;
m_n64_z_scale = GetSetting(Set_n64_z_scale) != 0; m_n64_z_scale = GetSetting(Set_n64_z_scale) != 0;
m_RdramSize = GetSystemSetting(m_Set_RDRamSize); m_RdramSize = GetSystemSetting(m_Set_RDRamSize);
@ -772,7 +772,7 @@ void CSettings::ReadGameSettings(const char * name)
if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); } if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); }
//frame buffer //frame buffer
short fb_Settings[] = VideoSettings fb_Settings[] =
{ {
g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default, g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default,
Set_ignore_aux_copy, Set_ignore_aux_copy,
@ -945,12 +945,7 @@ void CSettings::LogLevelChanged(void)
g_ModuleLogLevel[TraceRDPCommands] = GetSetting(Set_Logging_RDPCommands); g_ModuleLogLevel[TraceRDPCommands] = GetSetting(Set_Logging_RDPCommands);
} }
#ifdef _WIN32
#include <Windows.h>
#endif
void UseUnregisteredSetting(int /*SettingID*/) void UseUnregisteredSetting(int /*SettingID*/)
{ {
#ifdef _WIN32 g_Notify->BreakPoint(__FILE__, __LINE__);
DebugBreak();
#endif
} }

View File

@ -10,7 +10,7 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
enum enum VideoSettings : uint16_t
{ {
// General Settings // General Settings
Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM, Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM,

View File

@ -35,10 +35,10 @@ void Texture2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch
uint32 g1; uint32 g1;
uint32 r1; uint32 r1;
uint32 a1; uint32 a1;
uint32 b2; uint32 b2 = 0;
uint32 g2; uint32 g2 = 0;
uint32 r2; uint32 r2 = 0;
uint32 a2; uint32 a2 = 0;
uint32 b3; uint32 b3;
uint32 g3; uint32 g3;
uint32 r3; uint32 r3;

View File

@ -1188,7 +1188,7 @@ TxQuantize::ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height
/* Floyd-Steinberg error-diffusion halftoning */ /* Floyd-Steinberg error-diffusion halftoning */
int i, x, y; int i, x, y;
int qr, qg, qb; /* quantized incoming values */ int qr = 0, qg = 0, qb = 0; /* quantized incoming values */
int ir, ig, ib; /* incoming values */ int ir, ig, ib; /* incoming values */
int t; int t;
int *errR = new int[width]; int *errR = new int[width];
@ -1397,7 +1397,7 @@ TxQuantize::ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int heig
bool ditherAlpha = 0; bool ditherAlpha = 0;
int i, x, y; int i, x, y;
int qr, qg, qb, qa; /* quantized incoming values */ int qr = 0, qg = 0, qb = 0, qa = 0; /* quantized incoming values */
int ir, ig, ib, ia; /* incoming values */ int ir, ig, ib, ia; /* incoming values */
int t; int t;
int *errR = new int[width]; int *errR = new int[width];

View File

@ -17,6 +17,7 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <Common\stdtypes.h>
#include "types.h" #include "types.h"
#include "internal.h" #include "internal.h"
@ -868,7 +869,7 @@ dxt5_rgba_decode_1(const void *texture, int stride,
rgba[ACOMP] = alpha1; rgba[ACOMP] = alpha1;
} }
else if (alpha0 > alpha1) { else if (alpha0 > alpha1) {
rgba[ACOMP] = ((8 - acode) * alpha0 + (acode - 1) * alpha1) / 7; rgba[ACOMP] = (uint8_t)(((8 - acode) * alpha0 + (acode - 1) * alpha1) / 7);
} }
else if (acode == 6) { else if (acode == 6) {
rgba[ACOMP] = 0; rgba[ACOMP] = 0;
@ -877,6 +878,6 @@ dxt5_rgba_decode_1(const void *texture, int stride,
rgba[ACOMP] = 255; rgba[ACOMP] = 255;
} }
else { else {
rgba[ACOMP] = ((6 - acode) * alpha0 + (acode - 1) * alpha1) / 5; rgba[ACOMP] = (uint8_t)(((6 - acode) * alpha0 + (acode - 1) * alpha1) / 5);
} }
} }

View File

@ -1320,13 +1320,13 @@ void rdp_texrect()
#define SIGN16(x) (((x) & 0x8000) ? ((x) | ~0xffff) : ((x) & 0xffff)) #define SIGN16(x) (((x) & 0x8000) ? ((x) | ~0xffff) : ((x) & 0xffff))
//calculate texture coordinates //calculate texture coordinates
for (int i = 0; i < 2; i++) for (int z = 0; z < 2; z++)
{ {
if (rdp.cur_cache[i] && (rdp.tex & (i + 1))) if (rdp.cur_cache[z] && (rdp.tex & (z + 1)))
{ {
float sx = 1, sy = 1; float sx = 1, sy = 1;
int x_i = off_x_i, y_i = off_y_i; int x_i = off_x_i, y_i = off_y_i;
TILE & tile = rdp.tiles(rdp.cur_tile + i); TILE & tile = rdp.tiles(rdp.cur_tile + z);
//shifting //shifting
if (tile.shift_s) if (tile.shift_s)
{ {
@ -1359,7 +1359,7 @@ void rdp_texrect()
} }
} }
if (rdp.aTBuffTex[i]) //hwfbe texture if (rdp.aTBuffTex[z]) //hwfbe texture
{ {
float t0_off_x; float t0_off_x;
float t0_off_y; float t0_off_y;
@ -1373,42 +1373,42 @@ void rdp_texrect()
t0_off_x = off_x_i / 32.0f; t0_off_x = off_x_i / 32.0f;
t0_off_y = off_y_i / 32.0f; t0_off_y = off_y_i / 32.0f;
} }
t0_off_x += rdp.aTBuffTex[i]->u_shift;// + tile.ul_s; //commented for Paper Mario motion blur t0_off_x += rdp.aTBuffTex[z]->u_shift;// + tile.ul_s; //commented for Paper Mario motion blur
t0_off_y += rdp.aTBuffTex[i]->v_shift;// + tile.ul_t; t0_off_y += rdp.aTBuffTex[z]->v_shift;// + tile.ul_t;
texUV[i].ul_u = t0_off_x * sx; texUV[z].ul_u = t0_off_x * sx;
texUV[i].ul_v = t0_off_y * sy; texUV[z].ul_v = t0_off_y * sy;
texUV[i].lr_u = texUV[i].ul_u + off_size_x * sx; texUV[z].lr_u = texUV[z].ul_u + off_size_x * sx;
texUV[i].lr_v = texUV[i].ul_v + off_size_y * sy; texUV[z].lr_v = texUV[z].ul_v + off_size_y * sy;
texUV[i].ul_u *= rdp.aTBuffTex[i]->u_scale; texUV[z].ul_u *= rdp.aTBuffTex[z]->u_scale;
texUV[i].ul_v *= rdp.aTBuffTex[i]->v_scale; texUV[z].ul_v *= rdp.aTBuffTex[z]->v_scale;
texUV[i].lr_u *= rdp.aTBuffTex[i]->u_scale; texUV[z].lr_u *= rdp.aTBuffTex[z]->u_scale;
texUV[i].lr_v *= rdp.aTBuffTex[i]->v_scale; texUV[z].lr_v *= rdp.aTBuffTex[z]->v_scale;
WriteTrace(TraceRDP, TraceDebug, "tbuff_tex[%d] ul_u: %f, ul_v: %f, lr_u: %f, lr_v: %f", WriteTrace(TraceRDP, TraceDebug, "tbuff_tex[%d] ul_u: %f, ul_v: %f, lr_u: %f, lr_v: %f",
i, texUV[i].ul_u, texUV[i].ul_v, texUV[i].lr_u, texUV[i].lr_v); z, texUV[z].ul_u, texUV[z].ul_v, texUV[z].lr_u, texUV[z].lr_v);
} }
else //common case else //common case
{ {
//kill 10.5 format overflow by SIGN16 macro //kill 10.5 format overflow by SIGN16 macro
texUV[i].ul_u = SIGN16(x_i) / 32.0f; texUV[z].ul_u = SIGN16(x_i) / 32.0f;
texUV[i].ul_v = SIGN16(y_i) / 32.0f; texUV[z].ul_v = SIGN16(y_i) / 32.0f;
texUV[i].ul_u -= tile.f_ul_s; texUV[z].ul_u -= tile.f_ul_s;
texUV[i].ul_v -= tile.f_ul_t; texUV[z].ul_v -= tile.f_ul_t;
texUV[i].lr_u = texUV[i].ul_u + off_size_x * sx; texUV[z].lr_u = texUV[z].ul_u + off_size_x * sx;
texUV[i].lr_v = texUV[i].ul_v + off_size_y * sy; texUV[z].lr_v = texUV[z].ul_v + off_size_y * sy;
texUV[i].ul_u = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_x * texUV[i].ul_u; texUV[z].ul_u = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_x * texUV[z].ul_u;
texUV[i].lr_u = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_x * texUV[i].lr_u; texUV[z].lr_u = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_x * texUV[z].lr_u;
texUV[i].ul_v = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_y * texUV[i].ul_v; texUV[z].ul_v = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_y * texUV[z].ul_v;
texUV[i].lr_v = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_y * texUV[i].lr_v; texUV[z].lr_v = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_y * texUV[z].lr_v;
} }
} }
else else
{ {
texUV[i].ul_u = texUV[i].ul_v = texUV[i].lr_u = texUV[i].lr_v = 0; texUV[z].ul_u = texUV[z].ul_v = texUV[z].lr_u = texUV[z].lr_v = 0;
} }
} }
rdp.cur_tile = prev_tile; rdp.cur_tile = prev_tile;
@ -1816,20 +1816,20 @@ void rdp_settilesize()
if (tile_set) if (tile_set)
{ {
// coords in 10.2 format // coords in 10.2 format
rdp.tiles(tile).ul_s = ul_s; rdp.tiles(tile).ul_s = (uint16_t)ul_s;
rdp.tiles(tile).ul_t = ul_t; rdp.tiles(tile).ul_t = (uint16_t)ul_t;
rdp.tiles(tile).lr_s = lr_s; rdp.tiles(tile).lr_s = (uint16_t)lr_s;
rdp.tiles(tile).lr_t = lr_t; rdp.tiles(tile).lr_t = (uint16_t)lr_t;
tile_set = 0; tile_set = 0;
} }
} }
else else
{ {
// coords in 10.2 format // coords in 10.2 format
rdp.tiles(tile).ul_s = ul_s; rdp.tiles(tile).ul_s = (uint16_t)ul_s;
rdp.tiles(tile).ul_t = ul_t; rdp.tiles(tile).ul_t = (uint16_t)ul_t;
rdp.tiles(tile).lr_s = lr_s; rdp.tiles(tile).lr_s = (uint16_t)lr_s;
rdp.tiles(tile).lr_t = lr_t; rdp.tiles(tile).lr_t = (uint16_t)lr_t;
} }
// handle wrapping // handle wrapping
@ -1914,7 +1914,7 @@ static inline void loadBlock(uint32_t *src, uint32_t *dst, uint32_t off, int dxt
do do
{ {
v10 = __ROL__(v10, 8); v10 = __ROL__(v10, 8);
*(uint8_t *)v5 = v10; *(uint8_t *)v5 = (uint8_t)v10;
v5 = (uint32_t *)((char *)v5 + 1); v5 = (uint32_t *)((char *)v5 + 1);
--v9; --v9;
} while (v9); } while (v9);
@ -1942,7 +1942,7 @@ static inline void loadBlock(uint32_t *src, uint32_t *dst, uint32_t off, int dxt
do do
{ {
v14 = __ROL__(v14, 8); v14 = __ROL__(v14, 8);
*(uint8_t *)v5 = v14; *(uint8_t *)v5 = (uint8_t)v14;
v5 = (uint32_t *)((char *)v5 + 1); v5 = (uint32_t *)((char *)v5 + 1);
--v13; --v13;
} while (v13); } while (v13);
@ -2074,7 +2074,7 @@ void rdp_loadblock()
loadBlock((uint32_t *)gfx.RDRAM, (uint32_t *)dst, off, _dxt, cnt); loadBlock((uint32_t *)gfx.RDRAM, (uint32_t *)dst, off, _dxt, cnt);
rdp.timg.addr += cnt << 3; rdp.timg.addr += cnt << 3;
rdp.tiles(tile).lr_t = ul_t + ((dxt*cnt) >> 11); rdp.tiles(tile).lr_t = (uint16_t)(ul_t + ((dxt*cnt) >> 11));
rdp.update |= UPDATE_TEXTURE; rdp.update |= UPDATE_TEXTURE;
@ -2905,7 +2905,6 @@ void rdp_setcolorimage()
{ {
if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR))) if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR)))
{ {
gfxLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048;
gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT); gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT);
WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0"); WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0");
} }
@ -3235,7 +3234,7 @@ EXPORT void CALL FBRead(uint32_t addr)
uint32_t h = rdp.frame_buffers[0].height; uint32_t h = rdp.frame_buffers[0].height;
rdp.frame_buffers[0].height = rdp.maincimg[1].height; rdp.frame_buffers[0].height = rdp.maincimg[1].height;
CopyFrameBuffer(GFX_BUFFER_FRONTBUFFER); CopyFrameBuffer(GFX_BUFFER_FRONTBUFFER);
rdp.frame_buffers[0].height = h; rdp.frame_buffers[0].height = (uint16_t)h;
} }
else else
{ {
@ -3517,9 +3516,9 @@ void DetectFrameBufferUsage()
{ {
int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0; int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0;
uint32_t height = rdp.frame_buffers[ind].height; uint32_t height = rdp.frame_buffers[ind].height;
rdp.frame_buffers[ind].height = ci_height; rdp.frame_buffers[ind].height = (uint16_t)ci_height;
CopyFrameBuffer(); CopyFrameBuffer();
rdp.frame_buffers[ind].height = height; rdp.frame_buffers[ind].height = (uint16_t)height;
} }
if (rdp.swap_ci_index < 0) if (rdp.swap_ci_index < 0)
{ {
@ -3550,7 +3549,7 @@ void DetectFrameBufferUsage()
uint32_t h = rdp.frame_buffers[0].height; uint32_t h = rdp.frame_buffers[0].height;
rdp.frame_buffers[0].height = rdp.maincimg[0].height; rdp.frame_buffers[0].height = rdp.maincimg[0].height;
CopyFrameBuffer(); CopyFrameBuffer();
rdp.frame_buffers[0].height = h; rdp.frame_buffers[0].height = (uint16_t)h;
} }
else //conker else //conker
{ {
@ -3734,10 +3733,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
(flip/* && xleft > xright*/)) (flip/* && xleft > xright*/))
{ {
if (shade) { if (shade) {
vtx->r = CSCALE(r + drdx*dx); vtx->r = (uint8_t)CSCALE(r + drdx*dx);
vtx->g = CSCALE(g + dgdx*dx); vtx->g = (uint8_t)CSCALE(g + dgdx*dx);
vtx->b = CSCALE(b + dbdx*dx); vtx->b = (uint8_t)CSCALE(b + dbdx*dx);
vtx->a = CSCALE(a + dadx*dx); vtx->a = (uint8_t)CSCALE(a + dadx*dx);
} }
if (texture) { if (texture) {
vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx); vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx);
@ -3753,10 +3752,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
(flip && xleft > xright)) (flip && xleft > xright))
{ {
if (shade) { if (shade) {
vtx->r = CSCALE(r); vtx->r = (uint8_t)CSCALE(r);
vtx->g = CSCALE(g); vtx->g = (uint8_t)CSCALE(g);
vtx->b = CSCALE(b); vtx->b = (uint8_t)CSCALE(b);
vtx->a = CSCALE(a); vtx->a = (uint8_t)CSCALE(a);
} }
if (texture) { if (texture) {
vtx->ou = SSCALE(s, w); vtx->ou = SSCALE(s, w);
@ -3787,10 +3786,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
(flip/* && xleft >= xright*/)) (flip/* && xleft >= xright*/))
{ {
if (shade) { if (shade) {
vtx->r = CSCALE(r + drdx*dx); vtx->r = (uint8_t)CSCALE(r + drdx*dx);
vtx->g = CSCALE(g + dgdx*dx); vtx->g = (uint8_t)CSCALE(g + dgdx*dx);
vtx->b = CSCALE(b + dbdx*dx); vtx->b = (uint8_t)CSCALE(b + dbdx*dx);
vtx->a = CSCALE(a + dadx*dx); vtx->a = (uint8_t)CSCALE(a + dadx*dx);
} }
if (texture) { if (texture) {
vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx); vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx);
@ -3806,10 +3805,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
(flip && xleft >= xright)) (flip && xleft >= xright))
{ {
if (shade) { if (shade) {
vtx->r = CSCALE(r); vtx->r = (uint8_t)CSCALE(r);
vtx->g = CSCALE(g); vtx->g = (uint8_t)CSCALE(g);
vtx->b = CSCALE(b); vtx->b = (uint8_t)CSCALE(b);
vtx->a = CSCALE(a); vtx->a = (uint8_t)CSCALE(a);
} }
if (texture) { if (texture) {
vtx->ou = SSCALE(s, w); vtx->ou = SSCALE(s, w);
@ -3850,10 +3849,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
(flip/* && xleft >= xright*/)) (flip/* && xleft >= xright*/))
{ {
if (shade) { if (shade) {
vtx->r = CSCALE(r + drdx*dx); vtx->r = (uint8_t)CSCALE(r + drdx*dx);
vtx->g = CSCALE(g + dgdx*dx); vtx->g = (uint8_t)CSCALE(g + dgdx*dx);
vtx->b = CSCALE(b + dbdx*dx); vtx->b = (uint8_t)CSCALE(b + dbdx*dx);
vtx->a = CSCALE(a + dadx*dx); vtx->a = (uint8_t)CSCALE(a + dadx*dx);
} }
if (texture) { if (texture) {
vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx); vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx);
@ -3869,10 +3868,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
(flip && xleft >= xright)) (flip && xleft >= xright))
{ {
if (shade) { if (shade) {
vtx->r = CSCALE(r); vtx->r = (uint8_t)CSCALE(r);
vtx->g = CSCALE(g); vtx->g = (uint8_t)CSCALE(g);
vtx->b = CSCALE(b); vtx->b = (uint8_t)CSCALE(b);
vtx->a = CSCALE(a); vtx->a = (uint8_t)CSCALE(a);
} }
if (texture) { if (texture) {
vtx->ou = SSCALE(s, w); vtx->ou = SSCALE(s, w);

View File

@ -433,10 +433,10 @@ void DrawImage(DRAWIMAGE & d)
// ** Load the texture, constant portions have been set above // ** Load the texture, constant portions have been set above
// SetTileSize () // SetTileSize ()
rdp.tiles(0).ul_s = tb_u; rdp.tiles(0).ul_s = (uint16_t)tb_u;
rdp.tiles(0).ul_t = tb_v; rdp.tiles(0).ul_t = (uint16_t)tb_v;
rdp.tiles(0).lr_s = tb_u + x_size - 1; rdp.tiles(0).lr_s = (uint16_t)(tb_u + x_size - 1);
rdp.tiles(0).lr_t = tb_v + y_size - 1; rdp.tiles(0).lr_t = (uint16_t)(tb_v + y_size - 1);
// LoadTile () // LoadTile ()
rdp.cmd0 = ((int)rdp.tiles(0).ul_s << 14) | ((int)rdp.tiles(0).ul_t << 2); rdp.cmd0 = ((int)rdp.tiles(0).ul_s << 14) | ((int)rdp.tiles(0).ul_t << 2);
@ -1354,7 +1354,7 @@ void uc6_sprite2d()
WriteTrace(TraceRDP, TraceDebug, "uc6:uc6_sprite2d #%d, #%d", rdp.tri_n, rdp.tri_n + 1); WriteTrace(TraceRDP, TraceDebug, "uc6:uc6_sprite2d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
uint32_t addr = segoffset(rdp.cmd1) >> 1; uint32_t addr = segoffset(rdp.cmd1) >> 1;
DRAWIMAGE d; DRAWIMAGE d = { 0 };
d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 0) >> 1]); // 0,1 d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 0) >> 1]); // 0,1
uint16_t stride = (((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1]); // 4 uint16_t stride = (((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1]); // 4
@ -1420,9 +1420,9 @@ void uc6_sprite2d()
if (g_settings->hacks(CSettings::hack_WCWnitro)) if (g_settings->hacks(CSettings::hack_WCWnitro))
{ {
int scaleY = (int)d.scaleY; int scaleY = (int)d.scaleY;
d.imageH /= scaleY; d.imageH /= (uint16_t)scaleY;
d.imageY /= scaleY; d.imageY /= (uint16_t)scaleY;
stride *= scaleY; stride *= (uint16_t)scaleY;
d.scaleY = 1.0f; d.scaleY = 1.0f;
} }
WriteTrace(TraceRDP, TraceDebug, "imagePtr: %08lx", d.imagePtr); WriteTrace(TraceRDP, TraceDebug, "imagePtr: %08lx", d.imagePtr);

View File

@ -101,7 +101,7 @@ static void fb_setscissor()
if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (uint32_t)(cur_fb.width >> 1)) if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (uint32_t)(cur_fb.width >> 1))
{ {
if (cur_fb.height == 0 || (cur_fb.width >= rdp.scissor_o.lr_x - 1 && cur_fb.width <= rdp.scissor_o.lr_x + 1)) if (cur_fb.height == 0 || (cur_fb.width >= rdp.scissor_o.lr_x - 1 && cur_fb.width <= rdp.scissor_o.lr_x + 1))
cur_fb.height = rdp.scissor_o.lr_y; cur_fb.height = (uint16_t)rdp.scissor_o.lr_y;
} }
WriteTrace(TraceRDP, TraceDebug, "fb_setscissor. lr_x = %d, lr_y = %d, fb_width = %d, fb_height = %d", rdp.scissor_o.lr_x, rdp.scissor_o.lr_y, cur_fb.width, cur_fb.height); WriteTrace(TraceRDP, TraceDebug, "fb_setscissor. lr_x = %d, lr_y = %d, fb_width = %d, fb_height = %d", rdp.scissor_o.lr_x, rdp.scissor_o.lr_y, cur_fb.width, cur_fb.height);
} }
@ -121,7 +121,7 @@ static void fb_uc2_movemem()
short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] >> 2; short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] >> 2;
uint32_t height = scale_y + trans_y; uint32_t height = scale_y + trans_y;
if (height < rdp.scissor_o.lr_y) if (height < rdp.scissor_o.lr_y)
cur_fb.height = height; cur_fb.height = (uint16_t)height;
} }
} }
} }
@ -140,7 +140,7 @@ static void fb_rect()
if (rdp.frame_buffers[rdp.ci_count - 1].height < lr_y) if (rdp.frame_buffers[rdp.ci_count - 1].height < lr_y)
{ {
WriteTrace(TraceRDP, TraceDebug, "fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count - 1].height, lr_y); WriteTrace(TraceRDP, TraceDebug, "fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count - 1].height, lr_y);
rdp.frame_buffers[rdp.ci_count - 1].height = lr_y; rdp.frame_buffers[rdp.ci_count - 1].height = (uint16_t)lr_y;
} }
} }
} }
@ -169,7 +169,7 @@ static void fb_settextureimage()
rdp.main_ci_last_tex_addr = addr; rdp.main_ci_last_tex_addr = addr;
if (cur_fb.height == 0) if (cur_fb.height == 0)
{ {
cur_fb.height = rdp.scissor_o.lr_y; cur_fb.height = (uint16_t)rdp.scissor_o.lr_y;
rdp.main_ci_end = cur_fb.addr + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1); rdp.main_ci_end = cur_fb.addr + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);
} }
} }
@ -327,7 +327,7 @@ static void fb_setcolorimage()
else if (cur_fb.width == 16) else if (cur_fb.width == 16)
cur_fb.height = 16; cur_fb.height = 16;
else if (rdp.ci_count > 0) else if (rdp.ci_count > 0)
cur_fb.height = rdp.scissor_o.lr_y; cur_fb.height = (uint16_t)rdp.scissor_o.lr_y;
else else
cur_fb.height = 0; cur_fb.height = 0;
cur_fb.format = (rdp.cmd0 >> 21) & 0x7; cur_fb.format = (rdp.cmd0 >> 21) & 0x7;

View File

@ -6,7 +6,7 @@ CAboutDlg::CAboutDlg(CProjectSupport & Support) :
{ {
} }
LRESULT CAboutDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled) LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/)
{ {
m_Logo.SubclassWindow(GetDlgItem(IDC_BMP_LOGO)); m_Logo.SubclassWindow(GetDlgItem(IDC_BMP_LOGO));
m_Logo.SetBitmap(MAKEINTRESOURCE(IDB_ABOUT_LOGO)); m_Logo.SetBitmap(MAKEINTRESOURCE(IDB_ABOUT_LOGO));
@ -59,7 +59,7 @@ void CAboutDlg::SetWindowDetais(int nIDDlgItem, int nAboveIDDlgItem, const wchar
CWindow AboveWnd = GetDlgItem(nAboveIDDlgItem); CWindow AboveWnd = GetDlgItem(nAboveIDDlgItem);
AboveWnd.GetWindowRect(&rcWin); AboveWnd.GetWindowRect(&rcWin);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2);
LONG Top = rcWin.bottom + (8 * DPIScale); LONG Top = rcWin.bottom + (LONG)(8 * DPIScale);
Wnd.GetWindowRect(&rcWin); Wnd.GetWindowRect(&rcWin);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2);
@ -89,7 +89,7 @@ LRESULT CAboutDlg::OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lPar
return TRUE; return TRUE;
} }
LRESULT CAboutDlg::OnOkCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled) LRESULT CAboutDlg::OnOkCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/)
{ {
EndDialog(0); EndDialog(0);
return TRUE; return TRUE;

View File

@ -152,9 +152,9 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
return TRUE; return TRUE;
} }
void CDebugCommandsView::GameCpuRunningChanged(CDebugCommandsView* _this) void CDebugCommandsView::GameCpuRunningChanged(CDebugCommandsView * DebugCommandsView)
{ {
_this->RecompilerCheck(); DebugCommandsView->RecompilerCheck();
} }
void CDebugCommandsView::RecompilerCheck(void) void CDebugCommandsView::RecompilerCheck(void)

View File

@ -16,7 +16,6 @@
CDebugScripts::CDebugScripts(CDebuggerUI* debugger) : CDebugScripts::CDebugScripts(CDebuggerUI* debugger) :
CDebugDialog<CDebugScripts>(debugger), CDebugDialog<CDebugScripts>(debugger),
CToolTipDialog<CDebugScripts>(), CToolTipDialog<CDebugScripts>(),
m_SelectedScriptName(NULL),
m_hQuitScriptDirWatchEvent(NULL), m_hQuitScriptDirWatchEvent(NULL),
m_hScriptDirWatchThread(NULL) m_hScriptDirWatchThread(NULL)
{ {
@ -24,10 +23,6 @@ CDebugScripts::CDebugScripts(CDebuggerUI* debugger) :
CDebugScripts::~CDebugScripts(void) CDebugScripts::~CDebugScripts(void)
{ {
if (m_SelectedScriptName != NULL)
{
free(m_SelectedScriptName);
}
} }
LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
@ -235,10 +230,10 @@ LRESULT CDebugScripts::OnScriptListDblClicked(NMHDR* pNMHDR)
void CDebugScripts::RefreshStatus() void CDebugScripts::RefreshStatus()
{ {
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str());
stdstr statusText; stdstr statusText;
CPath(stdstr_f("Scripts\\%s", m_SelectedScriptName)).GetFullyQualified(statusText); CPath(stdstr_f("Scripts\\%s", m_SelectedScriptName.c_str())).GetFullyQualified(statusText);
if (state == STATE_RUNNING) if (state == STATE_RUNNING)
{ {
@ -267,7 +262,7 @@ LRESULT CDebugScripts::OnScriptListRClicked(NMHDR* pNMHDR)
return 0; return 0;
} }
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str());
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_SCRIPT_POPUP)); HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_SCRIPT_POPUP));
HMENU hPopupMenu = GetSubMenu(hMenu, 0); HMENU hPopupMenu = GetSubMenu(hMenu, 0);
@ -338,15 +333,9 @@ LRESULT CDebugScripts::OnScriptListItemChanged(NMHDR* pNMHDR)
wchar_t ScriptName[MAX_PATH]; wchar_t ScriptName[MAX_PATH];
m_ScriptList.GetItemText(lpStateChange->iItem, 1, ScriptName, MAX_PATH); m_ScriptList.GetItemText(lpStateChange->iItem, 1, ScriptName, MAX_PATH);
m_SelectedScriptName = stdstr().FromUTF16(ScriptName).c_str();
if (m_SelectedScriptName != NULL) INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str());
{
free(m_SelectedScriptName);
}
m_SelectedScriptName = strdup(stdstr().FromUTF16(ScriptName).c_str());
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName);
::EnableWindow(GetDlgItem(IDC_STOP_BTN), state == STATE_RUNNING || state == STATE_STARTED); ::EnableWindow(GetDlgItem(IDC_STOP_BTN), state == STATE_RUNNING || state == STATE_STARTED);
::EnableWindow(GetDlgItem(IDC_RUN_BTN), state == STATE_STOPPED || state == STATE_INVALID); ::EnableWindow(GetDlgItem(IDC_RUN_BTN), state == STATE_STOPPED || state == STATE_INVALID);
@ -437,27 +426,27 @@ LRESULT CDebugScripts::OnRefreshList(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
void CDebugScripts::EvaluateInSelectedInstance(const char* code) void CDebugScripts::EvaluateInSelectedInstance(const char* code)
{ {
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str());
if (state == STATE_RUNNING || state == STATE_STARTED) if (state == STATE_RUNNING || state == STATE_STARTED)
{ {
CScriptInstance* instance = m_Debugger->ScriptSystem()->GetInstance(m_SelectedScriptName); CScriptInstance* instance = m_Debugger->ScriptSystem()->GetInstance(m_SelectedScriptName.c_str());
instance->Eval(code); instance->Eval(code);
} }
} }
void CDebugScripts::RunSelected() void CDebugScripts::RunSelected()
{ {
if (m_SelectedScriptName == NULL) if (m_SelectedScriptName.empty())
{ {
return; return;
} }
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str());
if (state == STATE_INVALID || state == STATE_STOPPED) if (state == STATE_INVALID || state == STATE_STOPPED)
{ {
m_Debugger->ScriptSystem()->RunScript(m_SelectedScriptName); m_Debugger->ScriptSystem()->RunScript(m_SelectedScriptName.c_str());
} }
else else
{ {
@ -467,12 +456,12 @@ void CDebugScripts::RunSelected()
void CDebugScripts::StopSelected() void CDebugScripts::StopSelected()
{ {
m_Debugger->ScriptSystem()->StopScript(m_SelectedScriptName); m_Debugger->ScriptSystem()->StopScript(m_SelectedScriptName.c_str());
} }
void CDebugScripts::ToggleSelected() void CDebugScripts::ToggleSelected()
{ {
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str());
if (state == STATE_INVALID || state == STATE_STOPPED) if (state == STATE_INVALID || state == STATE_STOPPED)
{ {

View File

@ -13,6 +13,7 @@
#include "DebuggerUI.h" #include "DebuggerUI.h"
#include "ScriptSystem.h" #include "ScriptSystem.h"
#include <Project64/UserInterface/WTLControls/TooltipDialog.h> #include <Project64/UserInterface/WTLControls/TooltipDialog.h>
#include <string>
class CScriptList : public CListViewCtrl class CScriptList : public CListViewCtrl
{ {
@ -94,7 +95,7 @@ private:
CEditConsole m_ConsoleEdit; CEditConsole m_ConsoleEdit;
CScriptList m_ScriptList; CScriptList m_ScriptList;
CStatusBarCtrl m_StatusBar; CStatusBarCtrl m_StatusBar;
char* m_SelectedScriptName; std::string m_SelectedScriptName;
HANDLE m_hQuitScriptDirWatchEvent; HANDLE m_hQuitScriptDirWatchEvent;
HANDLE m_hScriptDirWatchThread; HANDLE m_hScriptDirWatchThread;

View File

@ -94,7 +94,7 @@ void CDebugStackView::Refresh()
for (int i = 0; i < 0x10; i++) for (int i = 0; i < 0x10; i++)
{ {
wchar_t t[4]; wchar_t t[4];
swprintf(t, L"%02X", i * 0x10); swprintf(t, sizeof(t) / sizeof(t[0]), L"%02X", i * 0x10);
m_StackList.AddItem(i, 0, t); m_StackList.AddItem(i, 0, t);
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)

View File

@ -203,10 +203,10 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
switch (symbol.m_Type) switch (symbol.m_Type)
{ {
case SYM_U8: case SYM_U8:
m_Debugger->DebugStore_VAddr<uint8_t>(symbol.m_Address, atoi(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<uint8_t>(symbol.m_Address, (uint8_t)atoi(EnteredString.c_str()));
break; break;
case SYM_U16: case SYM_U16:
m_Debugger->DebugStore_VAddr<uint16_t>(symbol.m_Address, atoi(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<uint16_t>(symbol.m_Address, (uint16_t)atoi(EnteredString.c_str()));
break; break;
case SYM_U32: case SYM_U32:
m_Debugger->DebugStore_VAddr<uint32_t>(symbol.m_Address, atoi(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<uint32_t>(symbol.m_Address, atoi(EnteredString.c_str()));
@ -215,10 +215,10 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
m_Debugger->DebugStore_VAddr<uint64_t>(symbol.m_Address, atoll(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<uint64_t>(symbol.m_Address, atoll(EnteredString.c_str()));
break; break;
case SYM_S8: case SYM_S8:
m_Debugger->DebugStore_VAddr<int8_t>(symbol.m_Address, atoi(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<int8_t>(symbol.m_Address, (int8_t)atoi(EnteredString.c_str()));
break; break;
case SYM_S16: case SYM_S16:
m_Debugger->DebugStore_VAddr<int16_t>(symbol.m_Address, atoi(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<int16_t>(symbol.m_Address, (int16_t)atoi(EnteredString.c_str()));
break; break;
case SYM_S32: case SYM_S32:
m_Debugger->DebugStore_VAddr<int>(symbol.m_Address, atoi(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<int>(symbol.m_Address, atoi(EnteredString.c_str()));
@ -227,7 +227,7 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
m_Debugger->DebugStore_VAddr<int64_t>(symbol.m_Address, atoll(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<int64_t>(symbol.m_Address, atoll(EnteredString.c_str()));
break; break;
case SYM_FLOAT: case SYM_FLOAT:
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, (float)atof(EnteredString.c_str()));
break; break;
case SYM_DOUBLE: case SYM_DOUBLE:
m_Debugger->DebugStore_VAddr<double>(symbol.m_Address, atof(EnteredString.c_str())); m_Debugger->DebugStore_VAddr<double>(symbol.m_Address, atof(EnteredString.c_str()));
@ -236,46 +236,46 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
x = EnteredString.c_str(); x = EnteredString.c_str();
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, (float)atof(szValue));
x = x + (y - x) + 1; x = x + (y - x) + 1;
memcpy(szValue, x, strlen(x)); memcpy(szValue, x, strlen(x));
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), (float)atof(szValue));
break; break;
case SYM_VECTOR3: case SYM_VECTOR3:
x = EnteredString.c_str(); x = EnteredString.c_str();
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, (float)atof(szValue));
x = x + (y - x) + 1; x = x + (y - x) + 1;
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), (float)atof(szValue));
x = x + (y - x) + 1; x = x + (y - x) + 1;
memcpy(szValue, x, strlen(x)); memcpy(szValue, x, strlen(x));
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 2), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 2), (float)atof(szValue));
break; break;
case SYM_VECTOR4: case SYM_VECTOR4:
x = EnteredString.c_str(); x = EnteredString.c_str();
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, (float)atof(szValue));
x = x + (y - x) + 1; x = x + (y - x) + 1;
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), (float)atof(szValue));
x = x + (y - x) + 1; x = x + (y - x) + 1;
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 2), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 2), (float)atof(szValue));
x = x + (y - x) + 1; x = x + (y - x) + 1;
memcpy(szValue, x, strlen(x)); memcpy(szValue, x, strlen(x));
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 3), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 3), (float)atof(szValue));
break; break;
} }
} }

View File

@ -68,7 +68,7 @@ const char* CScriptSystem::APIScript()
return m_APIScript; return m_APIScript;
} }
void CScriptSystem::RunScript(char* path) void CScriptSystem::RunScript(const char * path)
{ {
CGuard guard(m_CS); CGuard guard(m_CS);
CScriptInstance* scriptInstance = new CScriptInstance(m_Debugger); CScriptInstance* scriptInstance = new CScriptInstance(m_Debugger);
@ -79,7 +79,7 @@ void CScriptSystem::RunScript(char* path)
scriptInstance->Start(pathSaved); scriptInstance->Start(pathSaved);
} }
void CScriptSystem::StopScript(char* path) void CScriptSystem::StopScript(const char* path)
{ {
CScriptInstance* scriptInstance = GetInstance(path); CScriptInstance* scriptInstance = GetInstance(path);

View File

@ -24,10 +24,10 @@ public:
CScriptSystem(CDebuggerUI* debugger); CScriptSystem(CDebuggerUI* debugger);
~CScriptSystem(); ~CScriptSystem();
// Run a script in its own context/thread // Run a script in its own context/thread
void RunScript(char* path); void RunScript(const char * path);
// Kill a script context/thread by its path // Kill a script context/thread by its path
void StopScript(char* path); void StopScript(const char * path);
const char* APIScript(); const char* APIScript();

View File

@ -14,7 +14,7 @@ CProjectSupport::CProjectSupport() :
bool CProjectSupport::RequestCode(const char * Email) bool CProjectSupport::RequestCode(const char * Email)
{ {
if (Email == nullptr || strlen(Email) == 0 || stricmp(Email, "thank you from project64") == 0) if (Email == nullptr || strlen(Email) == 0 || _stricmp(Email, "thank you from project64") == 0)
{ {
return false; return false;
} }

View File

@ -27,7 +27,7 @@
#include "OpCode.h" #include "OpCode.h"
#include "Types.h" #include "Types.h"
extern DWORD CompilePC, NextInstruction, JumpTableSize; extern uint32_t CompilePC, NextInstruction, JumpTableSize;
extern Boolean ChangedPC; extern Boolean ChangedPC;
#define CompilerWarning if (ShowErrors) DisplayError #define CompilerWarning if (ShowErrors) DisplayError