mirror of https://github.com/PCSX2/pcsx2.git
Added a few new calls to PathUtils, and used them to get rid of some platform specific code in the new Iso code. I also modified some other code to use the new calls, and fixed a few microVU compiler warnings.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1559 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
9f35752ed8
commit
20b95fd187
|
@ -136,6 +136,7 @@ struct PcsxConfig
|
|||
{
|
||||
public:
|
||||
char Bios[g_MaxPath];
|
||||
|
||||
char GS[g_MaxPath];
|
||||
char PAD1[g_MaxPath];
|
||||
char PAD2[g_MaxPath];
|
||||
|
@ -144,9 +145,11 @@ public:
|
|||
char DEV9[g_MaxPath];
|
||||
char USB[g_MaxPath];
|
||||
char FW[g_MaxPath];
|
||||
|
||||
char PluginsDir[g_MaxPath];
|
||||
char BiosDir[g_MaxPath];
|
||||
char InisDir[g_MaxPath]; // This is intended for the program to populate, and the plugins to read. Obviously can't be saved in the config file. :)
|
||||
|
||||
char Lang[g_MaxPath];
|
||||
|
||||
McdConfig Mcd[2];
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
// TODO: fix this for linux! (hardcoded as _WIN32 only)
|
||||
#define ENABLE_TIMESTAMPS
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -53,9 +52,11 @@ int CheckDiskTypeFS(int baseType)
|
|||
static struct TocEntry tocEntry;
|
||||
|
||||
IsoFS_init();
|
||||
|
||||
|
||||
f = IsoFS_open("SYSTEM.CNF;1", 1);
|
||||
|
||||
// check if the file exists
|
||||
if ((f=IsoFS_open("SYSTEM.CNF;1", 1)) >= 0)
|
||||
if (f >= 0)
|
||||
{
|
||||
int size = IsoFS_read(f, buffer, 256);
|
||||
IsoFS_close(f);
|
||||
|
@ -91,9 +92,7 @@ int FindDiskType(int mType)
|
|||
{
|
||||
int dataTracks = 0;
|
||||
int audioTracks = 0;
|
||||
|
||||
int iCDType = mType;
|
||||
|
||||
cdvdTN tn;
|
||||
|
||||
CDVD.getTN(&tn);
|
||||
|
@ -105,6 +104,7 @@ int FindDiskType(int mType)
|
|||
else if (mType < 0)
|
||||
{
|
||||
cdvdTD td;
|
||||
|
||||
CDVD.getTD(0,&td);
|
||||
if (td.lsn > 452849)
|
||||
{
|
||||
|
@ -153,6 +153,7 @@ int FindDiskType(int mType)
|
|||
for(int i = tn.strack; i <= tn.etrack; i++)
|
||||
{
|
||||
cdvdTD td,td2;
|
||||
|
||||
CDVD.getTD(i,&td);
|
||||
|
||||
if (tn.etrack > i)
|
||||
|
@ -260,20 +261,15 @@ s32 DoCDVDopen(const char* pTitleFilename)
|
|||
int ret = CDVD.open(pTitleFilename);
|
||||
int cdtype = DoCDVDdetectDiskType();
|
||||
|
||||
if((Config.Blockdump)&&(cdtype != CDVD_TYPE_NODISC))
|
||||
if ((Config.Blockdump) && (cdtype != CDVD_TYPE_NODISC))
|
||||
{
|
||||
char fname_only[g_MaxPath];
|
||||
|
||||
if(CDVD.init == ISO.init)
|
||||
if (CDVD.init == ISO.init)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char fname[MAX_PATH], ext[g_MaxPath];
|
||||
_splitpath(isoFileName, NULL, NULL, fname, ext);
|
||||
_makepath(fname_only, NULL, NULL, fname, NULL);
|
||||
#else
|
||||
getcwd(fname_only, ArraySize(fname_only)); // Base it out of the current directory for now.
|
||||
strcat(fname_only, Path::GetFilenameWithoutExt(isoFileName).c_str());
|
||||
#endif
|
||||
// Base it out of the current directory for now.
|
||||
string temp = Path::GetWorkingDirectory() + Path::GetFilenameWithoutExt(isoFileName);
|
||||
strcpy(fname_only, temp.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -34,10 +34,13 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
char *file = NULL;
|
||||
char elfname[g_MaxPath];
|
||||
string MainDirString;
|
||||
|
||||
efile = 0;
|
||||
|
||||
getcwd(MAIN_DIR, ArraySize(MAIN_DIR)); /* store main dir */
|
||||
/* store main dir */
|
||||
MainDirString = Path::GetWorkingDirectory();
|
||||
strcpy(MAIN_DIR, MainDirString.c_str());
|
||||
Console::Notice("MAIN_DIR is %s", params MAIN_DIR);
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
|
@ -51,12 +54,12 @@ int main(int argc, char *argv[])
|
|||
sprintf(Config.InisDir, "%s/%s/", MAIN_DIR, DEFAULT_INIS_DIR);
|
||||
sprintf(cfgfile, "%s/pcsx2.cfg", Config.InisDir);
|
||||
#else
|
||||
mkdir("~/.pcsx2");
|
||||
chdir("~/.pcsx2");
|
||||
mkdir(DEFAULT_INIS_DIR, 0755);
|
||||
Path::CreateDirectory(string("~/.pcsx2"));
|
||||
Path::ChangeDirectory(string("~/.pcsx2"));
|
||||
Path::CreateDirectory(string(DEFAULT_INIS_DIR));
|
||||
sprintf(Config.InisDir, "~/.pcsx2/%s/", DEFAULT_INIS_DIR);
|
||||
sprintf(cfgfile, "%s/pcsx2.cfg", Config.InisDir);
|
||||
chdir(MAIN_DIR);
|
||||
Path::ChangeDirectory(string(MAIN_DIR));
|
||||
#endif
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
|
@ -144,8 +147,6 @@ int main(int argc, char *argv[])
|
|||
if (!efile) efile = GetPS2ElfName(elfname);
|
||||
loadElfFile(elfname);
|
||||
|
||||
//ExecuteCpu();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -350,6 +351,7 @@ void OnFile_RunBIOS(GtkMenuItem *menuitem, gpointer user_data)
|
|||
void OnRunIso_Ok(GtkButton* button, gpointer user_data)
|
||||
{
|
||||
gchar *File;
|
||||
string curdir;
|
||||
CDVD = ISO;
|
||||
|
||||
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
void OnConf_Memcards(GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
char file[g_MaxPath], card[g_MaxPath];
|
||||
string file;
|
||||
char card[g_MaxPath];
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
struct stat statinfo;
|
||||
|
@ -37,10 +38,10 @@ void OnConf_Memcards(GtkMenuItem *menuitem, gpointer user_data)
|
|||
set_checked(MemDlg, "check_enable_mcd2", Config.Mcd[1].Enabled);
|
||||
set_checked(MemDlg, "check_eject_mcds", Config.McdEnableEject);
|
||||
|
||||
getcwd(file, ArraySize(file)); /* store current dir */
|
||||
sprintf(card, "%s/%s", file, MEMCARDS_DIR );
|
||||
chdir(card); /* change dirs so that plugins can find their config file*/
|
||||
|
||||
file = Path::GetCurrentDirectory();/* store current dir */
|
||||
sprintf(card, "%s/%s", file.c_str(), MEMCARDS_DIR );
|
||||
Path::ChangeDirectory(string(card));/* change dirs so that plugins can find their config file*/
|
||||
|
||||
if ((dir = opendir(card)) == NULL)
|
||||
{
|
||||
Console::Error("ERROR: Could not open directory %s\n", params card);
|
||||
|
@ -72,8 +73,7 @@ void OnConf_Memcards(GtkMenuItem *menuitem, gpointer user_data)
|
|||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
chdir(file);
|
||||
Path::ChangeDirectory(file);
|
||||
gtk_widget_show_all(MemDlg);
|
||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||
gtk_main();
|
||||
|
|
|
@ -156,6 +156,7 @@ void SaveConfig()
|
|||
SetValue("Lang", Config.Lang);
|
||||
SetValue("PluginsDir", Config.PluginsDir);
|
||||
SetValue("BiosDir", Config.BiosDir);
|
||||
|
||||
SetValuel("Ps2Out", Config.PsxOut);
|
||||
SetValuel("cdvdPrint", Config.cdvdPrint);
|
||||
|
||||
|
|
|
@ -255,11 +255,31 @@ string GetRootDirectory( const string& src )
|
|||
void CreateDirectory( const string& src )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_mkdir( src.c_str() );
|
||||
_mkdir(src.c_str());
|
||||
#else
|
||||
mkdir( src.c_str(), 0755);
|
||||
#endif
|
||||
}
|
||||
|
||||
string GetWorkingDirectory(void)
|
||||
{
|
||||
char curdir[g_MaxPath];
|
||||
#ifdef _WIN32
|
||||
_getcwd(curdir, ArraySize(curdir));
|
||||
#else
|
||||
getcwd(curdir, ArraySize(curdir));
|
||||
#endif
|
||||
return string(curdir);
|
||||
}
|
||||
|
||||
void ChangeDirectory(const string& src)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_chdir(src.c_str() );
|
||||
#else
|
||||
chdir(src.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,24 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _PCSX2_PATHS_H_
|
||||
#define _PCSX2_PATHS_H_
|
||||
|
||||
|
||||
#define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs.
|
||||
|
||||
#ifdef __LINUX__
|
||||
|
@ -41,7 +58,8 @@ namespace Path
|
|||
extern void Split( const std::string& src, std::string& destpath, std::string& destfile );
|
||||
|
||||
extern void CreateDirectory( const std::string& src );
|
||||
|
||||
extern std::string GetWorkingDirectory(void);
|
||||
extern void ChangeDirectory(const std::string& src);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -268,7 +268,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
_getcwd( g_WorkingFolder, g_MaxPath );
|
||||
strcpy(g_WorkingFolder, Path::GetWorkingDirectory().c_str());
|
||||
|
||||
int argc;
|
||||
TCHAR *const *const argv = _CommandLineToArgv( lpCmdLine, &argc );
|
||||
|
@ -286,7 +286,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
MessageBox( NULL, phelpmsg, "Pcsx2 Help", MB_OK);
|
||||
|
||||
case -1: // exit...
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
|
|
|
@ -98,7 +98,7 @@ static void (*SSE_SS[]) (x86SSERegType, x86SSERegType) = {
|
|||
};
|
||||
|
||||
// Prints Opcode to MicroProgram Logs
|
||||
void mVU_printOP(microVU* mVU, int opCase, char* opName, bool isACC) {
|
||||
void mVU_printOP(microVU* mVU, int opCase, const char* opName, bool isACC) {
|
||||
mVUlog(opName);
|
||||
opCase1 { if (isACC) { mVUlogACC(); } else { mVUlogFd(); } mVUlogFt(); }
|
||||
opCase2 { if (isACC) { mVUlogACC(); } else { mVUlogFd(); } mVUlogBC(); }
|
||||
|
@ -130,7 +130,7 @@ void setupFtReg(microVU* mVU, int& Ft, int opCase) {
|
|||
}
|
||||
|
||||
// Normal FMAC Opcodes
|
||||
void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, char* opName) {
|
||||
void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, const char* opName) {
|
||||
pass1 { setupPass1(mVU, opCase, isACC, ((opType == 3) || (opType == 4))); }
|
||||
pass2 {
|
||||
int Fs, Ft, ACC;
|
||||
|
@ -171,7 +171,7 @@ void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, ch
|
|||
}
|
||||
|
||||
// MADDA/MSUBA Opcodes
|
||||
void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, char* opName) {
|
||||
void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, const char* opName) {
|
||||
pass1 { setupPass1(mVU, opCase, 1, 0); }
|
||||
pass2 {
|
||||
int Fs, Ft, ACC;
|
||||
|
@ -215,7 +215,7 @@ void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, char* opName)
|
|||
}
|
||||
|
||||
// MADD Opcodes
|
||||
void mVU_FMACc(microVU* mVU, int recPass, int opCase, char* opName) {
|
||||
void mVU_FMACc(microVU* mVU, int recPass, int opCase, const char* opName) {
|
||||
pass1 { setupPass1(mVU, opCase, 0, 0); }
|
||||
pass2 {
|
||||
int Fs, Ft, ACC;
|
||||
|
@ -247,7 +247,7 @@ void mVU_FMACc(microVU* mVU, int recPass, int opCase, char* opName) {
|
|||
}
|
||||
|
||||
// MSUB Opcodes
|
||||
void mVU_FMACd(microVU* mVU, int recPass, int opCase, char* opName) {
|
||||
void mVU_FMACd(microVU* mVU, int recPass, int opCase, const char* opName) {
|
||||
pass1 { setupPass1(mVU, opCase, 0, 0); }
|
||||
pass2 {
|
||||
int Fs, Ft, Fd;
|
||||
|
@ -335,7 +335,7 @@ mVUop(mVU_OPMSUB) {
|
|||
}
|
||||
|
||||
// FTOI0/FTIO4/FTIO12/FTIO15 Opcodes
|
||||
void mVU_FTOIx(mP, uptr addr, char* opName) {
|
||||
void mVU_FTOIx(mP, uptr addr, const char* opName) {
|
||||
pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); }
|
||||
pass2 {
|
||||
if (!_Ft_) return;
|
||||
|
@ -364,7 +364,7 @@ void mVU_FTOIx(mP, uptr addr, char* opName) {
|
|||
}
|
||||
|
||||
// ITOF0/ITOF4/ITOF12/ITOF15 Opcodes
|
||||
void mVU_ITOFx(mP, uptr addr, char* opName) {
|
||||
void mVU_ITOFx(mP, uptr addr, const char* opName) {
|
||||
pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); }
|
||||
pass2 {
|
||||
if (!_Ft_) return;
|
||||
|
|
Loading…
Reference in New Issue