diff --git a/core/archive/7zArchive.h b/core/archive/7zArchive.h index 553d7f940..2d6d52832 100644 --- a/core/archive/7zArchive.h +++ b/core/archive/7zArchive.h @@ -54,7 +54,7 @@ public: SzArchiveFile(u8 *data, u32 offset, u32 length) : data(data), offset(offset), length(length) {} virtual u32 Read(void *buffer, u32 length) override { - length = min(length, this->length); + length = std::min(length, this->length); memcpy(buffer, data + offset, length); return length; } diff --git a/core/cfg/cfg.cpp b/core/cfg/cfg.cpp index 5b01d4968..db67b382e 100644 --- a/core/cfg/cfg.cpp +++ b/core/cfg/cfg.cpp @@ -12,12 +12,12 @@ #include -static string cfgPath; +static std::string cfgPath; static bool save_config = true; static bool autoSave = true; static emucfg::ConfigFile cfgdb; -static string game_id; +static std::string game_id; static bool has_game_specific_config = false; void savecfgf() @@ -84,7 +84,7 @@ bool cfgOpen() return false; const char* filename = "/emu.cfg"; - string config_path_read = get_readonly_config_path(filename); + std::string config_path_read = get_readonly_config_path(filename); cfgPath = get_writable_config_path(filename); FILE* cfgfile = fopen(config_path_read.c_str(),"r"); @@ -121,28 +121,28 @@ bool cfgOpen() //2 : found section & key s32 cfgExists(const char * Section, const char * Key) { - if(cfgdb.has_entry(string(Section), string(Key))) + if(cfgdb.has_entry(std::string(Section), std::string(Key))) { return 2; } else { - return (cfgdb.has_section(string(Section)) ? 1 : 0); + return (cfgdb.has_section(std::string(Section)) ? 1 : 0); } } void cfgLoadStr(const char * Section, const char * Key, char * Return,const char* Default) { - string value = cfgdb.get(Section, Key, Default); + std::string value = cfgdb.get(Section, Key, Default); // FIXME: Buffer overflow possible strcpy(Return, value.c_str()); } -string cfgLoadStr(const char * Section, const char * Key, const char* Default) +std::string cfgLoadStr(const char * Section, const char * Key, const char* Default) { - std::string v = cfgdb.get(string(Section), string(Key), string(Default)); + std::string v = cfgdb.get(std::string(Section), std::string(Key), std::string(Default)); if (cfgHasGameSpecificConfig()) - v = cfgdb.get(game_id, string(Key), v); + v = cfgdb.get(game_id, std::string(Key), v); return v; } @@ -157,9 +157,9 @@ void cfgSaveInt(const char * Section, const char * Key, s32 Int) s32 cfgLoadInt(const char * Section, const char * Key,s32 Default) { - s32 v = cfgdb.get_int(string(Section), string(Key), Default); + s32 v = cfgdb.get_int(std::string(Section), std::string(Key), Default); if (cfgHasGameSpecificConfig()) - v = cfgdb.get_int(game_id, string(Key), v); + v = cfgdb.get_int(game_id, std::string(Key), v); return v; } @@ -171,16 +171,16 @@ void cfgSaveBool(const char * Section, const char * Key, bool BoolValue) bool cfgLoadBool(const char * Section, const char * Key,bool Default) { - bool v = cfgdb.get_bool(string(Section), string(Key), Default); + bool v = cfgdb.get_bool(std::string(Section), std::string(Key), Default); if (cfgHasGameSpecificConfig()) - v = cfgdb.get_bool(game_id, string(Key), v); + v = cfgdb.get_bool(game_id, std::string(Key), v); return v; } void cfgSetVirtual(const char * Section, const char * Key, const char * String) { - cfgdb.set(string(Section), string(Key), string(String), true); + cfgdb.set(std::string(Section), std::string(Key), std::string(String), true); } void cfgSetGameId(const char *id) diff --git a/core/cfg/cfg.h b/core/cfg/cfg.h index c80f445a9..ccb4ea72f 100644 --- a/core/cfg/cfg.h +++ b/core/cfg/cfg.h @@ -12,7 +12,7 @@ bool cfgOpen(); s32 cfgLoadInt(const char * lpSection, const char * lpKey,s32 Default); void cfgSaveInt(const char * lpSection, const char * lpKey, s32 Int); void cfgLoadStr(const char * lpSection, const char * lpKey, char * lpReturn,const char* lpDefault); -string cfgLoadStr(const char * Section, const char * Key, const char* Default); +std::string cfgLoadStr(const char * Section, const char * Key, const char* Default); void cfgSaveStr(const char * lpSection, const char * lpKey, const char * lpString); void cfgSaveBool(const char * Section, const char * Key, bool BoolValue); bool cfgLoadBool(const char * Section, const char * Key,bool Default); diff --git a/core/cfg/ini.cpp b/core/cfg/ini.cpp index fe470bf73..e698231c4 100644 --- a/core/cfg/ini.cpp +++ b/core/cfg/ini.cpp @@ -7,7 +7,7 @@ namespace emucfg { /* ConfigEntry */ -const string& ConfigEntry::get_string() const +const std::string& ConfigEntry::get_string() const { return this->value; } @@ -132,7 +132,7 @@ ConfigEntry* ConfigFile::get_entry(const std::string& section_name, const std::s } -string ConfigFile::get(const std::string& section_name, const std::string& entry_name, const std::string& default_value) +std::string ConfigFile::get(const std::string& section_name, const std::string& entry_name, const std::string& default_value) { ConfigEntry* entry = this->get_entry(section_name, entry_name); if (entry == NULL) @@ -190,7 +190,7 @@ void ConfigFile::set_int(const std::string& section_name, const std::string& ent void ConfigFile::set_bool(const std::string& section_name, const std::string& entry_name, bool value, bool is_virtual) { - string str_value = (value ? "yes" : "no"); + std::string str_value = (value ? "yes" : "no"); this->set(section_name, entry_name, str_value, is_virtual); } @@ -261,7 +261,7 @@ void ConfigFile::parse(FILE* file) } else { - this->set(string(current_section), string(name), string(value)); + this->set(std::string(current_section), std::string(name), std::string(value)); } } } @@ -271,14 +271,14 @@ void ConfigFile::save(FILE* file) { for (const auto& section_it : this->sections) { - const string& section_name = section_it.first; + const std::string& section_name = section_it.first; const ConfigSection& section = section_it.second; fprintf(file, "[%s]\n", section_name.c_str()); for (const auto& entry_it : section.entries) { - const string& entry_name = entry_it.first; + const std::string& entry_name = entry_it.first; const ConfigEntry& entry = entry_it.second; fprintf(file, "%s = %s\n", entry_name.c_str(), entry.get_string().c_str()); } diff --git a/core/cfg/ini.h b/core/cfg/ini.h index b7c5e32ab..e9951723d 100644 --- a/core/cfg/ini.h +++ b/core/cfg/ini.h @@ -36,7 +36,7 @@ struct ConfigFile { void save(FILE* fd); /* getting values */ - string get(const std::string& section_name, const std::string& entry_name, const std::string& default_value = ""); + std::string get(const std::string& section_name, const std::string& entry_name, const std::string& default_value = ""); int get_int(const std::string& section_name, const std::string& entry_name, int default_value = 0); bool get_bool(const std::string& section_name, const std::string& entry_name, bool default_value = false); /* setting values */ diff --git a/core/cheats.cpp b/core/cheats.cpp index dea99800c..f601dc887 100644 --- a/core/cheats.cpp +++ b/core/cheats.cpp @@ -288,7 +288,7 @@ bool CheatManager::Reset() _widescreen_cheat = nullptr; if (settings.platform.system != DC_PLATFORM_DREAMCAST || !settings.rend.WidescreenGameHacks) return false; - string game_id(ip_meta.product_number, sizeof(ip_meta.product_number)); + std::string game_id(ip_meta.product_number, sizeof(ip_meta.product_number)); for (int i = 0; _widescreen_cheats[i].game_id != nullptr; i++) { if (!strncmp(game_id.c_str(), _widescreen_cheats[i].game_id, game_id.length()) diff --git a/core/deps/coreio/coreio.cpp b/core/deps/coreio/coreio.cpp index df5627df6..0515caf7d 100644 --- a/core/deps/coreio/coreio.cpp +++ b/core/deps/coreio/coreio.cpp @@ -32,13 +32,13 @@ #endif #if FEAT_HAS_COREIO_HTTP -string url_encode(const string &value) { - ostringstream escaped; +std::string url_encode(const std::string &value) { + std::ostringstream escaped; escaped.fill('0'); - escaped << hex; + escaped << std::hex; - for (string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) { - string::value_type c = (*i); + for (std::string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) { + std::string::value_type c = (*i); // Keep alphanumeric and other accepted characters intact if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~' || c == '/' || c =='%' ) { @@ -47,15 +47,15 @@ string url_encode(const string &value) { } // Any other characters are percent-encoded - escaped << '%' << setw(2) << int((unsigned char)c); + escaped << '%' << std::setw(2) << int((unsigned char)c); } return escaped.str(); } -size_t HTTP_GET(string host, int port,string path, size_t offs, size_t len, void* pdata){ - string request; - string response; +size_t HTTP_GET(std::string host, int port, std::string path, size_t offs, size_t len, void* pdata){ + std::string request; + std::string response; struct sockaddr_in serveraddr; int sock; @@ -63,20 +63,20 @@ size_t HTTP_GET(string host, int port,string path, size_t offs, size_t len, void std::stringstream request2; if (len) { - request2 << "GET " << path << " HTTP/1.1"<f = 0; @@ -219,7 +219,7 @@ core_file* core_fopen(const char* filename) rv->port = 80; size_t pos = rv->host.find_first_of(":"); if (pos != rv->host.npos) { - string port = rv->host.substr(pos, rv->host.npos ); + std::string port = rv->host.substr(pos, rv->host.npos ); rv->host = rv->host.substr(0, rv->host.find_first_of(":")); sscanf(port.c_str(),"%d",&rv->port); } diff --git a/core/emitter/types.h b/core/emitter/types.h index 678526760..7a958e6ad 100644 --- a/core/emitter/types.h +++ b/core/emitter/types.h @@ -41,7 +41,6 @@ typedef u64 unat; #include #include -using namespace std; #ifndef dbgbreak #define dbgbreak __asm {int 3} diff --git a/core/emitter/x86_emitter.cpp b/core/emitter/x86_emitter.cpp index 5a2734854..8a537decd 100644 --- a/core/emitter/x86_emitter.cpp +++ b/core/emitter/x86_emitter.cpp @@ -78,8 +78,8 @@ void x86_block::Init(dyna_reallocFP* ral,dyna_finalizeFP* alf) x86_size=0; do_realloc=true; } -#define patches (*(vector*) _patches) -#define labels (*(vector*) _labels) +#define patches (*(std::vector*) _patches) +#define labels (*(std::vector*) _labels) //Generates code.if user_data is non zero , user_data_size bytes are allocated after the executable code //and user_data is set to the first byte of em.Allways 16 byte aligned @@ -104,7 +104,7 @@ void* x86_block::Generate() struct x86_block_externs_i : x86_block_externs { struct extern_entry { u8* dst;u32 offs:28;u32 size:4; }; - vector externs; + std::vector externs; void Apply(u8* base) { @@ -236,8 +236,8 @@ void x86_block::ApplyPatches(u8* base) } x86_block::x86_block() { - _patches=new vector; - _labels=new vector; + _patches = new std::vector; + _labels = new std::vector; opcode_count=0; } x86_block::~x86_block() diff --git a/core/emitter/x86_emitter.h b/core/emitter/x86_emitter.h index a4aa300d8..1fae214b2 100644 --- a/core/emitter/x86_emitter.h +++ b/core/emitter/x86_emitter.h @@ -5,7 +5,6 @@ #include #endif -using namespace std; //Oh god , x86 is a sooo badly designed opcode arch -_- const char* DissasmClass(x86_opcode_class opcode); diff --git a/core/emitter/x86_op_encoder.h b/core/emitter/x86_op_encoder.h index e3523a523..479c369a0 100644 --- a/core/emitter/x86_op_encoder.h +++ b/core/emitter/x86_op_encoder.h @@ -233,7 +233,7 @@ void encode_rex(x86_block* block,encoded_type* mrm,u32 mrm_reg,u32 ofe=0) } } #endif -#define block_patches (*(vector*) block->_patches) +#define block_patches (*(std::vector*) block->_patches) //Encoding function (partially) specialised by templates to gain speed :) template < enc_param enc_1,enc_imm enc_2,u32 sz,x86_operand_size enc_op_size> diff --git a/core/hw/aica/sgc_if.cpp b/core/hw/aica/sgc_if.cpp index 9c0647244..316a4282b 100755 --- a/core/hw/aica/sgc_if.cpp +++ b/core/hw/aica/sgc_if.cpp @@ -28,7 +28,6 @@ #include #include -using namespace std; #undef FAR //#define CLIP_WARN @@ -499,15 +498,15 @@ struct ChannelEx else { ofsatt = lfo.alfo + (AEG.GetValue() >> 2); - ofsatt = min(ofsatt, (u32)255); // make sure it never gets more 255 -- it can happen with some alfo/aeg combinations + ofsatt = std::min(ofsatt, (u32)255); // make sure it never gets more 255 -- it can happen with some alfo/aeg combinations } u32 const max_att = ((16 << 4) - 1) - ofsatt; s32* logtable = ofsatt + tl_lut; - u32 dl = min(VolMix.DLAtt, max_att); - u32 dr = min(VolMix.DRAtt, max_att); - u32 ds = min(VolMix.DSPAtt, max_att); + u32 dl = std::min(VolMix.DLAtt, max_att); + u32 dr = std::min(VolMix.DRAtt, max_att); + u32 ds = std::min(VolMix.DSPAtt, max_att); oLeft = FPMul(sample, logtable[dl], 15); oRight = FPMul(sample, logtable[dr], 15); diff --git a/core/hw/arm7/arm7.cpp b/core/hw/arm7/arm7.cpp index d75e6b04f..82ed47352 100644 --- a/core/hw/arm7/arm7.cpp +++ b/core/hw/arm7/arm7.cpp @@ -437,7 +437,7 @@ struct ArmDPOP u32 flags; }; -vector ops; +std::vector ops; enum OpFlags { diff --git a/core/hw/flashrom/flashrom.h b/core/hw/flashrom/flashrom.h index f77f15368..aefb5e328 100644 --- a/core/hw/flashrom/flashrom.h +++ b/core/hw/flashrom/flashrom.h @@ -45,7 +45,7 @@ struct MemChip die("Method not supported"); } - bool Load(const string& file) + bool Load(const std::string& file) { FILE* f=fopen(file.c_str(),"rb"); if (f) @@ -65,7 +65,7 @@ struct MemChip return Load(this->load_filename); } - void Save(const string& file) + void Save(const std::string& file) { FILE* f=fopen(file.c_str(),"wb"); if (f) @@ -75,7 +75,7 @@ struct MemChip } } - bool Load(const string& root,const string& prefix,const string& names_ro,const string& title) + bool Load(const std::string& root, const std::string& prefix, const std::string& names_ro, const std::string& title) { char base[512]; char temp[512]; @@ -114,7 +114,7 @@ struct MemChip return false; } - void Save(const string& root,const string& prefix,const string& name_ro,const string& title) + void Save(const std::string& root, const std::string& prefix, const std::string& name_ro, const std::string& title) { char path[512]; diff --git a/core/hw/gdrom/gdromv3.cpp b/core/hw/gdrom/gdromv3.cpp index 1fe33c7db..c5374ffea 100644 --- a/core/hw/gdrom/gdromv3.cpp +++ b/core/hw/gdrom/gdromv3.cpp @@ -102,7 +102,7 @@ static void FillReadBuffer() if (count > 32) { - hint = max(count - 32, (u32)32); + hint = std::max(count - 32, (u32)32); count = 32; } @@ -982,7 +982,7 @@ static int getGDROMTicks() if (SB_GDLEN - SB_GDLEND > 10240) return 1000000; // Large transfers: GD-ROM transfer rate 1.8 MB/s else - return min((u32)10240, SB_GDLEN - SB_GDLEND) * 2; // Small transfers: Max G1 bus rate: 50 MHz x 16 bits + return std::min((u32)10240, SB_GDLEN - SB_GDLEND) * 2; // Small transfers: Max G1 bus rate: 50 MHz x 16 bits } else return 0; @@ -1011,9 +1011,9 @@ int GDRomschd(int i, int c, int j) //if we don't have any more sectors to read if (read_params.remaining_sectors == 0) //make sure we don't underrun the cache :) - len = min(len, read_buff.cache_size); + len = std::min(len, read_buff.cache_size); - len = min(len, (u32)10240); + len = std::min(len, (u32)10240); // do we need to do this for GDROM DMA? if(0x8201 != (dmaor &DMAOR_MASK)) { diff --git a/core/hw/holly/sb_mem.cpp b/core/hw/holly/sb_mem.cpp index 8c58808b6..fe1e0c47a 100644 --- a/core/hw/holly/sb_mem.cpp +++ b/core/hw/holly/sb_mem.cpp @@ -162,7 +162,7 @@ void FixUpFlash() } } -static bool nvmem_load(const string& root) +static bool nvmem_load(const std::string& root) { bool rc; if (settings.platform.system == DC_PLATFORM_DREAMCAST) @@ -178,7 +178,7 @@ static bool nvmem_load(const string& root) return true; } -bool LoadRomFiles(const string& root) +bool LoadRomFiles(const std::string& root) { if (settings.platform.system != DC_PLATFORM_ATOMISWAVE) { @@ -201,7 +201,7 @@ bool LoadRomFiles(const string& root) return true; } -void SaveRomFiles(const string& root) +void SaveRomFiles(const std::string& root) { if (settings.platform.system == DC_PLATFORM_DREAMCAST) sys_nvmem->Save(root, getRomPrefix(), "nvmem.bin", "nvmem"); @@ -211,7 +211,7 @@ void SaveRomFiles(const string& root) sys_rom->Save(get_game_save_prefix() + ".nvmem2"); } -bool LoadHle(const string& root) +bool LoadHle(const std::string& root) { if (!nvmem_load(root)) WARN_LOG(FLASHROM, "No nvmem loaded\n"); diff --git a/core/hw/maple/maple_devs.cpp b/core/hw/maple/maple_devs.cpp index 831a5165a..83f0b7d50 100755 --- a/core/hw/maple/maple_devs.cpp +++ b/core/hw/maple/maple_devs.cpp @@ -476,7 +476,7 @@ struct maple_sega_vmu: maple_base memset(lcd_data, 0, sizeof(lcd_data)); char tempy[512]; sprintf(tempy, "/vmu_save_%s.bin", logical_port); - string apath = get_writable_data_path(tempy); + std::string apath = get_writable_data_path(tempy); file = fopen(apath.c_str(), "rb+"); if (!file) @@ -1123,18 +1123,18 @@ struct maple_sega_purupuru : maple_base INC = 0; bool CNT = VIBSET & 1; - float power = min((POW_POS + POW_NEG) / 7.0, 1.0); + float power = std::min((POW_POS + POW_NEG) / 7.0, 1.0); u32 duration_ms; if (FREQ > 0 && (!CNT || INC)) - duration_ms = min((int)(1000 * (INC ? abs(INC) * max(POW_POS, POW_NEG) : 1) / FREQ), (int)AST_ms); + duration_ms = std::min((int)(1000 * (INC ? abs(INC) * std::max(POW_POS, POW_NEG) : 1) / FREQ), (int)AST_ms); else duration_ms = AST_ms; float inclination; if (INC == 0 || power == 0) inclination = 0.0; else - inclination = FREQ / (1000.0 * INC * max(POW_POS, POW_NEG)); + inclination = FREQ / (1000.0 * INC * std::max(POW_POS, POW_NEG)); config->SetVibration(power, inclination, duration_ms); } @@ -2161,8 +2161,8 @@ struct maple_naomi_jamma : maple_sega_controller //printState(Command,buffer_in,buffer_in_len); memcpy(EEPROM + address, dma_buffer_in + 4, size); - string nvmemSuffix = cfgLoadStr("net", "nvmem", ""); - string eeprom_file = get_game_save_prefix() + nvmemSuffix + ".eeprom"; + std::string nvmemSuffix = cfgLoadStr("net", "nvmem", ""); + std::string eeprom_file = get_game_save_prefix() + nvmemSuffix + ".eeprom"; FILE* f = fopen(eeprom_file.c_str(), "wb"); if (f) { @@ -2188,8 +2188,8 @@ struct maple_naomi_jamma : maple_sega_controller if (!EEPROM_loaded) { EEPROM_loaded = true; - string nvmemSuffix = cfgLoadStr("net", "nvmem", ""); - string eeprom_file = get_game_save_prefix() + nvmemSuffix + ".eeprom"; + std::string nvmemSuffix = cfgLoadStr("net", "nvmem", ""); + std::string eeprom_file = get_game_save_prefix() + nvmemSuffix + ".eeprom"; FILE* f = fopen(eeprom_file.c_str(), "rb"); if (f) { diff --git a/core/hw/mem/vmem32.cpp b/core/hw/mem/vmem32.cpp index 4a90dcd87..dab527de6 100644 --- a/core/hw/mem/vmem32.cpp +++ b/core/hw/mem/vmem32.cpp @@ -260,7 +260,7 @@ static u32 vmem32_map_mmu(u32 address, bool write) } verify(vmem32_map_buffer(vpn, page_size, offset, page_size, allow_write) != NULL); u32 end = start + page_size; - const vector& blocks = vram_blocks[start / VRAM_PROT_SEGMENT]; + const std::vector& blocks = vram_blocks[start / VRAM_PROT_SEGMENT]; { std::lock_guard lock(vramlist_lock); @@ -268,8 +268,8 @@ static u32 vmem32_map_mmu(u32 address, bool write) { if (blocks[i].start < end && blocks[i].end >= start) { - u32 prot_start = max(start, blocks[i].start); - u32 prot_size = min(end, blocks[i].end + 1) - prot_start; + u32 prot_start = std::max(start, blocks[i].start); + u32 prot_size = std::min(end, blocks[i].end + 1) - prot_start; prot_size += prot_start % PAGE_SIZE; prot_start &= ~PAGE_MASK; vmem32_protect_buffer(vpn + (prot_start & (page_size - 1)), prot_size); diff --git a/core/hw/modem/picoppp.cpp b/core/hw/modem/picoppp.cpp index c22b19740..492050d8e 100644 --- a/core/hw/modem/picoppp.cpp +++ b/core/hw/modem/picoppp.cpp @@ -65,10 +65,10 @@ struct pico_ip4 public_ip; struct pico_ip4 afo_ip; // src socket -> socket fd -static map tcp_sockets; -static map tcp_connecting_sockets; +static std::map tcp_sockets; +static std::map tcp_connecting_sockets; // src port -> socket fd -static map udp_sockets; +static std::map udp_sockets; static const uint16_t games_udp_ports[] = { 7980, // Alien Front Online @@ -102,7 +102,7 @@ static const uint16_t games_tcp_ports[] = { 17219, // Worms World Party }; // listening port -> socket fd -static map tcp_listening_sockets; +static std::map tcp_listening_sockets; static void read_native_sockets(); void get_host_by_name(const char *name, struct pico_ip4 dnsaddr); @@ -450,7 +450,7 @@ static void read_native_sockets() for (auto it = tcp_connecting_sockets.begin(); it != tcp_connecting_sockets.end(); it++) { FD_SET(it->second, &write_fds); - max_fd = max(max_fd, (int)it->second); + max_fd = std::max(max_fd, (int)it->second); } struct timeval tv; tv.tv_sec = 0; @@ -699,11 +699,11 @@ static void *pico_thread_func(void *) { pico_stack_init(); pico_stack_inited = true; -#if _WIN32 - static WSADATA wsaData; - if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) - WARN_LOG(MODEM, "WSAStartup failed"); -#endif +#if _WIN32 + static WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) + WARN_LOG(MODEM, "WSAStartup failed"); +#endif } // PPP @@ -715,7 +715,7 @@ static void *pico_thread_func(void *) pico_string_to_ipv4("192.168.167.1", &ipaddr.addr); pico_ppp_set_ip(ppp, ipaddr); - string dns_ip = cfgLoadStr("network", "DNS", "46.101.91.123"); // Dreamcast Live DNS + std::string dns_ip = cfgLoadStr("network", "DNS", "46.101.91.123"); // Dreamcast Live DNS pico_string_to_ipv4(dns_ip.c_str(), &dnsaddr.addr); pico_ppp_set_dns1(ppp, dnsaddr); diff --git a/core/hw/naomi/gdcartridge.cpp b/core/hw/naomi/gdcartridge.cpp index df48f7ce4..43202cf61 100644 --- a/core/hw/naomi/gdcartridge.cpp +++ b/core/hw/naomi/gdcartridge.cpp @@ -590,7 +590,7 @@ void *GDCartridge::GetDmaPtr(u32 &size) return NULL; } dimm_cur_address = DmaOffset & (dimm_data_size-1); - size = min(size, dimm_data_size - dimm_cur_address); + size = std::min(size, dimm_data_size - dimm_cur_address); return dimm_data + dimm_cur_address; } @@ -609,7 +609,7 @@ bool GDCartridge::Read(u32 offset, u32 size, void *dst) return true; } u32 addr = offset & (dimm_data_size-1); - memcpy(dst, &dimm_data[addr], min(size, dimm_data_size - addr)); + memcpy(dst, &dimm_data[addr], std::min(size, dimm_data_size - addr)); return true; } diff --git a/core/hw/naomi/m1cartridge.h b/core/hw/naomi/m1cartridge.h index 3c5b5d28d..eb448849e 100644 --- a/core/hw/naomi/m1cartridge.h +++ b/core/hw/naomi/m1cartridge.h @@ -26,7 +26,7 @@ public: { if (encryption) { - size = min(size, (u32)sizeof(buffer)); + size = std::min(size, (u32)sizeof(buffer)); return buffer; } else diff --git a/core/hw/naomi/m4cartridge.cpp b/core/hw/naomi/m4cartridge.cpp index 2f31151ae..03ba81ff5 100644 --- a/core/hw/naomi/m4cartridge.cpp +++ b/core/hw/naomi/m4cartridge.cpp @@ -158,7 +158,7 @@ void *M4Cartridge::GetDmaPtr(u32 &limit) int fpr_num = m4id & 0x7f; if (((rom_cur_address >> 26) & 0x07) < fpr_num) { - limit = min(limit, (u32)2); + limit = std::min(limit, (u32)2); return &cfidata[rom_cur_address & 0xffff]; } } @@ -176,7 +176,7 @@ void *M4Cartridge::GetDmaPtr(u32 &limit) } if (encryption) { - limit = min(limit, (u32)sizeof(buffer)); + limit = std::min(limit, (u32)sizeof(buffer)); return buffer; } @@ -184,7 +184,7 @@ void *M4Cartridge::GetDmaPtr(u32 &limit) { if ((DmaOffset & 0x1ffffffe) < RomSize) { - limit = min(limit, RomSize - (DmaOffset & 0x1ffffffe)); + limit = std::min(limit, RomSize - (DmaOffset & 0x1ffffffe)); return RomPtr + (DmaOffset & 0x1ffffffe); } else diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index ccd6b87bc..c45c0ceb4 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -389,9 +389,9 @@ void naomi_cart_LoadRom(const char* file) strncpy(t, file, sizeof(t)); t[sizeof(t) - 1] = '\0'; - vector files; - vector fstart; - vector fsize; + std::vector files; + std::vector fstart; + std::vector fsize; u32 setsize = 0; bool raw_bin_file = false; @@ -461,7 +461,7 @@ void naomi_cart_LoadRom(const char* file) fstart.push_back(addr); fsize.push_back(sz); setsize += sz; - RomSize = max(RomSize, (addr + sz)); + RomSize = std::max(RomSize, (addr + sz)); } else if (line[0] != 0 && line[0] != '\n' && line[0] != '\r') WARN_LOG(NAOMI, "Warning: invalid line in .lst file: %s", line); @@ -704,7 +704,7 @@ void* NaomiCartridge::GetDmaPtr(u32& size) size = 0; return NULL; } - size = min(size, RomSize - (DmaOffset & 0x1fffffff)); + size = std::min(size, RomSize - (DmaOffset & 0x1fffffff)); return GetPtr(DmaOffset, size); } @@ -1013,7 +1013,7 @@ void* M2Cartridge::GetDmaPtr(u32& size) // 4MB mode u32 offset4mb = (DmaOffset & 0x103fffff) | ((DmaOffset & 0x07c00000) << 1); - size = min(min(size, 0x400000 - (offset4mb & 0x3FFFFF)), RomSize - offset4mb); + size = std::min(std::min(size, 0x400000 - (offset4mb & 0x3FFFFF)), RomSize - offset4mb); return GetPtr(offset4mb, size); } diff --git a/core/hw/pvr/spg.cpp b/core/hw/pvr/spg.cpp index 1e8763096..86e195c74 100755 --- a/core/hw/pvr/spg.cpp +++ b/core/hw/pvr/spg.cpp @@ -201,21 +201,21 @@ int spg_line_sched(int tag, int cycl, int jit) u32 min_active=pvr_numscanlines; if (min_scanline ctx_pool; -static vector ctx_list; +static std::vector ctx_pool; +static std::vector ctx_list; TA_context* tactx_Alloc() { diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index 7509b32fa..33e9c8940 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -366,7 +366,7 @@ void bm_Term() bm_Reset(); } -void bm_WriteBlockMap(const string& file) +void bm_WriteBlockMap(const std::string& file) { FILE* f=fopen(file.c_str(),"wb"); if (f) @@ -586,8 +586,8 @@ void bm_RamWriteAccess(u32 addr) } unprotected_pages[addr / PAGE_SIZE] = true; bm_UnlockPage(addr); - set& block_list = blocks_per_page[addr / PAGE_SIZE]; - vector list_copy; + std::set& block_list = blocks_per_page[addr / PAGE_SIZE]; + std::vector list_copy; list_copy.insert(list_copy.begin(), block_list.begin(), block_list.end()); if (!list_copy.empty()) DEBUG_LOG(DYNAREC, "bm_RamWriteAccess write access to %08x pc %08x", addr, next_pc); @@ -713,7 +713,7 @@ void print_blocks() #endif } - string s=op->dissasm(); + std::string s = op->dissasm(); fprintf(f,"//il:%d:%d: %s\n",op->guest_offs,op->host_offs,s.c_str()); } diff --git a/core/hw/sh4/dyna/blockmanager.h b/core/hw/sh4/dyna/blockmanager.h index c3f3c1f91..8dda7968a 100644 --- a/core/hw/sh4/dyna/blockmanager.h +++ b/core/hw/sh4/dyna/blockmanager.h @@ -54,7 +54,7 @@ struct RuntimeBlockInfo: RuntimeBlockInfo_Core BlockEndType BlockType; bool has_jcond; - vector oplist; + std::vector oplist; bool contains_code(u8* ptr) { @@ -67,7 +67,7 @@ struct RuntimeBlockInfo: RuntimeBlockInfo_Core virtual void Relocate(void* dst)=0; //predecessors references - vector pre_refs; + std::vector pre_refs; void AddRef(RuntimeBlockInfoPtr other); void RemRef(RuntimeBlockInfoPtr other); @@ -82,7 +82,7 @@ struct RuntimeBlockInfo: RuntimeBlockInfo_Core bool read_only; }; -void bm_WriteBlockMap(const string& file); +void bm_WriteBlockMap(const std::string& file); extern "C" { diff --git a/core/hw/sh4/dyna/decoder.cpp b/core/hw/sh4/dyna/decoder.cpp index 5cb1c1b5a..723d7fce1 100644 --- a/core/hw/sh4/dyna/decoder.cpp +++ b/core/hw/sh4/dyna/decoder.cpp @@ -1032,7 +1032,7 @@ bool dec_DecodeBlock(RuntimeBlockInfo* rbi,u32 max_cycles) } else { - blk->guest_cycles += max((int)OpDesc[op]->LatencyCycles, 1); + blk->guest_cycles += std::max((int)OpDesc[op]->LatencyCycles, 1); } if (OpDesc[op]->IsFloatingPoint()) { @@ -1157,9 +1157,9 @@ _end: blk->guest_cycles *= 1.5f; //make sure we don't use wayy-too-many cycles - blk->guest_cycles=min(blk->guest_cycles,max_cycles); + blk->guest_cycles = std::min(blk->guest_cycles, max_cycles); //make sure we don't use wayy-too-few cycles - blk->guest_cycles=max(1U,blk->guest_cycles); + blk->guest_cycles = std::max(1U, blk->guest_cycles); blk=0; return true; diff --git a/core/hw/sh4/dyna/regalloc.h b/core/hw/sh4/dyna/regalloc.h index 964f78e67..187b6ba66 100644 --- a/core/hw/sh4/dyna/regalloc.h +++ b/core/hw/sh4/dyna/regalloc.h @@ -48,7 +48,7 @@ struct RegAlloc bool aliased; - vector accesses; + std::vector accesses; RegSpan(const shil_param& prm,int pos, AccessMode mode) { @@ -196,7 +196,7 @@ struct RegAlloc }; - vector all_spans; + std::vector all_spans; u32 spills; u32 current_opid; @@ -385,7 +385,7 @@ struct RegAlloc return is_fpr && (op->rd.count()>=2 || op->rd2.count()>=2 || op->rs1.count()>=2 || op->rs2.count()>=2 || op->rs3.count()>=2 ); } - void InsertRegs(set& l, const shil_param& regs) + void InsertRegs(std::set& l, const shil_param& regs) { if (!explode_spans || (regs.count()==1 || regs.count()>2)) { @@ -546,8 +546,8 @@ struct RegAlloc } } } - set reg_wt; - set reg_rd; + std::set reg_wt; + std::set reg_rd; //insert regs into sets .. InsertRegs(reg_wt,op->rd); @@ -560,7 +560,7 @@ struct RegAlloc InsertRegs(reg_rd,op->rs3); - set::iterator iter=reg_wt.begin(); + std::set::iterator iter=reg_wt.begin(); while( iter != reg_wt.end() ) { if (reg_rd.count(*iter)) @@ -687,8 +687,8 @@ struct RegAlloc } // create register lists - deque regs; - deque regsf; + std::deque regs; + std::deque regsf; const nreg_t* nregs=nregs_avail; diff --git a/core/hw/sh4/dyna/shil.cpp b/core/hw/sh4/dyna/shil.cpp index a4441f746..14b9f834a 100644 --- a/core/hw/sh4/dyna/shil.cpp +++ b/core/hw/sh4/dyna/shil.cpp @@ -28,9 +28,9 @@ void AnalyseBlock(RuntimeBlockInfo* blk) optim.Optimize(); } -string name_reg(Sh4RegType reg) +std::string name_reg(Sh4RegType reg) { - stringstream ss; + std::stringstream ss; if (reg >= reg_fr_0 && reg <= reg_xf_15) ss << "f" << (reg - reg_fr_0); @@ -90,9 +90,9 @@ string name_reg(Sh4RegType reg) return ss.str(); } -static string dissasm_param(const shil_param& prm, bool comma) +static std::string dissasm_param(const shil_param& prm, bool comma) { - stringstream ss; + std::stringstream ss; if (!prm.is_null() && comma) ss << ", "; @@ -102,7 +102,7 @@ static string dissasm_param(const shil_param& prm, bool comma) if (prm.is_imm_s8()) ss << (s32)prm._imm ; else - ss << "0x" << hex << prm._imm; + ss << "0x" << std::hex << prm._imm; } else if (prm.is_reg()) { @@ -118,9 +118,9 @@ static string dissasm_param(const shil_param& prm, bool comma) return ss.str(); } -string shil_opcode::dissasm() const +std::string shil_opcode::dissasm() const { - stringstream ss; + std::stringstream ss; ss << shilop_str[op] << " " << dissasm_param(rd,false) << dissasm_param(rd2,true) << " <- " << dissasm_param(rs1,false) << dissasm_param(rs2,true) << dissasm_param(rs3,true); return ss.str(); } diff --git a/core/hw/sh4/dyna/shil.h b/core/hw/sh4/dyna/shil.h index d8bfbeeb2..ac9932fc3 100644 --- a/core/hw/sh4/dyna/shil.h +++ b/core/hw/sh4/dyna/shil.h @@ -156,9 +156,9 @@ struct shil_opcode u16 guest_offs; bool delay_slot; - string dissasm() const; + std::string dissasm() const; }; const char* shil_opcode_name(int op); -string name_reg(Sh4RegType reg); +std::string name_reg(Sh4RegType reg); diff --git a/core/hw/sh4/dyna/ssa_regalloc.h b/core/hw/sh4/dyna/ssa_regalloc.h index 5ce49ba39..bb2ddfab5 100644 --- a/core/hw/sh4/dyna/ssa_regalloc.h +++ b/core/hw/sh4/dyna/ssa_regalloc.h @@ -627,9 +627,9 @@ private: #endif RuntimeBlockInfo* block = NULL; - deque host_gregs; - deque host_fregs; - vector pending_flushes; + std::deque host_gregs; + std::deque host_fregs; + std::vector pending_flushes; std::map reg_alloced; int opnum = 0; diff --git a/core/hw/sh4/interpr/sh4_fpu.cpp b/core/hw/sh4/interpr/sh4_fpu.cpp index e3ad0ccda..00a933ebb 100644 --- a/core/hw/sh4/interpr/sh4_fpu.cpp +++ b/core/hw/sh4/interpr/sh4_fpu.cpp @@ -637,7 +637,7 @@ sh4op(i1111_nnnn_0011_1101) if (fpscr.PR == 0) { u32 n = GetN(op); - fpul = (u32)(s32)min(fr[n], 2147483520.0f); // IEEE 754: 0x4effffff + fpul = (u32)(s32)std::min(fr[n], 2147483520.0f); // IEEE 754: 0x4effffff // Intel CPUs convert out of range float numbers to 0x80000000. Manually set the correct sign if (fpul == 0x80000000) diff --git a/core/hw/sh4/sh4_mem.h b/core/hw/sh4/sh4_mem.h index 4dd1b5c5f..600827dd8 100644 --- a/core/hw/sh4/sh4_mem.h +++ b/core/hw/sh4/sh4_mem.h @@ -81,7 +81,7 @@ u8* GetMemPtr(u32 Addr,u32 size); bool IsOnRam(u32 addr); -bool LoadRomFiles(const string& root); -void SaveRomFiles(const string& root); -bool LoadHle(const string& root); +bool LoadRomFiles(const std::string& root); +void SaveRomFiles(const std::string& root); +bool LoadHle(const std::string& root); void FixUpFlash(); diff --git a/core/hw/sh4/sh4_sched.cpp b/core/hw/sh4/sh4_sched.cpp index af4259cbd..3c5786e29 100755 --- a/core/hw/sh4/sh4_sched.cpp +++ b/core/hw/sh4/sh4_sched.cpp @@ -24,7 +24,7 @@ u64 sh4_sched_ffb; -vector sch_list; // using list as external inside a macro confuses clang and msc +std::vector sch_list; // using list as external inside a macro confuses clang and msc int sh4_sched_next_id=-1; @@ -133,7 +133,7 @@ static void handle_cb(int id) int re_sch=sch_list[id].cb(sch_list[id].tag,remain,jitter); if (re_sch > 0) - sh4_sched_request(id, max(0, re_sch - jitter)); + sh4_sched_request(id, std::max(0, re_sch - jitter)); } void sh4_sched_tick(int cycles) diff --git a/core/imgread/common.h b/core/imgread/common.h index 35848a166..841ede138 100644 --- a/core/imgread/common.h +++ b/core/imgread/common.h @@ -1,7 +1,6 @@ #pragma once #include "types.h" #include -using namespace std; #include "deps/coreio/coreio.h" @@ -145,9 +144,9 @@ struct Track struct Disc { - wstring path; - vector sessions; //info for sessions - vector tracks; //info for tracks + std::wstring path; + std::vector sessions; //info for sessions + std::vector tracks; //info for tracks Track LeadOut; //info for lead out track (can't read from here) u32 EndFAD; //Last valid disc sector DiscType type; @@ -240,7 +239,7 @@ struct Disc EndFAD=549300; } - void Dump(const string& path) + void Dump(const std::string& path) { for (u32 i=0;i -extern string OS_dirname(string file); -extern string normalize_path_separator(string path); +extern std::string OS_dirname(std::string file); +extern std::string normalize_path_separator(std::string path); -static u32 getSectorSize(const string& type) { +static u32 getSectorSize(const std::string& type) { if (type == "AUDIO") return 2352; // PCM Audio else if (type == "CDG") @@ -70,20 +70,20 @@ Disc* cue_parse(const char* file) core_fread(fsource, cue_data, cue_len); core_fclose(fsource); - istringstream cuesheet(cue_data); + std::istringstream cuesheet(cue_data); - string basepath = OS_dirname(file); + std::string basepath = OS_dirname(file); Disc* disc = new Disc(); u32 current_fad = 150; - string track_filename; + std::string track_filename; u32 track_number = -1; - string track_type; + std::string track_type; u32 session_number = 0; while (!cuesheet.eof()) { - string token; + std::string token; cuesheet >> token; if (token == "REM") @@ -165,7 +165,7 @@ Disc* cue_parse(const char* file) t.ADDR = 0; t.StartFAD = current_fad; t.CTRL = (track_type == "AUDIO" || track_type == "CDG") ? 0 : 4; - string path = basepath + normalize_path_separator(track_filename); + std::string path = basepath + normalize_path_separator(track_filename); core_file* track_file = core_fopen(path.c_str()); if (track_file == nullptr) { diff --git a/core/imgread/gdi.cpp b/core/imgread/gdi.cpp index fb4f15948..b5acc5ca2 100644 --- a/core/imgread/gdi.cpp +++ b/core/imgread/gdi.cpp @@ -4,7 +4,7 @@ // On windows, transform / to \\ -string normalize_path_separator(string path) +std::string normalize_path_separator(std::string path) { #ifdef _WIN32 std::replace(path.begin(), path.end(), '/', '\\'); @@ -15,7 +15,7 @@ string normalize_path_separator(string path) // given file/name.ext or file\name.ext returns file/ or file\, depending on the platform // given name.ext returns ./ or .\, depending on the platform -string OS_dirname(string file) +std::string OS_dirname(std::string file) { file = normalize_path_separator(file); #ifdef _WIN32 @@ -26,9 +26,9 @@ string OS_dirname(string file) size_t last_slash = file.find_last_of(sep); - if (last_slash == string::npos) + if (last_slash == std::string::npos) { - string local_dir = "."; + std::string local_dir = "."; local_dir += sep; return local_dir; } @@ -79,7 +79,7 @@ Disc* load_gdi(const char* file) core_fread(t, gdi_data, gdi_len); core_fclose(t); - istringstream gdi(gdi_data); + std::istringstream gdi(gdi_data); u32 iso_tc = 0; gdi >> iso_tc; @@ -89,15 +89,15 @@ Disc* load_gdi(const char* file) return nullptr; } INFO_LOG(GDROM, "GDI : %d tracks", iso_tc); - - string basepath = OS_dirname(file); + + std::string basepath = OS_dirname(file); Disc* disc = new Disc(); u32 TRACK=0,FADS=0,CTRL=0,SSIZE=0; s32 OFFSET=0; for (u32 i=0;i> TRACK; @@ -141,7 +141,7 @@ Disc* load_gdi(const char* file) if (SSIZE!=0) { - string path = basepath + normalize_path_separator(track_filename); + std::string path = basepath + normalize_path_separator(track_filename); t.file = new RawTrackFile(core_fopen(path.c_str()),OFFSET,t.StartFAD,SSIZE); } disc->tracks.push_back(t); diff --git a/core/input/mapping.cpp b/core/input/mapping.cpp index 45243574e..60a800c3b 100644 --- a/core/input/mapping.cpp +++ b/core/input/mapping.cpp @@ -23,8 +23,8 @@ static struct { DreamcastKey id; - string section; - string option; + std::string section; + std::string option; } button_list[] = { @@ -54,10 +54,10 @@ button_list[] = static struct { DreamcastKey id; - string section; - string option; - string section_inverted; - string option_inverted; + std::string section; + std::string option; + std::string section_inverted; + std::string option_inverted; } axis_list[] = { diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index 30eb75842..521e28fc2 100644 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -158,15 +158,15 @@ void* rend_thread(void* p); } #endif -string find_user_config_dir() +std::string find_user_config_dir() { #ifdef USES_HOMEDIR struct stat info; - string home = ""; + std::string home = ""; if(getenv("HOME") != NULL) { // Support for the legacy config dir at "$HOME/.reicast" - string legacy_home = (string)getenv("HOME") + "/.reicast"; + std::string legacy_home = (std::string)getenv("HOME") + "/.reicast"; if((stat(legacy_home.c_str(), &info) == 0) && (info.st_mode & S_IFDIR)) { // "$HOME/.reicast" already exists, let's use it! @@ -177,12 +177,12 @@ string find_user_config_dir() * Consult the XDG Base Directory Specification for details: * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables */ - home = (string)getenv("HOME") + "/.config/reicast"; + home = (std::string)getenv("HOME") + "/.config/reicast"; } if(getenv("XDG_CONFIG_HOME") != NULL) { // If XDG_CONFIG_HOME is set explicitly, we'll use that instead of $HOME/.config - home = (string)getenv("XDG_CONFIG_HOME") + "/reicast"; + home = (std::string)getenv("XDG_CONFIG_HOME") + "/reicast"; } if(!home.empty()) @@ -200,15 +200,15 @@ string find_user_config_dir() return "."; } -string find_user_data_dir() +std::string find_user_data_dir() { #ifdef USES_HOMEDIR struct stat info; - string data = ""; + std::string data = ""; if(getenv("HOME") != NULL) { // Support for the legacy config dir at "$HOME/.reicast" - string legacy_data = (string)getenv("HOME") + "/.reicast"; + std::string legacy_data = (std::string)getenv("HOME") + "/.reicast"; if((stat(legacy_data.c_str(), &info) == 0) && (info.st_mode & S_IFDIR)) { // "$HOME/.reicast" already exists, let's use it! @@ -219,12 +219,12 @@ string find_user_data_dir() * Consult the XDG Base Directory Specification for details: * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables */ - data = (string)getenv("HOME") + "/.local/share/reicast"; + data = (std::string)getenv("HOME") + "/.local/share/reicast"; } if(getenv("XDG_DATA_HOME") != NULL) { // If XDG_DATA_HOME is set explicitly, we'll use that instead of $HOME/.config - data = (string)getenv("XDG_DATA_HOME") + "/reicast"; + data = (std::string)getenv("XDG_DATA_HOME") + "/reicast"; } if(!data.empty()) @@ -242,15 +242,15 @@ string find_user_data_dir() return "."; } -std::vector find_system_config_dirs() +std::vector find_system_config_dirs() { - std::vector dirs; + std::vector dirs; if (getenv("XDG_CONFIG_DIRS") != NULL) { - string s = (string)getenv("XDG_CONFIG_DIRS"); + std::string s = (std::string)getenv("XDG_CONFIG_DIRS"); - string::size_type pos = 0; - string::size_type n = s.find(':', pos); + std::string::size_type pos = 0; + std::string::size_type n = s.find(':', pos); while(n != std::string::npos) { dirs.push_back(s.substr(pos, n-pos) + "/reicast"); @@ -268,15 +268,15 @@ std::vector find_system_config_dirs() return dirs; } -std::vector find_system_data_dirs() +std::vector find_system_data_dirs() { - std::vector dirs; + std::vector dirs; if (getenv("XDG_DATA_DIRS") != NULL) { - string s = (string)getenv("XDG_DATA_DIRS"); + std::string s = (std::string)getenv("XDG_DATA_DIRS"); - string::size_type pos = 0; - string::size_type n = s.find(':', pos); + std::string::size_type pos = 0; + std::string::size_type n = s.find(':', pos); while(n != std::string::npos) { dirs.push_back(s.substr(pos, n-pos) + "/reicast"); @@ -305,7 +305,7 @@ int main(int argc, char* argv[]) /* Set directories */ set_user_config_dir(find_user_config_dir()); set_user_data_dir(find_user_data_dir()); - std::vector dirs; + std::vector dirs; dirs = find_system_config_dirs(); for (std::size_t i = 0; i < dirs.size(); i++) { diff --git a/core/linux-dist/x11.cpp b/core/linux-dist/x11.cpp index c43dc6dea..10c73bd15 100644 --- a/core/linux-dist/x11.cpp +++ b/core/linux-dist/x11.cpp @@ -356,7 +356,7 @@ void x11_window_create() int x11Screen = XDefaultScreen(x11_disp); float xdpi = (float)DisplayWidth(x11_disp, x11Screen) / DisplayWidthMM(x11_disp, x11Screen) * 25.4; float ydpi = (float)DisplayHeight(x11_disp, x11Screen) / DisplayHeightMM(x11_disp, x11Screen) * 25.4; - screen_dpi = max(xdpi, ydpi); + screen_dpi = std::max(xdpi, ydpi); int depth = CopyFromParent; diff --git a/core/linux/nixprof/nixprof.cpp b/core/linux/nixprof/nixprof.cpp index 759c7d10f..4327e5dd5 100644 --- a/core/linux/nixprof/nixprof.cpp +++ b/core/linux/nixprof/nixprof.cpp @@ -230,78 +230,77 @@ static void* profiler_main(void *ptr) sprintf(line, "/%d.reprof", tick_count); - string logfile=get_writable_data_path(line); + std::string logfile = get_writable_data_path(line); + + printf("Profiler thread logging to -> %s\n", logfile.c_str()); + prof_out = fopen(logfile.c_str(), "wb"); + if (!prof_out) + { + printf("Failed to open profiler file\n"); + return 0; + } - printf("Profiler thread logging to -> %s\n", logfile.c_str()); + std::set libs; - prof_out = fopen(logfile.c_str(), "wb"); - if (!prof_out) + prof_head(prof_out, "vaddr", ""); + FILE* maps = fopen("/proc/self/maps", "r"); + while (!feof(maps)) + { + fgets(line, 512, maps); + fputs(line, prof_out); + + if (strstr(line, ".so")) { - printf("Failed to open profiler file\n"); - return 0; + char file[512]; + file[0] = 0; + sscanf(line, "%*x-%*x %*s %*x %*x:%*x %*d %s\n", file); + if (strlen(file)) + libs.insert(file); } + } - set libs; + //Write map file + prof_head(prof_out, ".map", ""); + fwrite(syms_ptr, 1, syms_len, prof_out); - prof_head(prof_out, "vaddr", ""); - FILE* maps = fopen("/proc/self/maps", "r"); - while (!feof(maps)) + //write exports from .so's + for (std::set::iterator it = libs.begin(); it != libs.end(); it++) + { + elf_syms(prof_out, it->c_str()); + } + + //Write shrec syms file ! + prof_head(prof_out, "jitsym", "SH4"); + + #if FEAT_SHREC != DYNAREC_NONE + sh4_jitsym(prof_out); + #endif + + //Write arm7rec syms file ! -> to do + //prof_head(prof_out,"jitsym","ARM7"); + + prof_head(prof_out, "samples", prof_wait); + + do + { + tick_count++; + // printf("Sending SIGPROF %08X %08X\n",thread[0],thread[1]); + for (int i = 0; i < 2; i++) pthread_kill(thread[i], SIGPROF); + // printf("Sent SIGPROF\n"); + usleep(prof_wait); + // fwrite(&prof_address[0],1,sizeof(prof_address[0])*2,prof_out); + fprintf(prof_out, "%p %p\n", prof_address[0], prof_address[1]); + + if (!(tick_count % 10000)) { - fgets(line, 512, maps); - fputs(line, prof_out); - - if (strstr(line, ".so")) - { - char file[512]; - file[0] = 0; - sscanf(line, "%*x-%*x %*s %*x %*x:%*x %*d %s\n", file); - if (strlen(file)) - libs.insert(file); - } + printf("Profiler: %d ticks, flushing ..\n", tick_count); + fflush(prof_out); } + } while (prof_run); - //Write map file - prof_head(prof_out, ".map", ""); - fwrite(syms_ptr, 1, syms_len, prof_out); - - //write exports from .so's - for (set::iterator it = libs.begin(); it != libs.end(); it++) - { - elf_syms(prof_out, it->c_str()); - } - - //Write shrec syms file ! - prof_head(prof_out, "jitsym", "SH4"); - - #if FEAT_SHREC != DYNAREC_NONE - sh4_jitsym(prof_out); - #endif - - //Write arm7rec syms file ! -> to do - //prof_head(prof_out,"jitsym","ARM7"); - - prof_head(prof_out, "samples", prof_wait); - - do - { - tick_count++; - // printf("Sending SIGPROF %08X %08X\n",thread[0],thread[1]); - for (int i = 0; i < 2; i++) pthread_kill(thread[i], SIGPROF); - // printf("Sent SIGPROF\n"); - usleep(prof_wait); - // fwrite(&prof_address[0],1,sizeof(prof_address[0])*2,prof_out); - fprintf(prof_out, "%p %p\n", prof_address[0], prof_address[1]); - - if (!(tick_count % 10000)) - { - printf("Profiler: %d ticks, flushing ..\n", tick_count); - fflush(prof_out); - } - } while (prof_run); - - fclose(maps); - fclose(prof_out); + fclose(maps); + fclose(prof_out); return 0; } diff --git a/core/linux/posix_vmem.cpp b/core/linux/posix_vmem.cpp index 2e5c543aa..26fb33050 100644 --- a/core/linux/posix_vmem.cpp +++ b/core/linux/posix_vmem.cpp @@ -121,7 +121,7 @@ static int allocate_shared_filemem(unsigned size) { // if shmem does not work (or using OSX) fallback to a regular file on disk if (fd < 0) { - string path = get_writable_data_path("/dcnzorz_mem"); + std::string path = get_writable_data_path("/dcnzorz_mem"); fd = open(path.c_str(), O_CREAT|O_RDWR|O_TRUNC, S_IRWXU|S_IRWXG|S_IRWXO); unlink(path.c_str()); } diff --git a/core/nullDC.cpp b/core/nullDC.cpp index a6d94deae..19798833f 100755 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -891,7 +891,7 @@ void LoadSettings(bool game_specific) settings.rend.CustomTextures = cfgLoadBool(config_section, "rend.CustomTextures", settings.rend.CustomTextures); settings.rend.DumpTextures = cfgLoadBool(config_section, "rend.DumpTextures", settings.rend.DumpTextures); settings.rend.ScreenScaling = cfgLoadInt(config_section, "rend.ScreenScaling", settings.rend.ScreenScaling); - settings.rend.ScreenScaling = min(max(1, settings.rend.ScreenScaling), 800); + settings.rend.ScreenScaling = std::min(std::max(1, settings.rend.ScreenScaling), 800); settings.rend.ScreenStretching = cfgLoadInt(config_section, "rend.ScreenStretching", settings.rend.ScreenStretching); settings.rend.Fog = cfgLoadBool(config_section, "rend.Fog", settings.rend.Fog); settings.rend.FloatVMUs = cfgLoadBool(config_section, "rend.FloatVMUs", settings.rend.FloatVMUs); @@ -960,9 +960,9 @@ void LoadSettings(bool game_specific) } /* //make sure values are valid - settings.dreamcast.cable = min(max(settings.dreamcast.cable, 0),3); - settings.dreamcast.region = min(max(settings.dreamcast.region, 0),3); - settings.dreamcast.broadcast = min(max(settings.dreamcast.broadcast,0),4); + settings.dreamcast.cable = std::min(std::max(settings.dreamcast.cable, 0),3); + settings.dreamcast.region = std::min(std::max(settings.dreamcast.region, 0),3); + settings.dreamcast.broadcast = std::min(std::max(settings.dreamcast.broadcast,0),4); */ } @@ -1108,9 +1108,9 @@ static void cleanup_serialize(void *data) dc_resume(); } -static string get_savestate_file_path() +static std::string get_savestate_file_path() { - string state_file = settings.imgread.ImagePath; + std::string state_file = settings.imgread.ImagePath; size_t lastindex = state_file.find_last_of('/'); #ifdef _WIN32 size_t lastindex2 = state_file.find_last_of('\\'); @@ -1130,7 +1130,7 @@ static string get_savestate_file_path() void dc_savestate() { - string filename; + std::string filename; unsigned int total_size = 0 ; void *data = NULL ; void *data_ptr = NULL ; @@ -1186,7 +1186,7 @@ void dc_savestate() void dc_loadstate() { - string filename; + std::string filename; unsigned int total_size = 0 ; void *data = NULL ; void *data_ptr = NULL ; diff --git a/core/oslib/audiobackend_alsa.cpp b/core/oslib/audiobackend_alsa.cpp index 599ed1846..a7bb5b919 100644 --- a/core/oslib/audiobackend_alsa.cpp +++ b/core/oslib/audiobackend_alsa.cpp @@ -13,7 +13,7 @@ static void alsa_init() { snd_pcm_hw_params_t *params; - string device = cfgLoadStr("alsa", "device", ""); + std::string device = cfgLoadStr("alsa", "device", ""); int rc = -1; if (device.empty() || device == "auto") diff --git a/core/oslib/audiostream.cpp b/core/oslib/audiostream.cpp index a2f004520..acd17c83e 100644 --- a/core/oslib/audiostream.cpp +++ b/core/oslib/audiostream.cpp @@ -111,7 +111,7 @@ void InitAudio() SortAudioBackends(); - string audiobackend_slug = settings.audio.backend; + std::string audiobackend_slug = settings.audio.backend; audiobackend_current = GetAudioBackend(audiobackend_slug); if (audiobackend_current == nullptr) { INFO_LOG(AUDIO, "WARNING: Running without audio!"); diff --git a/core/oslib/audiostream.h b/core/oslib/audiostream.h index 293d0a0de..5a86a16cf 100644 --- a/core/oslib/audiostream.h +++ b/core/oslib/audiostream.h @@ -28,8 +28,8 @@ typedef void (*audio_backend_init_func_t)(); typedef u32 (*audio_backend_push_func_t)(const void*, u32, bool); typedef void (*audio_backend_term_func_t)(); typedef struct { - string slug; - string name; + std::string slug; + std::string name; audio_backend_init_func_t init; audio_backend_push_func_t push; audio_backend_term_func_t term; diff --git a/core/rec-ARM/rec_arm.cpp b/core/rec-ARM/rec_arm.cpp index 17111f05e..0a6680ff0 100644 --- a/core/rec-ARM/rec_arm.cpp +++ b/core/rec-ARM/rec_arm.cpp @@ -284,8 +284,8 @@ extern "C" void ngen_FailedToFindBlock_(); #include -map ccmap; -map ccnmap; +std::map ccmap; +std::map ccnmap; u32 DynaRBI::Relink() { @@ -571,7 +571,7 @@ struct CC_PS CanonicalParamType type; shil_param* par; }; -vector CC_pars; +std::vector CC_pars; void ngen_CC_Start(shil_opcode* op) { CC_pars.clear(); @@ -1075,7 +1075,7 @@ bool ngen_readm_immediate(RuntimeBlockInfo* block, shil_opcode* op, bool staging mem_op_type optp = memop_type(op); bool isram = false; - void* ptr = _vmem_read_const(op->rs1._imm, isram, max(4u, memop_bytes(optp))); + void* ptr = _vmem_read_const(op->rs1._imm, isram, std::max(4u, memop_bytes(optp))); eReg rd = (optp != SZ_32F && optp != SZ_64F) ? reg.mapg(op->rd) : r0; if (isram) @@ -1147,7 +1147,7 @@ bool ngen_writemem_immediate(RuntimeBlockInfo* block, shil_opcode* op, bool stag mem_op_type optp = memop_type(op); bool isram = false; - void* ptr = _vmem_write_const(op->rs1._imm, isram, max(4u, memop_bytes(optp))); + void* ptr = _vmem_write_const(op->rs1._imm, isram, std::max(4u, memop_bytes(optp))); eReg rs2 = r1; eFSReg rs2f = f0; diff --git a/core/rec-ARM64/rec_arm64.cpp b/core/rec-ARM64/rec_arm64.cpp index d9ca51edb..ce18a9f8a 100644 --- a/core/rec-ARM64/rec_arm64.cpp +++ b/core/rec-ARM64/rec_arm64.cpp @@ -2181,7 +2181,7 @@ private: CanonicalParamType type; shil_param* prm; }; - vector CC_pars; + std::vector CC_pars; std::vector call_regs; std::vector call_regs64; std::vector call_fregs; diff --git a/core/rec-cpp/rec_cpp.cpp b/core/rec-cpp/rec_cpp.cpp index 51a1c86e3..975e8cb9f 100644 --- a/core/rec-cpp/rec_cpp.cpp +++ b/core/rec-cpp/rec_cpp.cpp @@ -1,9 +1,6 @@ #include "types.h" -#include -#include - #if FEAT_SHREC == DYNAREC_CPP #include "hw/sh4/sh4_opcode_list.h" #include "hw/sh4/modules/ccn.h" @@ -19,6 +16,9 @@ #define SHIL_MODE 2 #include "hw/sh4/dyna/shil_canonical.h" +#include +#include + struct DynaRBI : RuntimeBlockInfo { virtual u32 Relink() { @@ -90,7 +90,7 @@ struct CC_PS shil_param* prm; }; -typedef vector CC_pars_t; +typedef std::vector CC_pars_t; struct opcode_cc_aBaCbC { @@ -1088,7 +1088,7 @@ struct opcode_blockend : public opcodeExec { template struct opcode_check_block : public opcodeExec { RuntimeBlockInfo* block; - vector code; + std::vector code; const void* ptr; opcodeExec* setup(RuntimeBlockInfo* block) { @@ -1208,7 +1208,7 @@ opcodeExec* createType2(const CC_pars_t& prms, void* fun) { } -map funs; +std::map funs; int funs_id_count; @@ -1225,7 +1225,7 @@ template <> \ opcodeExec* createType_fast(const CC_pars_t& prms, void* fun, shil_opcode* opcode) { \ typedef OPCODE_CC(sig) CTR; \ \ - static map funsf = {\ + static std::map funsf = {\ #define FAST_gis \ };\ @@ -1426,7 +1426,7 @@ FAST_gis typedef opcodeExec*(*foas)(const CC_pars_t& prms, void* fun, shil_opcode* opcode); -string getCTN(foas code); +std::string getCTN(foas code); template opcodeExec* createType(const CC_pars_t& prms, void* fun, shil_opcode* opcode) { @@ -1448,7 +1448,7 @@ opcodeExec* createType(const CC_pars_t& prms, void* fun, shil_opcode* opcode) { return rv; } -map< string, foas> unmap = { +std::map unmap = { { "aBaCbC", &createType_fast }, { "aCaCbC", &createType }, { "aCaBbC", &createType }, @@ -1483,8 +1483,8 @@ map< string, foas> unmap = { { "vV", &createType }, }; -string getCTN(foas f) { - auto it = find_if(unmap.begin(), unmap.end(), [f](const map< string, foas>::value_type& s) { return s.second == f; }); +std::string getCTN(foas f) { + auto it = find_if(unmap.begin(), unmap.end(), [f](const std::map::value_type& s) { return s.second == f; }); return it->first; } @@ -1889,7 +1889,7 @@ public: void ngen_CC_Finish(shil_opcode* op) { - string nm = ""; + std::string nm = ""; for (auto m : CC_pars) { nm += (char)(m.type + 'a'); nm += (char)(m.prm->type + 'A'); diff --git a/core/rec-x64/rec_x64.cpp b/core/rec-x64/rec_x64.cpp index 3667205ea..38a97c7c1 100644 --- a/core/rec-x64/rec_x64.cpp +++ b/core/rec-x64/rec_x64.cpp @@ -2159,16 +2159,16 @@ private: } } - vector call_regs; - vector call_regs64; - vector call_regsxmm; + std::vector call_regs; + std::vector call_regs64; + std::vector call_regsxmm; struct CC_PS { CanonicalParamType type; const shil_param* prm; }; - vector CC_pars; + std::vector CC_pars; X64RegAlloc regalloc; Xbyak::util::Cpu cpu; diff --git a/core/rec-x86/rec_x86_driver.cpp b/core/rec-x86/rec_x86_driver.cpp index 644da31a2..7df62ca43 100644 --- a/core/rec-x86/rec_x86_driver.cpp +++ b/core/rec-x86/rec_x86_driver.cpp @@ -322,8 +322,8 @@ void ngen_Compile(RuntimeBlockInfo* block, bool smc_checks, bool reset, bool sta if (prof.enable) { - set reg_wt; - set reg_rd; + std::set reg_wt; + std::set reg_rd; for (int z=0;op->rd.is_reg() && zrd.count();z++) reg_wt.insert(op->rd._reg+z); @@ -340,7 +340,7 @@ void ngen_Compile(RuntimeBlockInfo* block, bool smc_checks, bool reset, bool sta for (int z=0;op->rs3.is_reg() && zrs3.count();z++) reg_rd.insert(op->rs3._reg+z); - set::iterator iter=reg_wt.begin(); + std::set::iterator iter=reg_wt.begin(); while( iter != reg_wt.end() ) { if (reg_rd.count(*iter)) diff --git a/core/reios/descrambl.cpp b/core/reios/descrambl.cpp index c8a08f4b1..bbd3f0e3d 100644 --- a/core/reios/descrambl.cpp +++ b/core/reios/descrambl.cpp @@ -57,7 +57,7 @@ void load_chunk(u8* &src, unsigned char *ptr, unsigned long sz) int x = (my_rand() * i) >> 16; /* Swap */ - swap(idx[i], idx[x]); + std::swap(idx[i], idx[x]); /* int tmp = idx[i]; diff --git a/core/reios/reios_elf.cpp b/core/reios/reios_elf.cpp index bdadadde9..3b0d04864 100644 --- a/core/reios/reios_elf.cpp +++ b/core/reios/reios_elf.cpp @@ -4,7 +4,7 @@ #include "hw/sh4/sh4_mem.h" -bool reios_loadElf(const string& elf) { +bool reios_loadElf(const std::string& elf) { FILE* f = fopen(elf.c_str(), "rb"); if (!f) { diff --git a/core/reios/reios_elf.h b/core/reios/reios_elf.h index abe0cd8d8..7856cb5df 100644 --- a/core/reios/reios_elf.h +++ b/core/reios/reios_elf.h @@ -3,6 +3,6 @@ #include "types.h" -bool reios_loadElf(const string& elf); +bool reios_loadElf(const std::string& elf); #endif //REIOS_ELF_H diff --git a/core/rend/CustomTexture.cpp b/core/rend/CustomTexture.cpp index 627870b3e..33a73363d 100644 --- a/core/rend/CustomTexture.cpp +++ b/core/rend/CustomTexture.cpp @@ -25,7 +25,7 @@ #include // TODO Move this out of gles.cpp -u8* loadPNGData(const string& subpath, int &width, int &height); +u8* loadPNGData(const std::string& subpath, int &width, int &height); CustomTexture custom_texture; void CustomTexture::LoaderThread() diff --git a/core/rend/TexCache.cpp b/core/rend/TexCache.cpp index ee9a27239..3357d911d 100644 --- a/core/rend/TexCache.cpp +++ b/core/rend/TexCache.cpp @@ -130,10 +130,7 @@ void palette_update() pal_hash_256[i] = XXH32(&palette32_ram[i << 8], 256 * 4, 7); } - -using namespace std; - -vector VramLocks[VRAM_SIZE_MAX / PAGE_SIZE]; +std::vector VramLocks[VRAM_SIZE_MAX / PAGE_SIZE]; VArray2 vram; // vram 32-64b //List functions @@ -145,7 +142,7 @@ void vramlock_list_remove(vram_block* block) for (u32 i = base; i <= end; i++) { - vector& list = VramLocks[i]; + std::vector& list = VramLocks[i]; for (size_t j = 0; j < list.size(); j++) { if (list[j] == block) @@ -163,7 +160,7 @@ void vramlock_list_add(vram_block* block) for (u32 i = base; i <= end; i++) { - vector& list = VramLocks[i]; + std::vector& list = VramLocks[i]; // If the list is empty then we need to protect vram, otherwise it's already been done if (list.empty() || std::all_of(list.begin(), list.end(), [](vram_block *block) { return block == nullptr; })) _vmem_protect_vram(i * PAGE_SIZE, PAGE_SIZE); @@ -217,7 +214,7 @@ bool VramLockedWriteOffset(size_t offset) return false; size_t addr_hash = offset / PAGE_SIZE; - vector& list = VramLocks[addr_hash]; + std::vector& list = VramLocks[addr_hash]; { std::lock_guard lock(vramlist_lock); @@ -339,7 +336,7 @@ static inline int getThreadCount() int tcount = omp_get_num_procs() - 1; if (tcount < 1) tcount = 1; - return min(tcount, (int)settings.pvr.MaxThreads); + return std::min(tcount, (int)settings.pvr.MaxThreads); } template @@ -1082,7 +1079,7 @@ static void png_cstd_read(png_structp png_ptr, png_bytep data, png_size_t length png_error(png_ptr, "Truncated read error"); } -u8* loadPNGData(const string& fname, int &width, int &height) +u8* loadPNGData(const std::string& fname, int &width, int &height) { const char* filename=fname.c_str(); FILE* file = fopen(filename, "rb"); diff --git a/core/rend/TexCache.h b/core/rend/TexCache.h index 4f771ab0d..ade9a7dd3 100644 --- a/core/rend/TexCache.h +++ b/core/rend/TexCache.h @@ -2,6 +2,7 @@ #include "oslib/oslib.h" #include "hw/pvr/Renderer_if.h" +#include #include #include #include @@ -119,7 +120,7 @@ public: void palette_update(); -#define clamp(minv,maxv,x) min(maxv,max(minv,x)) +#define clamp(minv, maxv, x) (x < minv ? minv : x > maxv ? maxv : x) // Unpack to 16-bit word @@ -763,9 +764,9 @@ public: void CollectCleanup() { - vector list; + std::vector list; - u32 TargetFrame = max((u32)120, FrameCount) - 120; + u32 TargetFrame = std::max((u32)120, FrameCount) - 120; for (const auto& pair : cache) { @@ -816,7 +817,7 @@ static inline void MakeFogTexture(u8 *tex_data) tex_data[i + 128] = fog_table[i * 4 + 1]; } } -u8* loadPNGData(const string& fname, int &width, int &height); +u8* loadPNGData(const std::string& fname, int &width, int &height); u8* loadPNGData(const std::vector& data, int &width, int &height); void dump_screenshot(u8 *buffer, u32 width, u32 height, bool alpha = false, u32 rowPitch = 0, bool invertY = true); diff --git a/core/rend/gl4/abuffer.cpp b/core/rend/gl4/abuffer.cpp index f654fd86d..de650e555 100644 --- a/core/rend/gl4/abuffer.cpp +++ b/core/rend/gl4/abuffer.cpp @@ -262,7 +262,7 @@ void initABuffer() // get the max buffer size GLint64 size; glGetInteger64v(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &size); - pixel_buffer_size = (GLuint)min((GLint64)pixel_buffer_size, size); + pixel_buffer_size = (GLuint)std::min((GLint64)pixel_buffer_size, size); // Create the buffer glGenBuffers(1, &pixels_buffer); diff --git a/core/rend/gles/gldraw.cpp b/core/rend/gles/gldraw.cpp index 43badb113..f8766cc50 100644 --- a/core/rend/gles/gldraw.cpp +++ b/core/rend/gles/gldraw.cpp @@ -282,11 +282,11 @@ void DrawList(const List& gply, int first, int count) } } -static vector pidx_sort; +static std::vector pidx_sort; static void SortTriangles(int first, int count) { - vector vidx_sort; + std::vector vidx_sort; GenSorted(first, count, pidx_sort, vidx_sort); //Upload to GPU if needed diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 048dea1f0..fe46f03d9 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -142,7 +142,7 @@ void gui_init() //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - scaling = max(1.f, screen_dpi / 100.f * 0.75f); + scaling = std::max(1.f, screen_dpi / 100.f * 0.75f); if (scaling > 1) ImGui::GetStyle().ScaleAllSizes(scaling); @@ -1050,7 +1050,7 @@ static void gui_display_settings() ImGui::SameLine(); ShowHelpMarker("Use Vulkan instead of Open GL/GLES"); - const map scalings { + const std::map scalings { { 10, "0.1"}, { 20, "0.2" }, { 30, "0.3" }, { 40, "0.4" }, { 50, "0.5" }, { 60, "0.6" }, { 70, "0.7" }, { 80, "0.8" }, { 90, "0.9" }, { 100, "1.0 (Host native)" }, { 200, "2.0 (2x SSAA)" }, { 300, "3.0 (3x SSAA)" }, @@ -1207,7 +1207,7 @@ static void gui_display_settings() { int val = stoi(value); ImGui::SliderInt(options->caption.c_str(), &val, options->min_value, options->max_value); - (*cfg_entries)[options->cfg_name] = to_string(val); + (*cfg_entries)[options->cfg_name] = std::to_string(val); } else if (options->type == checkbox) { diff --git a/core/rend/sorter.cpp b/core/rend/sorter.cpp index c4999d662..747b7a6a8 100644 --- a/core/rend/sorter.cpp +++ b/core/rend/sorter.cpp @@ -27,18 +27,18 @@ struct IndexTrig #if 0 static float min3(float v0, float v1, float v2) { - return min(min(v0,v1),v2); + return std::min(std::min(v0, v1), v2); } static float max3(float v0, float v1, float v2) { - return max(max(v0,v1),v2); + return std::max(std::max(v0, v1), v2); } #endif static float minZ(const Vertex *v, const u32 *mod) { - return min(min(v[mod[0]].z,v[mod[1]].z),v[mod[2]].z); + return std::min(std::min(v[mod[0]].z, v[mod[1]].z), v[mod[2]].z); } static bool operator<(const IndexTrig& left, const IndexTrig& right) @@ -80,7 +80,7 @@ void SortPParams(int first, int count) u32 zv=0xFFFFFFFF; while(vtx!=vtx_end) { - zv=min(zv,(u32&)vtx->z); + zv = std::min(zv, (u32&)vtx->z); vtx++; } @@ -144,9 +144,9 @@ struct TrigBounds //find 3d bounding box for triangle TrigBounds bound(Vertex* v) { - TrigBounds rv = { min(min(v[0].x,v[1].x),v[2].x), max(max(v[0].x,v[1].x),v[2].x), - min(min(v[0].y,v[1].y),v[2].y), max(max(v[0].y,v[1].y),v[2].y), - min(min(v[0].z,v[1].z),v[2].z), max(max(v[0].z,v[1].z),v[2].z), + TrigBounds rv = { std::min(std::min(v[0].x, v[1].x), v[2].x), std::max(std::max(v[0].x,v[1].x),v[2].x), + std::min(std::min(v[0].y, v[1].y), v[2].y), std::max(std::max(v[0].y,v[1].y),v[2].y), + std::min(std::min(v[0].z, v[1].z), v[2].z), std::max(std::max(v[0].z,v[1].z),v[2].z), }; return rv; @@ -202,7 +202,7 @@ static void fill_id(u32 *d, const Vertex *v0, const Vertex *v1, const Vertex *v2 d[2] = (u32)(v2 - vb); } -void GenSorted(int first, int count, vector& pidx_sort, vector& vidx_sort) +void GenSorted(int first, int count, std::vector& pidx_sort, std::vector& vidx_sort) { u32 tess_gen=0; @@ -234,7 +234,7 @@ void GenSorted(int first, int count, vector& pidx_sort, vecto return; //make lists of all triangles, with their pid and vid - static vector lst; + static std::vector lst; lst.resize(vtx_count*4); diff --git a/core/rend/sorter.h b/core/rend/sorter.h index fa03c9503..0e1aa087e 100644 --- a/core/rend/sorter.h +++ b/core/rend/sorter.h @@ -31,4 +31,4 @@ struct SortTrigDrawParam }; // Sort based on min-z of each triangle -void GenSorted(int first, int count, vector& sorted_pp, vector& sorted_idx); +void GenSorted(int first, int count, std::vector& sorted_pp, std::vector& sorted_idx); diff --git a/core/serialize.cpp b/core/serialize.cpp index 01f4c7691..aa0f44935 100644 --- a/core/serialize.cpp +++ b/core/serialize.cpp @@ -159,7 +159,7 @@ extern Sh4RCB* p_sh4rcb; //./core/hw/sh4/sh4_sched.o extern u64 sh4_sched_ffb; -extern vector sch_list; +extern std::vector sch_list; //./core/hw/sh4/interpr/sh4_interpreter.o extern int aica_schid; diff --git a/core/stdclass.cpp b/core/stdclass.cpp index 03bd66659..57e00cf80 100644 --- a/core/stdclass.cpp +++ b/core/stdclass.cpp @@ -21,37 +21,37 @@ #include #endif -string user_config_dir; -string user_data_dir; -std::vector system_config_dirs; -std::vector system_data_dirs; +std::string user_config_dir; +std::string user_data_dir; +std::vector system_config_dirs; +std::vector system_data_dirs; -bool file_exists(const string& filename) +bool file_exists(const std::string& filename) { return (access(filename.c_str(), R_OK) == 0); } -void set_user_config_dir(const string& dir) +void set_user_config_dir(const std::string& dir) { user_config_dir = dir; } -void set_user_data_dir(const string& dir) +void set_user_data_dir(const std::string& dir) { user_data_dir = dir; } -void add_system_config_dir(const string& dir) +void add_system_config_dir(const std::string& dir) { system_config_dirs.push_back(dir); } -void add_system_data_dir(const string& dir) +void add_system_data_dir(const std::string& dir) { system_data_dirs.push_back(dir); } -string get_writable_config_path(const string& filename) +std::string get_writable_config_path(const std::string& filename) { /* Only stuff in the user_config_dir is supposed to be writable, * so we always return that. @@ -59,15 +59,15 @@ string get_writable_config_path(const string& filename) return (user_config_dir + filename); } -string get_readonly_config_path(const string& filename) +std::string get_readonly_config_path(const std::string& filename) { - string user_filepath = get_writable_config_path(filename); + std::string user_filepath = get_writable_config_path(filename); if(file_exists(user_filepath)) { return user_filepath; } - string filepath; + std::string filepath; for (unsigned int i = 0; i < system_config_dirs.size(); i++) { filepath = system_config_dirs[i] + filename; if (file_exists(filepath)) @@ -80,7 +80,7 @@ string get_readonly_config_path(const string& filename) return user_filepath; } -string get_writable_data_path(const string& filename) +std::string get_writable_data_path(const std::string& filename) { /* Only stuff in the user_data_dir is supposed to be writable, * so we always return that. @@ -88,15 +88,15 @@ string get_writable_data_path(const string& filename) return (user_data_dir + filename); } -string get_readonly_data_path(const string& filename) +std::string get_readonly_data_path(const std::string& filename) { - string user_filepath = get_writable_data_path(filename); + std::string user_filepath = get_writable_data_path(filename); if(file_exists(user_filepath)) { return user_filepath; } - string filepath; + std::string filepath; for (unsigned int i = 0; i < system_data_dirs.size(); i++) { filepath = system_data_dirs[i] + filename; if (file_exists(filepath)) @@ -109,42 +109,42 @@ string get_readonly_data_path(const string& filename) return user_filepath; } -string get_game_save_prefix() +std::string get_game_save_prefix() { - string save_file = settings.imgread.ImagePath; + std::string save_file = settings.imgread.ImagePath; size_t lastindex = save_file.find_last_of('/'); #ifdef _WIN32 size_t lastindex2 = save_file.find_last_of("\\"); - lastindex = max(lastindex, lastindex2); + lastindex = std::max(lastindex, lastindex2); #endif if (lastindex != -1) save_file = save_file.substr(lastindex + 1); return get_writable_data_path(DATA_PATH) + save_file; } -string get_game_basename() +std::string get_game_basename() { - string game_dir = settings.imgread.ImagePath; + std::string game_dir = settings.imgread.ImagePath; size_t lastindex = game_dir.find_last_of('.'); if (lastindex != -1) game_dir = game_dir.substr(0, lastindex); return game_dir; } -string get_game_dir() +std::string get_game_dir() { - string game_dir = settings.imgread.ImagePath; + std::string game_dir = settings.imgread.ImagePath; size_t lastindex = game_dir.find_last_of('/'); #ifdef _WIN32 size_t lastindex2 = game_dir.find_last_of("\\"); - lastindex = max(lastindex, lastindex2); + lastindex = std::max(lastindex, lastindex2); #endif if (lastindex != -1) game_dir = game_dir.substr(0, lastindex + 1); return game_dir; } -bool make_directory(const string& path) +bool make_directory(const std::string& path) { #if COMPILER_VC_OR_CLANG_WIN32 #define mkdir _mkdir @@ -243,7 +243,7 @@ void cResetEvent::Set()//Signal { pthread_mutex_lock( &mutx ); state=true; - pthread_cond_signal( &cond); + pthread_cond_signal( &cond); pthread_mutex_unlock( &mutx ); } void cResetEvent::Reset()//reset diff --git a/core/stdclass.h b/core/stdclass.h index 8316f221c..26df6fd9b 100644 --- a/core/stdclass.h +++ b/core/stdclass.h @@ -126,30 +126,30 @@ public : #endif //Set the path ! -void set_user_config_dir(const string& dir); -void set_user_data_dir(const string& dir); -void add_system_config_dir(const string& dir); -void add_system_data_dir(const string& dir); +void set_user_config_dir(const std::string& dir); +void set_user_data_dir(const std::string& dir); +void add_system_config_dir(const std::string& dir); +void add_system_data_dir(const std::string& dir); //subpath format: /data/fsca-table.bit -string get_writable_config_path(const string& filename); -string get_writable_data_path(const string& filename); -string get_readonly_config_path(const string& filename); -string get_readonly_data_path(const string& filename); -bool file_exists(const string& filename); -bool make_directory(const string& path); +std::string get_writable_config_path(const std::string& filename); +std::string get_writable_data_path(const std::string& filename); +std::string get_readonly_config_path(const std::string& filename); +std::string get_readonly_data_path(const std::string& filename); +bool file_exists(const std::string& filename); +bool make_directory(const std::string& path); -string get_game_save_prefix(); -string get_game_basename(); -string get_game_dir(); +std::string get_game_save_prefix(); +std::string get_game_basename(); +std::string get_game_dir(); -bool mem_region_lock(void *start, size_t len); -bool mem_region_unlock(void *start, size_t len); -bool mem_region_set_exec(void *start, size_t len); -void *mem_region_reserve(void *start, size_t len); -bool mem_region_release(void *start, size_t len); -void *mem_region_map_file(void *file_handle, void *dest, size_t len, size_t offset, bool readwrite); -bool mem_region_unmap_file(void *start, size_t len); +bool mem_region_lock(void *start, std::size_t len); +bool mem_region_unlock(void *start, std::size_t len); +bool mem_region_set_exec(void *start, std::size_t len); +void *mem_region_reserve(void *start, std::size_t len); +bool mem_region_release(void *start, std::size_t len); +void *mem_region_map_file(void *file_handle, void *dest, std::size_t len, std::size_t offset, bool readwrite); +bool mem_region_unmap_file(void *start, std::size_t len); class VArray2 { public: @@ -157,7 +157,7 @@ public: unsigned size; void Zero() { - memset(data, 0, size); + std::memset(data, 0, size); } INLINE u8& operator [](unsigned i) { diff --git a/core/types.h b/core/types.h index bda9f3d48..144f80b04 100644 --- a/core/types.h +++ b/core/types.h @@ -246,7 +246,6 @@ int darw_printf(const char* Text,...); #include #include #include -using namespace std; //used for asm-olny functions #ifdef _M_IX86 diff --git a/core/windows/winmain.cpp b/core/windows/winmain.cpp index ee149bd14..efe94b4d6 100644 --- a/core/windows/winmain.cpp +++ b/core/windows/winmain.cpp @@ -198,7 +198,7 @@ void SetupPath() { char fname[512]; GetModuleFileName(0,fname,512); - string fn=string(fname); + std::string fn = std::string(fname); fn=fn.substr(0,fn.find_last_of('\\')); set_user_config_dir(fn); set_user_data_dir(fn); diff --git a/core/wsi/sdl.cpp b/core/wsi/sdl.cpp index 70784243d..d416df401 100644 --- a/core/wsi/sdl.cpp +++ b/core/wsi/sdl.cpp @@ -74,7 +74,7 @@ bool SDLGLGraphicsContext::Init() float ddpi, hdpi, vdpi; if (!SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(window), &ddpi, &hdpi, &vdpi)) - screen_dpi = (int)roundf(max(hdpi, vdpi)); + screen_dpi = (int)roundf(std::max(hdpi, vdpi)); INFO_LOG(RENDERER, "Created SDL Window and GL Context successfully"); diff --git a/shell/apple/emulator-osx/emulator-osx/osx-main.mm b/shell/apple/emulator-osx/emulator-osx/osx-main.mm index d3b1ba0bf..6a6bde2f1 100644 --- a/shell/apple/emulator-osx/emulator-osx/osx-main.mm +++ b/shell/apple/emulator-osx/emulator-osx/osx-main.mm @@ -108,7 +108,7 @@ extern "C" void emu_gles_init(int width, int height) { char *home = getenv("HOME"); if (home != NULL) { - string config_dir = string(home) + "/.reicast"; + std::string config_dir = std::string(home) + "/.reicast"; mkdir(config_dir.c_str(), 0755); // create the directory if missing set_user_config_dir(config_dir); set_user_data_dir(config_dir); @@ -123,7 +123,7 @@ extern "C" void emu_gles_init(int width, int height) { CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); char path[PATH_MAX]; if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) - add_system_data_dir(string(path)); + add_system_data_dir(std::string(path)); CFRelease(resourcesURL); CFRelease(mainBundle);