Remove "using namespace std;"

This commit is contained in:
scribam 2020-03-29 19:29:14 +02:00
parent c1b37b56bc
commit e99aac3575
70 changed files with 387 additions and 395 deletions

View File

@ -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;
}

View File

@ -12,12 +12,12 @@
#include <cerrno>
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)

View File

@ -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);

View File

@ -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());
}

View File

@ -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 */

View File

@ -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())

View File

@ -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"<<endl;
request2 << "User-Agent: reicastdc" << endl;
//request2 << "" << endl;
request2 << "Host: " << host << endl;
request2 << "Accept: */*" << endl;
request2 << "Range: bytes=" << offs << "-" << (offs + len-1) << endl;
request2 << endl;
request2 << "GET " << path << " HTTP/1.1" << std::endl;
request2 << "User-Agent: reicastdc" << std::endl;
//request2 << "" << std::endl;
request2 << "Host: " << host << std::endl;
request2 << "Accept: */*" << std::endl;
request2 << "Range: bytes=" << offs << "-" << (offs + len-1) << std::endl;
request2 << std::endl;
}
else {
request2 << "HEAD " << path << " HTTP/1.1"<<endl;
request2 << "User-Agent: reicastdc" << endl;
//request2 << "" << endl;
request2 << "Host: " << host << endl;
request2 << endl;
request2 << "HEAD " << path << " HTTP/1.1" << std::endl;
request2 << "User-Agent: reicastdc" << std::endl;
//request2 << "" << std::endl;
request2 << "Host: " << host << std::endl;
request2 << std::endl;
}
request = request2.str();
@ -131,7 +131,7 @@ size_t HTTP_GET(string host, int port,string path, size_t offs, size_t len, void
size_t rv = 0;
for (;;) {
stringstream ss;
std::stringstream ss;
for (;;) {
char t;
if (recv(sock, &t, 1, 0) <= 0)
@ -142,11 +142,11 @@ size_t HTTP_GET(string host, int port,string path, size_t offs, size_t len, void
continue;
}
string ln = ss.str();
std::string ln = ss.str();
if (ln.size() == 1)
goto _data;
string CL = "Content-Length:";
std::string CL = "Content-Length:";
if (ln.substr(0, CL.size()) == CL) {
sscanf(ln.substr(CL.size(), ln.npos).c_str(),"%zd", &content_length);
@ -195,16 +195,16 @@ _data:
struct CORE_FILE {
FILE* f;
string path;
std::string path;
size_t seek_ptr;
string host;
std::string host;
int port;
};
core_file* core_fopen(const char* filename)
{
string p = filename;
std::string p = filename;
CORE_FILE* rv = new CORE_FILE();
rv->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);
}

View File

@ -41,7 +41,6 @@ typedef u64 unat;
#include <stdio.h>
#include <vector>
using namespace std;
#ifndef dbgbreak
#define dbgbreak __asm {int 3}

View File

@ -78,8 +78,8 @@ void x86_block::Init(dyna_reallocFP* ral,dyna_finalizeFP* alf)
x86_size=0;
do_realloc=true;
}
#define patches (*(vector<code_patch>*) _patches)
#define labels (*(vector<x86_Label*>*) _labels)
#define patches (*(std::vector<code_patch>*) _patches)
#define labels (*(std::vector<x86_Label*>*) _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<extern_entry> externs;
std::vector<extern_entry> externs;
void Apply(u8* base)
{
@ -236,8 +236,8 @@ void x86_block::ApplyPatches(u8* base)
}
x86_block::x86_block()
{
_patches=new vector<code_patch>;
_labels=new vector<x86_Label*>;
_patches = new std::vector<code_patch>;
_labels = new std::vector<x86_Label*>;
opcode_count=0;
}
x86_block::~x86_block()

View File

@ -5,7 +5,6 @@
#include <TargetConditionals.h>
#endif
using namespace std;
//Oh god , x86 is a sooo badly designed opcode arch -_-
const char* DissasmClass(x86_opcode_class opcode);

View File

@ -233,7 +233,7 @@ void encode_rex(x86_block* block,encoded_type* mrm,u32 mrm_reg,u32 ofe=0)
}
}
#endif
#define block_patches (*(vector<code_patch>*) block->_patches)
#define block_patches (*(std::vector<code_patch>*) 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>

