mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
Misc: Remove custom countof macros in favor of std::size
This commit is contained in:
committed by
tellowkrinkle
parent
7435f76609
commit
2351431d71
@@ -37,13 +37,6 @@
|
||||
// Use this in those situations
|
||||
#define OFFSETOF(a, b) (reinterpret_cast<size_t>(&(static_cast<a*>(0)->b)))
|
||||
|
||||
// Renamed ARRAYSIZE to ArraySize -- looks nice and gets rid of Windows.h conflicts (air)
|
||||
// Notes: I'd have used ARRAY_SIZE instead but ran into cross-platform lib conflicts with
|
||||
// that as well. >_<
|
||||
#ifndef ArraySize
|
||||
#define ArraySize(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Dev / Debug conditionals - Consts for using if() statements instead of uglier #ifdef.
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
@@ -48,7 +48,7 @@ bool ChdFileReader::Open2(const wxString& fileName)
|
||||
// TODO: Unicode correctness on Windows
|
||||
while (CHDERR_REQUIRES_PARENT == (error = chd_open(chds[chd_depth].c_str(), CHD_OPEN_READ, NULL, &child)))
|
||||
{
|
||||
if (chd_depth >= static_cast<int>(ArraySize(chds) - 1))
|
||||
if (chd_depth >= static_cast<int>(std::size(chds) - 1))
|
||||
{
|
||||
Console.Error(L"CDVD: chd_open hit recursion limit searching for parents");
|
||||
return false;
|
||||
|
||||
@@ -134,13 +134,13 @@ void ThreadedFileReader::Loop()
|
||||
|
||||
ThreadedFileReader::Buffer* ThreadedFileReader::GetBlockPtr(const Chunk& block)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(ArraySize(m_buffer)); i++)
|
||||
for (int i = 0; i < static_cast<int>(std::size(m_buffer)); i++)
|
||||
{
|
||||
u32 size = m_buffer[i].size.load(std::memory_order_relaxed);
|
||||
u64 offset = m_buffer[i].offset;
|
||||
if (size && offset <= block.offset && offset + size >= block.offset + block.length)
|
||||
{
|
||||
m_nextBuffer = (i + 1) % ArraySize(m_buffer);
|
||||
m_nextBuffer = (i + 1) % std::size(m_buffer);
|
||||
return m_buffer + i;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ ThreadedFileReader::Buffer* ThreadedFileReader::GetBlockPtr(const Chunk& block)
|
||||
{
|
||||
buf.offset = block.offset;
|
||||
buf.size.store(size, std::memory_order_release);
|
||||
m_nextBuffer = (m_nextBuffer + 1) % ArraySize(m_buffer);
|
||||
m_nextBuffer = (m_nextBuffer + 1) % std::size(m_buffer);
|
||||
return &buf;
|
||||
}
|
||||
return nullptr;
|
||||
@@ -214,9 +214,9 @@ bool ThreadedFileReader::TryCachedRead(void*& buffer, u64& offset, u32& size, co
|
||||
m_amtRead = 0;
|
||||
u64 end = 0;
|
||||
bool allDone = false;
|
||||
for (int i = 0; i < static_cast<int>(ArraySize(m_buffer) * 2); i++)
|
||||
for (int i = 0; i < static_cast<int>(std::size(m_buffer) * 2); i++)
|
||||
{
|
||||
Buffer& buf = m_buffer[i % ArraySize(m_buffer)];
|
||||
Buffer& buf = m_buffer[i % std::size(m_buffer)];
|
||||
u32 bufsize = buf.size.load(std::memory_order_acquire);
|
||||
if (!bufsize)
|
||||
continue;
|
||||
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
m_dns2_address .save(config.DNS2, config.AutoDNS2);
|
||||
|
||||
config.hddEnable = m_hdd_enable->GetValue();
|
||||
wxStrncpy(config.Hdd, m_hdd_file->GetPath(), ArraySize(config.Hdd) - 1);
|
||||
wxStrncpy(config.Hdd, m_hdd_file->GetPath(), std::size(config.Hdd) - 1);
|
||||
config.HddSize = m_hdd_size_spin->GetValue() * 1024;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -128,7 +128,7 @@ void iDumpRegisters(u32 startpc, u32 temp)
|
||||
__Log("ipu %x %x %x %x; bp: %x %x %x %x", psHu32(0x2000), psHu32(0x2010), psHu32(0x2020), psHu32(0x2030), g_BP.BP, g_BP.bufferhasnew, g_BP.FP, g_BP.IFC);
|
||||
__Log("gif: %x %x %x", psHu32(0x3000), psHu32(0x3010), psHu32(0x3020));
|
||||
|
||||
for(i = 0; i < ArraySize(dmacs); ++i) {
|
||||
for(i = 0; i < std::size(dmacs); ++i) {
|
||||
DMACh* p = (DMACh*)(&eeHw[dmacs[i]]);
|
||||
__Log("dma%d c%x m%x q%x t%x s%x", i, p->chcr._u32, p->madr, p->qwc, p->tadr, p->sadr);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ void iDumpBlock( int startpc, u8 * ptr )
|
||||
|
||||
memzero(used);
|
||||
numused = 0;
|
||||
for(uint i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
|
||||
for(uint i = 0; i < std::size(s_pInstCache->regs); ++i) {
|
||||
if( s_pInstCache->regs[i] & EEINST_USED ) {
|
||||
used[i] = 1;
|
||||
numused++;
|
||||
@@ -306,7 +306,7 @@ void iDumpBlock( int startpc, u8 * ptr )
|
||||
|
||||
memzero(fpuused);
|
||||
fpunumused = 0;
|
||||
for(uint i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
|
||||
for(uint i = 0; i < std::size(s_pInstCache->fpuregs); ++i) {
|
||||
if( s_pInstCache->fpuregs[i] & EEINST_USED ) {
|
||||
fpuused[i] = 1;
|
||||
fpunumused++;
|
||||
@@ -314,11 +314,11 @@ void iDumpBlock( int startpc, u8 * ptr )
|
||||
}
|
||||
|
||||
eff.Printf( " " );
|
||||
for(uint i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
|
||||
for(uint i = 0; i < std::size(s_pInstCache->regs); ++i) {
|
||||
if( used[i] ) eff.Printf( "%2d ", i );
|
||||
}
|
||||
eff.Printf( "\n" );
|
||||
for(uint i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
|
||||
for(uint i = 0; i < std::size(s_pInstCache->fpuregs); ++i) {
|
||||
if( fpuused[i] ) eff.Printf( "%2d ", i );
|
||||
}
|
||||
|
||||
@@ -330,10 +330,10 @@ void iDumpBlock( int startpc, u8 * ptr )
|
||||
int count;
|
||||
EEINST* pcur;
|
||||
|
||||
for(uint i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
|
||||
for(uint i = 0; i < std::size(s_pInstCache->regs); ++i) {
|
||||
if( used[i] ) fprintf(f, "%s ", disRNameGPR[i]);
|
||||
}
|
||||
for(uint i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
|
||||
for(uint i = 0; i < std::size(s_pInstCache->fpuregs); ++i) {
|
||||
if( fpuused[i] ) fprintf(f, "%s ", i<32?"FR":"FA");
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
@@ -343,14 +343,14 @@ void iDumpBlock( int startpc, u8 * ptr )
|
||||
fprintf(f, "%2d: %2.2x ", i+1, pcur->info);
|
||||
|
||||
count = 1;
|
||||
for(uint j = 0; j < ArraySize(s_pInstCache->regs); j++) {
|
||||
for(uint j = 0; j < std::size(s_pInstCache->regs); j++) {
|
||||
if( used[j] ) {
|
||||
fprintf(f, "%2.2x%s", pcur->regs[j], ((count%8)&&count<numused)?"_":" ");
|
||||
++count;
|
||||
}
|
||||
}
|
||||
count = 1;
|
||||
for(uint j = 0; j < ArraySize(s_pInstCache->fpuregs); j++) {
|
||||
for(uint j = 0; j < std::size(s_pInstCache->fpuregs); j++) {
|
||||
if( fpuused[j] ) {
|
||||
fprintf(f, "%2.2x%s", pcur->fpuregs[j], ((count%8)&&count<fpunumused)?"_":" ");
|
||||
++count;
|
||||
|
||||
+5
-5
@@ -752,9 +752,9 @@ void* fifo_alloc(size_t size, size_t repeat)
|
||||
{
|
||||
ASSERT(s_fh == NULL);
|
||||
|
||||
if (repeat >= countof(s_Next))
|
||||
if (repeat >= std::size(s_Next))
|
||||
{
|
||||
fprintf(stderr, "Memory mapping overflow (%zu >= %u)\n", repeat, static_cast<unsigned>(countof(s_Next)));
|
||||
fprintf(stderr, "Memory mapping overflow (%zu >= %u)\n", repeat, static_cast<unsigned>(std::size(s_Next)));
|
||||
return vmalloc(size * repeat, false); // Fallback to default vmalloc
|
||||
}
|
||||
|
||||
@@ -808,7 +808,7 @@ void fifo_free(void* ptr, size_t size, size_t repeat)
|
||||
|
||||
UnmapViewOfFile(ptr);
|
||||
|
||||
for (size_t i = 1; i < countof(s_Next); i++)
|
||||
for (size_t i = 1; i < std::size(s_Next); i++)
|
||||
{
|
||||
if (s_Next[i] != 0)
|
||||
{
|
||||
@@ -1375,12 +1375,12 @@ std::string GSApp::GetConfigS(const char* entry)
|
||||
|
||||
if (def != m_default_configuration.end())
|
||||
{
|
||||
GetIniString(m_section.c_str(), entry, def->second.c_str(), buff, countof(buff), m_ini.c_str());
|
||||
GetIniString(m_section.c_str(), entry, def->second.c_str(), buff, std::size(buff), m_ini.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Option %s doesn't have a default value\n", entry);
|
||||
GetIniString(m_section.c_str(), entry, "", buff, countof(buff), m_ini.c_str());
|
||||
GetIniString(m_section.c_str(), entry, "", buff, std::size(buff), m_ini.c_str());
|
||||
}
|
||||
|
||||
return {buff};
|
||||
|
||||
@@ -136,8 +136,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define countof(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#ifndef RESTRICT
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
|
||||
+9
-9
@@ -17,7 +17,7 @@
|
||||
#include "GS.h"
|
||||
#include "GSCrc.h"
|
||||
|
||||
CRC::Game CRC::m_games[] =
|
||||
const CRC::Game CRC::m_games[] =
|
||||
{
|
||||
// Note: IDs 0x7ACF7E03, 0x7D4EA48F, 0x37C53760 - shouldn't be added as it's from the multiloaders when packing games.
|
||||
{0x00000000, NoTitle, NoRegion, 0},
|
||||
@@ -505,7 +505,7 @@ CRC::Game CRC::m_games[] =
|
||||
{0xB1BE3E51, Whiplash, EU, 0},
|
||||
};
|
||||
|
||||
std::map<uint32, CRC::Game*> CRC::m_map;
|
||||
std::map<uint32, const CRC::Game*> CRC::m_map;
|
||||
|
||||
std::string ToLower(std::string str)
|
||||
{
|
||||
@@ -524,7 +524,7 @@ bool IsCrcExcluded(std::string exclusionList, uint32 crc)
|
||||
return exclusionList.find(target) != std::string::npos || exclusionList.find("all") != std::string::npos;
|
||||
}
|
||||
|
||||
CRC::Game CRC::Lookup(uint32 crc)
|
||||
const CRC::Game& CRC::Lookup(uint32 crc)
|
||||
{
|
||||
printf("GS Lookup CRC:%08X\n", crc);
|
||||
if (m_map.empty())
|
||||
@@ -533,20 +533,20 @@ CRC::Game CRC::Lookup(uint32 crc)
|
||||
if (exclusions.length() != 0)
|
||||
printf("GS: CrcHacksExclusions: %s\n", exclusions.c_str());
|
||||
int crcDups = 0;
|
||||
for (size_t i = 0; i < countof(m_games); i++)
|
||||
for (const Game& game : m_games)
|
||||
{
|
||||
if (!IsCrcExcluded(exclusions, m_games[i].crc))
|
||||
if (!IsCrcExcluded(exclusions, game.crc))
|
||||
{
|
||||
if (m_map[m_games[i].crc])
|
||||
if (m_map[game.crc])
|
||||
{
|
||||
printf("[FIXME] GS: Duplicate CRC: 0x%08X: (game-id/region-id) %d/%d overrides %d/%d\n", m_games[i].crc, m_games[i].title, m_games[i].region, m_map[m_games[i].crc]->title, m_map[m_games[i].crc]->region);
|
||||
printf("[FIXME] GS: Duplicate CRC: 0x%08X: (game-id/region-id) %d/%d overrides %d/%d\n", game.crc, game.title, game.region, m_map[game.crc]->title, m_map[game.crc]->region);
|
||||
crcDups++;
|
||||
}
|
||||
|
||||
m_map[m_games[i].crc] = &m_games[i];
|
||||
m_map[game.crc] = &game;
|
||||
}
|
||||
//else
|
||||
// printf( "GS: excluding CRC hack for 0x%08x\n", m_games[i].crc );
|
||||
// printf( "GS: excluding CRC hack for 0x%08x\n", game.crc );
|
||||
}
|
||||
if (crcDups)
|
||||
printf("[FIXME] GS: Duplicate CRC: Overall: %d\n", crcDups);
|
||||
|
||||
+3
-3
@@ -177,9 +177,9 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
static Game m_games[];
|
||||
static std::map<uint32, Game*> m_map;
|
||||
static const Game m_games[];
|
||||
static std::map<uint32, const Game*> m_map;
|
||||
|
||||
public:
|
||||
static Game Lookup(uint32 crc);
|
||||
static const Game& Lookup(uint32 crc);
|
||||
};
|
||||
|
||||
+23
-23
@@ -86,28 +86,28 @@ GSLocalMemory::GSLocalMemory()
|
||||
|
||||
memset(m_vm8, 0, m_vmsize);
|
||||
|
||||
for (size_t i = 0; i < countof(m_psm); i++)
|
||||
for (psm_t& psm : m_psm)
|
||||
{
|
||||
m_psm[i].info = GSLocalMemory::swizzle32;
|
||||
m_psm[i].rp = &GSLocalMemory::ReadPixel32;
|
||||
m_psm[i].rpa = &GSLocalMemory::ReadPixel32;
|
||||
m_psm[i].wp = &GSLocalMemory::WritePixel32;
|
||||
m_psm[i].wpa = &GSLocalMemory::WritePixel32;
|
||||
m_psm[i].rt = &GSLocalMemory::ReadTexel32;
|
||||
m_psm[i].rta = &GSLocalMemory::ReadTexel32;
|
||||
m_psm[i].wfa = &GSLocalMemory::WritePixel32;
|
||||
m_psm[i].wi = &GSLocalMemory::WriteImage<PSM_PSMCT32, 8, 8, 32>;
|
||||
m_psm[i].ri = &GSLocalMemory::ReadImageX; // TODO
|
||||
m_psm[i].rtx = &GSLocalMemory::ReadTexture32;
|
||||
m_psm[i].rtxP = &GSLocalMemory::ReadTexture32;
|
||||
m_psm[i].rtxb = &GSLocalMemory::ReadTextureBlock32;
|
||||
m_psm[i].rtxbP = &GSLocalMemory::ReadTextureBlock32;
|
||||
m_psm[i].bpp = m_psm[i].trbpp = 32;
|
||||
m_psm[i].pal = 0;
|
||||
m_psm[i].bs = GSVector2i(8, 8);
|
||||
m_psm[i].pgs = GSVector2i(64, 32);
|
||||
m_psm[i].msk = 0xff;
|
||||
m_psm[i].depth = 0;
|
||||
psm.info = GSLocalMemory::swizzle32;
|
||||
psm.rp = &GSLocalMemory::ReadPixel32;
|
||||
psm.rpa = &GSLocalMemory::ReadPixel32;
|
||||
psm.wp = &GSLocalMemory::WritePixel32;
|
||||
psm.wpa = &GSLocalMemory::WritePixel32;
|
||||
psm.rt = &GSLocalMemory::ReadTexel32;
|
||||
psm.rta = &GSLocalMemory::ReadTexel32;
|
||||
psm.wfa = &GSLocalMemory::WritePixel32;
|
||||
psm.wi = &GSLocalMemory::WriteImage<PSM_PSMCT32, 8, 8, 32>;
|
||||
psm.ri = &GSLocalMemory::ReadImageX; // TODO
|
||||
psm.rtx = &GSLocalMemory::ReadTexture32;
|
||||
psm.rtxP = &GSLocalMemory::ReadTexture32;
|
||||
psm.rtxb = &GSLocalMemory::ReadTextureBlock32;
|
||||
psm.rtxbP = &GSLocalMemory::ReadTextureBlock32;
|
||||
psm.bpp = psm.trbpp = 32;
|
||||
psm.pal = 0;
|
||||
psm.bs = GSVector2i(8, 8);
|
||||
psm.pgs = GSVector2i(64, 32);
|
||||
psm.msk = 0xff;
|
||||
psm.depth = 0;
|
||||
}
|
||||
|
||||
m_psm[PSM_PSGPU24].info = GSLocalMemory::swizzle16;
|
||||
@@ -289,8 +289,8 @@ GSLocalMemory::GSLocalMemory()
|
||||
m_psm[PSM_PSMT8].pal = m_psm[PSM_PSMT8H].pal = 256;
|
||||
m_psm[PSM_PSMT4].pal = m_psm[PSM_PSMT4HL].pal = m_psm[PSM_PSMT4HH].pal = 16;
|
||||
|
||||
for (size_t i = 0; i < countof(m_psm); i++)
|
||||
m_psm[i].fmt = 3;
|
||||
for (psm_t& psm : m_psm)
|
||||
psm.fmt = 3;
|
||||
m_psm[PSM_PSMCT32].fmt = m_psm[PSM_PSMZ32].fmt = 0;
|
||||
m_psm[PSM_PSMCT24].fmt = m_psm[PSM_PSMZ24].fmt = 1;
|
||||
m_psm[PSM_PSMCT16].fmt = m_psm[PSM_PSMZ16].fmt = 2;
|
||||
|
||||
@@ -66,7 +66,7 @@ void GSPerfMon::Update()
|
||||
#ifndef DISABLE_PERF_MON
|
||||
if (m_count > 0)
|
||||
{
|
||||
for (size_t i = 0; i < countof(m_counters); i++)
|
||||
for (size_t i = 0; i < std::size(m_counters); i++)
|
||||
{
|
||||
m_stats[i] = m_counters[i] / m_count;
|
||||
}
|
||||
|
||||
+16
-18
@@ -128,7 +128,7 @@ GSState::GSState()
|
||||
m_sssize += sizeof(m_tr.x);
|
||||
m_sssize += sizeof(m_tr.y);
|
||||
m_sssize += m_mem.m_vmsize;
|
||||
m_sssize += (sizeof(m_path[0].tag) + sizeof(m_path[0].reg)) * countof(m_path);
|
||||
m_sssize += (sizeof(m_path[0].tag) + sizeof(m_path[0].reg)) * std::size(m_path);
|
||||
m_sssize += sizeof(m_q);
|
||||
|
||||
PRIM = &m_env.PRIM;
|
||||
@@ -187,7 +187,7 @@ void GSState::Reset()
|
||||
{
|
||||
// FIXME: bios logo not shown cut in half after reset, missing graphics in GoW after first FMV
|
||||
// memset(m_mem.m_vm8, 0, m_mem.m_vmsize);
|
||||
memset(&m_path[0], 0, sizeof(m_path[0]) * countof(m_path));
|
||||
memset(&m_path, 0, sizeof(m_path));
|
||||
memset(&m_v, 0, sizeof(m_v));
|
||||
|
||||
m_env.Reset();
|
||||
@@ -221,8 +221,7 @@ void GSState::Reset()
|
||||
|
||||
void GSState::ResetHandlers()
|
||||
{
|
||||
for (size_t i = 0; i < countof(m_fpGIFPackedRegHandlers); i++)
|
||||
m_fpGIFPackedRegHandlers[i] = &GSState::GIFPackedRegHandlerNull;
|
||||
std::fill(std::begin(m_fpGIFPackedRegHandlers), std::end(m_fpGIFPackedRegHandlers), &GSState::GIFPackedRegHandlerNull);
|
||||
|
||||
m_fpGIFPackedRegHandlers[GIF_REG_PRIM] = (GIFPackedRegHandler)(GIFRegHandler)&GSState::GIFRegHandlerPRIM;
|
||||
m_fpGIFPackedRegHandlers[GIF_REG_RGBA] = &GSState::GIFPackedRegHandlerRGBA;
|
||||
@@ -271,8 +270,7 @@ void GSState::ResetHandlers()
|
||||
SetHandlerXYZ(GS_INVALID, false);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < countof(m_fpGIFRegHandlers); i++)
|
||||
m_fpGIFRegHandlers[i] = &GSState::GIFRegHandlerNull;
|
||||
std::fill(std::begin(m_fpGIFRegHandlers), std::end(m_fpGIFRegHandlers), &GSState::GIFRegHandlerNull);
|
||||
|
||||
m_fpGIFRegHandlers[GIF_A_D_REG_PRIM] = &GSState::GIFRegHandlerPRIM;
|
||||
m_fpGIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GSState::GIFRegHandlerRGBAQ;
|
||||
@@ -2054,19 +2052,19 @@ int GSState::Freeze(freezeData* fd, bool sizeonly)
|
||||
WriteState(data, &m_tr.y);
|
||||
WriteState(data, m_mem.m_vm8, m_mem.m_vmsize);
|
||||
|
||||
for (size_t i = 0; i < countof(m_path); i++)
|
||||
for (GIFPath& path : m_path)
|
||||
{
|
||||
m_path[i].tag.NREG = m_path[i].nreg;
|
||||
m_path[i].tag.NLOOP = m_path[i].nloop;
|
||||
m_path[i].tag.REGS = 0;
|
||||
path.tag.NREG = path.nreg;
|
||||
path.tag.NLOOP = path.nloop;
|
||||
path.tag.REGS = 0;
|
||||
|
||||
for (size_t j = 0; j < countof(m_path[i].regs.u8); j++)
|
||||
for (size_t j = 0; j < std::size(path.regs.u8); j++)
|
||||
{
|
||||
m_path[i].tag.u32[2 + (j >> 3)] |= m_path[i].regs.u8[j] << ((j & 7) << 2);
|
||||
path.tag.u32[2 + (j >> 3)] |= path.regs.u8[j] << ((j & 7) << 2);
|
||||
}
|
||||
|
||||
WriteState(data, &m_path[i].tag);
|
||||
WriteState(data, &m_path[i].reg);
|
||||
WriteState(data, &path.tag);
|
||||
WriteState(data, &path.reg);
|
||||
}
|
||||
|
||||
WriteState(data, &m_q);
|
||||
@@ -2162,12 +2160,12 @@ int GSState::Defrost(const freezeData* fd)
|
||||
|
||||
m_tr.total = 0; // TODO: restore transfer state
|
||||
|
||||
for (size_t i = 0; i < countof(m_path); i++)
|
||||
for (GIFPath& path : m_path)
|
||||
{
|
||||
ReadState(&m_path[i].tag, data);
|
||||
ReadState(&m_path[i].reg, data);
|
||||
ReadState(&path.tag, data);
|
||||
ReadState(&path.reg, data);
|
||||
|
||||
m_path[i].SetTag(&m_path[i].tag); // expand regs
|
||||
path.SetTag(&path.tag); // expand regs
|
||||
}
|
||||
|
||||
ReadState(&m_q, data);
|
||||
|
||||
+3
-3
@@ -167,11 +167,11 @@ bool GSUtil::CheckSSE()
|
||||
#endif
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < countof(checks); i++)
|
||||
for (const ISA& check : checks)
|
||||
{
|
||||
if (!g_cpu.has(checks[i].type))
|
||||
if (!g_cpu.has(check.type))
|
||||
{
|
||||
fprintf(stderr, "This CPU does not support %s\n", checks[i].name);
|
||||
fprintf(stderr, "This CPU does not support %s\n", check.name);
|
||||
|
||||
status = false;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ GSVector4i GSVector4i::fit(int preset) const
|
||||
{
|
||||
GSVector4i r;
|
||||
|
||||
if (preset > 0 && preset < (int)countof(s_ar))
|
||||
if (preset > 0 && preset < (int)std::size(s_ar))
|
||||
{
|
||||
r = fit(s_ar[preset][0], s_ar[preset][1]);
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ void GSDevice::Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, con
|
||||
{
|
||||
GSTexture* tex[3] = {NULL, NULL, NULL};
|
||||
|
||||
for (size_t i = 0; i < countof(tex); i++)
|
||||
for (size_t i = 0; i < std::size(tex); i++)
|
||||
{
|
||||
if (sTex[i] != NULL)
|
||||
{
|
||||
@@ -252,7 +252,7 @@ void GSDevice::Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, con
|
||||
|
||||
DoMerge(tex, sRect, m_merge, dRect, PMODE, EXTBUF, c);
|
||||
|
||||
for (size_t i = 0; i < countof(tex); i++)
|
||||
for (size_t i = 0; i < std::size(tex); i++)
|
||||
{
|
||||
if (tex[i] != sTex[i])
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ void GSOsdManager::Log(const char* utf8)
|
||||
|
||||
#if __GNUC__ < 5 || (__GNUC__ == 5 && __GNUC_MINOR__ < 4)
|
||||
char32_t buffer[256];
|
||||
dumb_utf8_to_utf32(utf8, buffer, countof(buffer));
|
||||
dumb_utf8_to_utf32(utf8, buffer, std::size(buffer));
|
||||
for (char32_t* c = buffer; *c; ++c)
|
||||
AddGlyph(*c);
|
||||
#else
|
||||
@@ -238,8 +238,8 @@ void GSOsdManager::Monitor(const char* key, const char* value)
|
||||
{
|
||||
#if __GNUC__ < 5 || (__GNUC__ == 5 && __GNUC_MINOR__ < 4)
|
||||
char32_t buffer[256], vbuffer[256];
|
||||
dumb_utf8_to_utf32(key, buffer, countof(buffer));
|
||||
dumb_utf8_to_utf32(value, vbuffer, countof(vbuffer));
|
||||
dumb_utf8_to_utf32(key, buffer, std::size(buffer));
|
||||
dumb_utf8_to_utf32(value, vbuffer, std::size(vbuffer));
|
||||
for (char32_t* c = buffer; *c; ++c)
|
||||
AddGlyph(*c);
|
||||
for (char32_t* c = vbuffer; *c; ++c)
|
||||
@@ -263,7 +263,7 @@ void GSOsdManager::Monitor(const char* key, const char* value)
|
||||
{
|
||||
#if __GNUC__ < 5 || (__GNUC__ == 5 && __GNUC_MINOR__ < 4)
|
||||
char32_t buffer[256];
|
||||
dumb_utf8_to_utf32(key, buffer, countof(buffer));
|
||||
dumb_utf8_to_utf32(key, buffer, std::size(buffer));
|
||||
#else
|
||||
#if _MSC_VER == 1900
|
||||
std::wstring_convert<std::codecvt_utf8<unsigned int>, unsigned int> conv;
|
||||
|
||||
@@ -452,7 +452,7 @@ void GSRenderer::VSync(int field)
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_pGSsetTitle_Crit);
|
||||
|
||||
strncpy(m_GStitleInfoBuffer, s.c_str(), countof(m_GStitleInfoBuffer) - 1);
|
||||
strncpy(m_GStitleInfoBuffer, s.c_str(), std::size(m_GStitleInfoBuffer) - 1);
|
||||
|
||||
m_GStitleInfoBuffer[sizeof(m_GStitleInfoBuffer) - 1] = 0; // make sure null terminated even if text overflows
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ public:
|
||||
GSVertexList()
|
||||
: m_count(0)
|
||||
{
|
||||
m_base = _aligned_malloc(sizeof(Vertex) * countof(m_v), 32);
|
||||
m_base = _aligned_malloc(sizeof(Vertex) * std::size(m_v), 32);
|
||||
|
||||
for (size_t i = 0; i < countof(m_v); i++)
|
||||
for (size_t i = 0; i < std::size(m_v); i++)
|
||||
{
|
||||
m_v[i] = &((Vertex*)m_base)[i];
|
||||
}
|
||||
|
||||
@@ -228,14 +228,14 @@ bool GSDevice11::Create(const WindowInfo& wi)
|
||||
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
||||
CreateShader(shader, "convert.fx", nullptr, "vs_main", sm_model.GetPtr(), &m_convert.vs, il_convert, countof(il_convert), m_convert.il.put());
|
||||
CreateShader(shader, "convert.fx", nullptr, "vs_main", sm_model.GetPtr(), &m_convert.vs, il_convert, std::size(il_convert), m_convert.il.put());
|
||||
|
||||
ShaderMacro sm_convert(m_shader.model);
|
||||
sm_convert.AddMacro("PS_SCALE_FACTOR", std::max(1, m_upscale_multiplier));
|
||||
|
||||
D3D_SHADER_MACRO* sm_convert_ptr = sm_convert.GetPtr();
|
||||
|
||||
for (size_t i = 0; i < countof(m_convert.ps); i++)
|
||||
for (size_t i = 0; i < std::size(m_convert.ps); i++)
|
||||
{
|
||||
CreateShader(shader, "convert.fx", nullptr, format("ps_main%d", i).c_str(), sm_convert_ptr, m_convert.ps[i].put());
|
||||
}
|
||||
@@ -267,7 +267,7 @@ bool GSDevice11::Create(const WindowInfo& wi)
|
||||
m_dev->CreateBuffer(&bd, nullptr, m_merge.cb.put());
|
||||
|
||||
theApp.LoadResource(IDR_MERGE_FX, shader);
|
||||
for (size_t i = 0; i < countof(m_merge.ps); i++)
|
||||
for (size_t i = 0; i < std::size(m_merge.ps); i++)
|
||||
{
|
||||
CreateShader(shader, "merge.fx", nullptr, format("ps_main%d", i).c_str(), sm_model.GetPtr(), m_merge.ps[i].put());
|
||||
}
|
||||
@@ -296,7 +296,7 @@ bool GSDevice11::Create(const WindowInfo& wi)
|
||||
m_dev->CreateBuffer(&bd, nullptr, m_interlace.cb.put());
|
||||
|
||||
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
||||
for (size_t i = 0; i < countof(m_interlace.ps); i++)
|
||||
for (size_t i = 0; i < std::size(m_interlace.ps); i++)
|
||||
{
|
||||
CreateShader(shader, "interlace.fx", nullptr, format("ps_main%d", i).c_str(), sm_model.GetPtr(), m_interlace.ps[i].put());
|
||||
}
|
||||
@@ -776,7 +776,7 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
||||
|
||||
|
||||
|
||||
IASetVertexBuffer(vertices, sizeof(vertices[0]), countof(vertices));
|
||||
IASetVertexBuffer(vertices, sizeof(vertices[0]), std::size(vertices));
|
||||
IASetInputLayout(m_convert.il.get());
|
||||
IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
|
||||
@@ -1294,7 +1294,7 @@ void GSDevice11::PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb)
|
||||
void GSDevice11::PSUpdateShaderState()
|
||||
{
|
||||
m_ctx->PSSetShaderResources(0, m_state.ps_sr_views.size(), m_state.ps_sr_views.data());
|
||||
m_ctx->PSSetSamplers(0, countof(m_state.ps_ss), m_state.ps_ss);
|
||||
m_ctx->PSSetSamplers(0, std::size(m_state.ps_ss), m_state.ps_ss);
|
||||
}
|
||||
|
||||
void GSDevice11::OMSetDepthStencilState(ID3D11DepthStencilState* dss, uint8 sref)
|
||||
|
||||
@@ -117,7 +117,7 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CreateShader(shader, "tfx.fx", nullptr, "vs_main", sm.GetPtr(), &vs.vs, layout, countof(layout), vs.il.put());
|
||||
CreateShader(shader, "tfx.fx", nullptr, "vs_main", sm.GetPtr(), &vs.vs, layout, std::size(layout), vs.il.put());
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user