View File

@ -28,7 +28,6 @@
#include <algorithm>
#include <cmath>
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);

View File

@ -437,7 +437,7 @@ struct ArmDPOP
u32 flags;
};
vector<ArmDPOP> ops;
std::vector<ArmDPOP> ops;
enum OpFlags
{

View File

@ -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];

View File

@ -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))
{

View File

@ -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");

View File

@ -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)
{

View File

@ -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<vram_lock>& blocks = vram_blocks[start / VRAM_PROT_SEGMENT];
const std::vector<vram_lock>& blocks = vram_blocks[start / VRAM_PROT_SEGMENT];
{
std::lock_guard<cMutex> 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);

View File

@ -65,10 +65,10 @@ struct pico_ip4 public_ip;
struct pico_ip4 afo_ip;
// src socket -> socket fd
static map<struct pico_socket *, sock_t> tcp_sockets;
static map<struct pico_socket *, sock_t> tcp_connecting_sockets;
static std::map<struct pico_socket *, sock_t> tcp_sockets;
static std::map<struct pico_socket *, sock_t> tcp_connecting_sockets;
// src port -> socket fd
static map<uint16_t, sock_t> udp_sockets;
static std::map<uint16_t, sock_t> 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<uint16_t, sock_t> tcp_listening_sockets;
static std::map<uint16_t, sock_t> 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);

View File

@ -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;
}

View File

@ -26,7 +26,7 @@ public:
{
if (encryption)
{
size = min(size, (u32)sizeof(buffer));
size = std::min(size, (u32)sizeof(buffer));
return buffer;
}
else

View File

@ -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

View File

@ -389,9 +389,9 @@ void naomi_cart_LoadRom(const char* file)
strncpy(t, file, sizeof(t));
t[sizeof(t) - 1] = '\0';
vector<string> files;
vector<u32> fstart;
vector<u32> fsize;
std::vector<std::string> files;
std::vector<u32> fstart;
std::vector<u32> 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);
}

View File

@ -201,21 +201,21 @@ int spg_line_sched(int tag, int cycl, int jit)
u32 min_active=pvr_numscanlines;
if (min_scanline<SPG_VBLANK_INT.vblank_in_interrupt_line_number)
min_active=min(min_active,SPG_VBLANK_INT.vblank_in_interrupt_line_number);
min_active = std::min(min_active,SPG_VBLANK_INT.vblank_in_interrupt_line_number);
if (min_scanline<SPG_VBLANK_INT.vblank_out_interrupt_line_number)
min_active=min(min_active,SPG_VBLANK_INT.vblank_out_interrupt_line_number);
min_active = std::min(min_active,SPG_VBLANK_INT.vblank_out_interrupt_line_number);
if (min_scanline<SPG_VBLANK.vstart)
min_active=min(min_active,SPG_VBLANK.vstart);
min_active = std::min(min_active,SPG_VBLANK.vstart);
if (min_scanline<SPG_VBLANK.vbend)
min_active=min(min_active,SPG_VBLANK.vbend);
min_active = std::min(min_active,SPG_VBLANK.vbend);
if (lightgun_line != 0xffff && min_scanline < lightgun_line)
min_active = min(min_active, lightgun_line);
min_active = std::min(min_active, lightgun_line);
min_active=max(min_active,min_scanline);
min_active = std::max(min_active,min_scanline);
return (min_active - prv_cur_scanline) * Line_Cycles;
}
@ -229,7 +229,7 @@ void read_lightgun_position(int x, int y)
{
lightgun_line = y / (SPG_CONTROL.interlace ? 2 : 1) + SPG_VBLANK_INT.vblank_out_interrupt_line_number;
lightgun_hpos = x * (SPG_HBLANK.hstart - SPG_HBLANK.hbend) / 640 + SPG_HBLANK.hbend * 2; // Ok but why *2 ????
lightgun_hpos = min((u32)0x3FF, lightgun_hpos);
lightgun_hpos = std::min((u32)0x3FF, lightgun_hpos);
}
}

View File

@ -183,8 +183,8 @@ void FinishRender(TA_context* ctx)
static cMutex mtx_pool;
static vector<TA_context*> ctx_pool;
static vector<TA_context*> ctx_list;
static std::vector<TA_context*> ctx_pool;
static std::vector<TA_context*> ctx_list;
TA_context* tactx_Alloc()
{

View File

@ -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<RuntimeBlockInfo*>& block_list = blocks_per_page[addr / PAGE_SIZE];
vector<RuntimeBlockInfo*> list_copy;
std::set<RuntimeBlockInfo*>& block_list = blocks_per_page[addr / PAGE_SIZE];
std::vector<RuntimeBlockInfo*> 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());
}

View File

@ -54,7 +54,7 @@ struct RuntimeBlockInfo: RuntimeBlockInfo_Core
BlockEndType BlockType;
bool has_jcond;
vector<shil_opcode> oplist;
std::vector<shil_opcode> oplist;
bool contains_code(u8* ptr)
{
@ -67,7 +67,7 @@ struct RuntimeBlockInfo: RuntimeBlockInfo_Core
virtual void Relocate(void* dst)=0;
//predecessors references
vector<RuntimeBlockInfoPtr> pre_refs;
std::vector<RuntimeBlockInfoPtr> 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" {

View File

@ -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;

View File

@ -48,7 +48,7 @@ struct RegAlloc
bool aliased;
vector<RegAccess> accesses;
std::vector<RegAccess> accesses;
RegSpan(const shil_param& prm,int pos, AccessMode mode)
{
@ -196,7 +196,7 @@ struct RegAlloc
};
vector<RegSpan*> all_spans;
std::vector<RegSpan*> 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<shil_param>& l, const shil_param& regs)
void InsertRegs(std::set<shil_param>& l, const shil_param& regs)
{
if (!explode_spans || (regs.count()==1 || regs.count()>2))
{
@ -546,8 +546,8 @@ struct RegAlloc
}
}
}
set<shil_param> reg_wt;
set<shil_param> reg_rd;
std::set<shil_param> reg_wt;
std::set<shil_param> reg_rd;
//insert regs into sets ..
InsertRegs(reg_wt,op->rd);
@ -560,7 +560,7 @@ struct RegAlloc
InsertRegs(reg_rd,op->rs3);
set<shil_param>::iterator iter=reg_wt.begin();
std::set<shil_param>::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<nreg_t> regs;
deque<nregf_t> regsf;
std::deque<nreg_t> regs;
std::deque<nregf_t> regsf;
const nreg_t* nregs=nregs_avail;

View File

@ -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();
}

View File

@ -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);

View File

@ -627,9 +627,9 @@ private:
#endif
RuntimeBlockInfo* block = NULL;
deque<nreg_t> host_gregs;
deque<nregf_t> host_fregs;
vector<Sh4RegType> pending_flushes;
std::deque<nreg_t> host_gregs;
std::deque<nregf_t> host_fregs;
std::vector<Sh4RegType> pending_flushes;
std::map<Sh4RegType, reg_alloc> reg_alloced;
int opnum = 0;

View File

@ -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)

View File

@ -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();

View File

@ -24,7 +24,7 @@
u64 sh4_sched_ffb;
vector<sched_list> sch_list; // using list as external inside a macro confuses clang and msc
std::vector<sched_list> 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)

View File

@ -1,7 +1,6 @@
#pragma once
#include "types.h"
#include <vector>
using namespace std;
#include "deps/coreio/coreio.h"
@ -145,9 +144,9 @@ struct Track
struct Disc
{
wstring path;
vector<Session> sessions; //info for sessions
vector<Track> tracks; //info for tracks
std::wstring path;
std::vector<Session> sessions; //info for sessions
std::vector<Track> 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<tracks.size();i++)
{

View File

@ -20,10 +20,10 @@
#include "common.h"
#include <sstream>
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)
{

View File

@ -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<iso_tc;i++)
{
string track_filename;
std::string track_filename;
//TRACK FADS CTRL SSIZE file OFFSET
gdi >> 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);

View File

@ -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[] =
{

View File

@ -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<string> find_system_config_dirs()
std::vector<std::string> find_system_config_dirs()
{
std::vector<string> dirs;
std::vector<std::string> 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<string> find_system_config_dirs()
return dirs;
}
std::vector<string> find_system_data_dirs()
std::vector<std::string> find_system_data_dirs()
{
std::vector<string> dirs;
std::vector<std::string> 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<string> dirs;
std::vector<std::string> dirs;
dirs = find_system_config_dirs();
for (std::size_t i = 0; i < dirs.size(); i++)
{

View File

@ -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;

View File

@ -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<std::string> 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<string> 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<std::string>::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<string>::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;
}

View File

@ -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());
}

View File

@ -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 ;

View File

@ -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")

View File

@ -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!");

View File

@ -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;

View File

@ -284,8 +284,8 @@ extern "C" void ngen_FailedToFindBlock_();
#include <map>
map<shilop,ConditionCode> ccmap;
map<shilop,ConditionCode> ccnmap;
std::map<shilop,ConditionCode> ccmap;
std::map<shilop,ConditionCode> ccnmap;
u32 DynaRBI::Relink()
{
@ -571,7 +571,7 @@ struct CC_PS
CanonicalParamType type;
shil_param* par;
};
vector<CC_PS> CC_pars;
std::vector<CC_PS> 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;

View File

@ -2181,7 +2181,7 @@ private:
CanonicalParamType type;
shil_param* prm;
};
vector<CC_PS> CC_pars;
std::vector<CC_PS> CC_pars;
std::vector<const WRegister*> call_regs;
std::vector<const XRegister*> call_regs64;
std::vector<const VRegister*> call_fregs;

View File

@ -1,9 +1,6 @@
#include "types.h"
#include <map>
#include <algorithm>
#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 <algorithm>
#include <map>
struct DynaRBI : RuntimeBlockInfo
{
virtual u32 Relink() {
@ -90,7 +90,7 @@ struct CC_PS
shil_param* prm;
};
typedef vector<CC_PS> CC_pars_t;
typedef std::vector<CC_PS> CC_pars_t;
struct opcode_cc_aBaCbC {
@ -1088,7 +1088,7 @@ struct opcode_blockend : public opcodeExec {
template <int sz>
struct opcode_check_block : public opcodeExec {
RuntimeBlockInfo* block;
vector<u8> code;
std::vector<u8> code;
const void* ptr;
opcodeExec* setup(RuntimeBlockInfo* block) {
@ -1208,7 +1208,7 @@ opcodeExec* createType2(const CC_pars_t& prms, void* fun) {
}
map<void*, int> funs;
std::map<void*, int> funs;
int funs_id_count;
@ -1225,7 +1225,7 @@ template <> \
opcodeExec* createType_fast<OPCODE_CC(sig)>(const CC_pars_t& prms, void* fun, shil_opcode* opcode) { \
typedef OPCODE_CC(sig) CTR; \
\
static map<void*, opcodeExec* (*)(const CC_pars_t& prms, void* fun)> funsf = {\
static std::map<void*, opcodeExec* (*)(const CC_pars_t& prms, void* fun)> 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 <typename CTR>
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<std::string, foas> unmap = {
{ "aBaCbC", &createType_fast<opcode_cc_aBaCbC> },
{ "aCaCbC", &createType<opcode_cc_aCaCbC> },
{ "aCaBbC", &createType<opcode_cc_aCaBbC> },
@ -1483,8 +1483,8 @@ map< string, foas> unmap = {
{ "vV", &createType<opcode_cc_vV> },
};
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<std::string, foas>::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');

View File

@ -2159,16 +2159,16 @@ private:
}
}
vector<Xbyak::Reg32> call_regs;
vector<Xbyak::Reg64> call_regs64;
vector<Xbyak::Xmm> call_regsxmm;
std::vector<Xbyak::Reg32> call_regs;
std::vector<Xbyak::Reg64> call_regs64;
std::vector<Xbyak::Xmm> call_regsxmm;
struct CC_PS
{
CanonicalParamType type;
const shil_param* prm;
};
vector<CC_PS> CC_pars;
std::vector<CC_PS> CC_pars;
X64RegAlloc regalloc;
Xbyak::util::Cpu cpu;

View File

@ -322,8 +322,8 @@ void ngen_Compile(RuntimeBlockInfo* block, bool smc_checks, bool reset, bool sta
if (prof.enable)
{
set<int> reg_wt;
set<int> reg_rd;
std::set<int> reg_wt;
std::set<int> reg_rd;
for (int z=0;op->rd.is_reg() && z<op->rd.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() && z<op->rs3.count();z++)
reg_rd.insert(op->rs3._reg+z);
set<int>::iterator iter=reg_wt.begin();
std::set<int>::iterator iter=reg_wt.begin();
while( iter != reg_wt.end() )
{
if (reg_rd.count(*iter))

View File

@ -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];

View File

@ -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) {

View File

@ -3,6 +3,6 @@
#include "types.h"
bool reios_loadElf(const string& elf);
bool reios_loadElf(const std::string& elf);
#endif //REIOS_ELF_H

View File

@ -25,7 +25,7 @@
#include <sstream>
// 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()

View File

@ -130,10 +130,7 @@ void palette_update()
pal_hash_256[i] = XXH32(&palette32_ram[i << 8], 256 * 4, 7);
}
using namespace std;
vector<vram_block*> VramLocks[VRAM_SIZE_MAX / PAGE_SIZE];
std::vector<vram_block*> 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<vram_block*>& list = VramLocks[i];
std::vector<vram_block*>& 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<vram_block*>& list = VramLocks[i];
std::vector<vram_block*>& 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<vram_block *>& list = VramLocks[addr_hash];
std::vector<vram_block *>& list = VramLocks[addr_hash];
{
std::lock_guard<cMutex> 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<typename Func>
@ -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");

View File

@ -2,6 +2,7 @@
#include "oslib/oslib.h"
#include "hw/pvr/Renderer_if.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <memory>
@ -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<u64> list;
std::vector<u64> 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<u8>& data, int &width, int &height);
void dump_screenshot(u8 *buffer, u32 width, u32 height, bool alpha = false, u32 rowPitch = 0, bool invertY = true);

View File

@ -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);

View File

@ -282,11 +282,11 @@ void DrawList(const List<PolyParam>& gply, int first, int count)
}
}
static vector<SortTrigDrawParam> pidx_sort;
static std::vector<SortTrigDrawParam> pidx_sort;
static void SortTriangles(int first, int count)
{
vector<u32> vidx_sort;
std::vector<u32> vidx_sort;
GenSorted(first, count, pidx_sort, vidx_sort);
//Upload to GPU if needed

View File

@ -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<int, const char*> scalings {
const std::map<int, const char*> 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)
{

View File

@ -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<SortTrigDrawParam>& pidx_sort, vector<u32>& vidx_sort)
void GenSorted(int first, int count, std::vector<SortTrigDrawParam>& pidx_sort, std::vector<u32>& vidx_sort)
{
u32 tess_gen=0;
@ -234,7 +234,7 @@ void GenSorted(int first, int count, vector<SortTrigDrawParam>& pidx_sort, vecto
return;
//make lists of all triangles, with their pid and vid
static vector<IndexTrig> lst;
static std::vector<IndexTrig> lst;
lst.resize(vtx_count*4);

View File

@ -31,4 +31,4 @@ struct SortTrigDrawParam
};
// Sort based on min-z of each triangle
void GenSorted(int first, int count, vector<SortTrigDrawParam>& sorted_pp, vector<u32>& sorted_idx);
void GenSorted(int first, int count, std::vector<SortTrigDrawParam>& sorted_pp, std::vector<u32>& sorted_idx);

View File

@ -159,7 +159,7 @@ extern Sh4RCB* p_sh4rcb;
//./core/hw/sh4/sh4_sched.o
extern u64 sh4_sched_ffb;
extern vector<sched_list> sch_list;
extern std::vector<sched_list> sch_list;
//./core/hw/sh4/interpr/sh4_interpreter.o
extern int aica_schid;

View File

@ -21,37 +21,37 @@
#include <unistd.h>
#endif
string user_config_dir;
string user_data_dir;
std::vector<string> system_config_dirs;
std::vector<string> system_data_dirs;
std::string user_config_dir;
std::string user_data_dir;
std::vector<std::string> system_config_dirs;
std::vector<std::string> 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

View File

@ -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) {

View File

@ -246,7 +246,6 @@ int darw_printf(const char* Text,...);
#include <vector>
#include <string>
#include <map>
using namespace std;
//used for asm-olny functions
#ifdef _M_IX86

View File

@ -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);

View File

@ -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");

View File

@ -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);