- renamed pcsx2pg.ini to pcsx2.ini

- made pcsx2 to default to MTGS mode "on" instead of "off"
- renamed "Mega VU" recs to "Micro VU" recs since the team thought "Mega" sounded lame ;p

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@439 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2009-02-07 01:20:44 +00:00
parent f70ce7be01
commit 73d6a8aca0
9 changed files with 104 additions and 105 deletions

View File

@ -68,7 +68,7 @@ extern SessionOverrideFlags g_Session;
//////////////////////////////////////////////////////////////////////////
// Pcsx2 User Configuration Options!
//#define PCSX2_MEGAVU // Use Mega VU recs instead of Zero VU Recs
//#define PCSX2_MICROVU // Use Micro VU recs instead of Zero VU Recs
#define PCSX2_GSMULTITHREAD 1 // uses multi-threaded gs
#define PCSX2_EEREC 0x10
#define PCSX2_VU0REC 0x20

View File

@ -2325,30 +2325,30 @@
>
</File>
<Filter
Name="megaVU"
Name="microVU"
>
<File
RelativePath="..\..\x86\megaVU.cpp"
RelativePath="..\..\x86\microVU.cpp"
>
</File>
<File
RelativePath="..\..\x86\megaVU.h"
RelativePath="..\..\x86\microVU.h"
>
</File>
<File
RelativePath="..\..\x86\megaVU_Lower.cpp"
RelativePath="..\..\x86\microVU_Lower.cpp"
>
</File>
<File
RelativePath="..\..\x86\megaVU_Tables.cpp"
RelativePath="..\..\x86\microVU_Tables.cpp"
>
</File>
<File
RelativePath="..\..\x86\megaVU_Tables.h"
RelativePath="..\..\x86\microVU_Tables.h"
>
</File>
<File
RelativePath="..\..\x86\megaVU_Upper.cpp"
RelativePath="..\..\x86\microVU_Upper.cpp"
>
</File>
</Filter>

View File

@ -49,7 +49,7 @@ static void GetConfigFilename( string& dest )
// Our current working directory can change, so we use the one we detected
// at startup:
Path::Combine( dest, g_WorkingFolder, CONFIG_DIR "\\pcsx2pg.ini" );
Path::Combine( dest, g_WorkingFolder, CONFIG_DIR "\\pcsx2.ini" );
}
}
@ -128,7 +128,7 @@ public:
//cpu
SetCurrentSection( "Cpu" );
Entry( "Options", Conf.Options, PCSX2_EEREC|PCSX2_VU0REC|PCSX2_VU1REC );
Entry( "Options", Conf.Options, PCSX2_EEREC|PCSX2_VU0REC|PCSX2_VU1REC|PCSX2_GSMULTITHREAD );
Entry( "sseMXCSR", Conf.sseMXCSR, DEFAULT_sseMXCSR );
Entry( "sseVUMXCSR", Conf.sseVUMXCSR, DEFAULT_sseVUMXCSR );
Entry( "eeOptions", Conf.eeOptions, DEFAULT_eeOptions );

View File

@ -1,4 +1,4 @@
/* Pcsx2-Playground - Pc Ps2 Emulator
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2009 Pcsx2-Playground Team
*
* This program is free software; you can redistribute it and/or modify
@ -16,25 +16,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
// Mega VU(micro) recompiler! - author: cottonvibes(@gmail.com)
// Micro VU recompiler! - author: cottonvibes(@gmail.com)
#include "PrecompiledHeader.h"
#include "megaVU.h"
#ifdef PCSX2_MEGAVU
#include "microVU.h"
#ifdef PCSX2_MICROVU
//------------------------------------------------------------------
// Mega VU - Global Variables
// VU Micro - Global Variables
//------------------------------------------------------------------
megaVU megaVU0;
megaVU megaVU1;
microVU microVU0;
microVU microVU1;
//------------------------------------------------------------------
// Mega VU - Main Functions
// Micro VU - Main Functions
//------------------------------------------------------------------
// Only run this once! ;)
__forceinline void mVUinit(megaVU* mVU, VURegs* vuRegsPtr, const int vuIndex) {
__forceinline void mVUinit(microVU* mVU, VURegs* vuRegsPtr, const int vuIndex) {
mVU->regs = vuRegsPtr;
mVU->index = vuIndex;
@ -45,7 +44,7 @@ __forceinline void mVUinit(megaVU* mVU, VURegs* vuRegsPtr, const int vuIndex) {
for (int i; i <= mVU->prog.max; i++) {
for (u32 j; j < mVU->progSize; j++) {
mVU->prog.prog[i].block[j] = new megaBlockManager();
mVU->prog.prog[i].block[j] = new microBlockManager();
}
}
@ -53,13 +52,13 @@ __forceinline void mVUinit(megaVU* mVU, VURegs* vuRegsPtr, const int vuIndex) {
}
// Will Optimize later
__forceinline void mVUreset(megaVU* mVU) {
__forceinline void mVUreset(microVU* mVU) {
mVUclose(mVU); // Close
// Dynarec Cache
mVU->cache = SysMmap(mVU->cacheAddr, mVU->cacheSize, 0x10000000, "Mega VU");
if ( mVU->cache == NULL ) throw Exception::OutOfMemory(fmt_string( "megaVU Error: failed to allocate recompiler memory! (addr: 0x%x)", params (u32)mVU->cache));
mVU->cache = SysMmapEx(mVU->cacheAddr, mVU->cacheSize, 0x10000000, "Mega VU");
if ( mVU->cache == NULL ) throw Exception::OutOfMemory(fmt_string( "microVU Error: failed to allocate recompiler memory! (addr: 0x%x)", params (u32)mVU->cache));
// Other Variables
ZeroMemory(&mVU->prog, sizeof(mVU->prog));
@ -70,7 +69,7 @@ __forceinline void mVUreset(megaVU* mVU) {
}
// Free Allocated Resources
__forceinline void mVUclose(megaVU* mVU) {
__forceinline void mVUclose(microVU* mVU) {
if ( mVU->cache ) { SysMunmap( mVU->cache, mVU->cacheSize ); mVU->cache = NULL; }
@ -82,7 +81,7 @@ __forceinline void mVUclose(megaVU* mVU) {
}
// Clears Block Data in specified range (Caches current microProgram if a difference has been found)
__forceinline void mVUclear(megaVU* mVU, u32 addr, u32 size) {
__forceinline void mVUclear(microVU* mVU, u32 addr, u32 size) {
int i = addr/8;
int end = i+((size+(8-(size&7)))/8); // ToDo: Can be simplified to addr+size if Size is always a multiple of 8
@ -103,12 +102,12 @@ __forceinline void mVUclear(megaVU* mVU, u32 addr, u32 size) {
}
// Executes for number of cycles
void* mVUexecute(megaVU* mVU, u32 startPC, u32 cycles) {
void* mVUexecute(microVU* mVU, u32 startPC, u32 cycles) {
return NULL;
}
// Executes till finished
void* mVUexecuteF(megaVU* mVU, u32 startPC) {
void* mVUexecuteF(microVU* mVU, u32 startPC) {
//if (!mProg.finished) {
// runMicroProgram(startPC);
//}
@ -119,11 +118,11 @@ void* mVUexecuteF(megaVU* mVU, u32 startPC) {
}
//------------------------------------------------------------------
// Mega VU - Private Functions
// Micro VU - Private Functions
//------------------------------------------------------------------
// Finds the least used program
__forceinline int mVUfindLeastUsedProg(megaVU* mVU) {
__forceinline int mVUfindLeastUsedProg(microVU* mVU) {
if (mVU->prog.total < mVU->prog.max) {
mVU->prog.total++;
return mVU->prog.total;
@ -142,14 +141,14 @@ __forceinline int mVUfindLeastUsedProg(megaVU* mVU) {
}
// Caches Micro Program if appropriate
__forceinline void mVUcacheProg(megaVU* mVU) {
__forceinline void mVUcacheProg(microVU* mVU) {
if (!mVU->prog.prog[mVU->prog.cur].cached) { // If uncached, then cache
memcpy_fast(mVU->prog.prog[mVU->prog.cur].data, mVU->regs->Micro, mVU->microSize);
}
}
// Searches for Cached Micro Program and sets prog.cur (returns -1 if no program found)
__forceinline int mVUsearchProg(megaVU* mVU) {
__forceinline int mVUsearchProg(microVU* mVU) {
if (mVU->prog.cleared) { // If cleared, we need to search for new program
for (int i = 0; i <= mVU->prog.total; i++) {
if (!memcmp_mmx(mVU->prog.prog[i].data, mVU->regs->Micro, mVU->microSize)) {
@ -167,38 +166,38 @@ __forceinline int mVUsearchProg(megaVU* mVU) {
//------------------------------------------------------------------
// Runs till finished
__declspec(naked) void runVU0(megaVU* mVU, u32 startPC) {
__declspec(naked) void runVU0(microVU* mVU, u32 startPC) {
__asm {
mov eax, dword ptr [esp]
mov megaVU0.x86callstack, eax
mov microVU0.x86callstack, eax
add esp, 4
call mVUexecuteF
/*backup cpu state*/
mov megaVU0.x86ebp, ebp
mov megaVU0.x86esi, esi
mov megaVU0.x86edi, edi
mov megaVU0.x86ebx, ebx
/*mov megaVU0.x86esp, esp*/
mov microVU0.x86ebp, ebp
mov microVU0.x86esi, esi
mov microVU0.x86edi, edi
mov microVU0.x86ebx, ebx
/*mov microVU0.x86esp, esp*/
ldmxcsr g_sseVUMXCSR
jmp eax
}
}
__declspec(naked) void runVU1(megaVU* mVU, u32 startPC) {
__declspec(naked) void runVU1(microVU* mVU, u32 startPC) {
__asm {
mov eax, dword ptr [esp]
mov megaVU1.x86callstack, eax
mov microVU1.x86callstack, eax
add esp, 4
call mVUexecuteF
/*backup cpu state*/
mov megaVU1.x86ebp, ebp
mov megaVU1.x86esi, esi
mov megaVU1.x86edi, edi
mov megaVU1.x86ebx, ebx
/*mov megaVU1.x86esp, esp*/
mov microVU1.x86ebp, ebp
mov microVU1.x86esi, esi
mov microVU1.x86edi, edi
mov microVU1.x86ebx, ebx
/*mov microVU1.x86esp, esp*/
ldmxcsr g_sseVUMXCSR
@ -207,38 +206,38 @@ __declspec(naked) void runVU1(megaVU* mVU, u32 startPC) {
}
// Runs for number of cycles
__declspec(naked) void runVU0(megaVU* mVU, u32 startPC, u32 cycles) {
__declspec(naked) void runVU0(microVU* mVU, u32 startPC, u32 cycles) {
__asm {
mov eax, dword ptr [esp]
mov megaVU0.x86callstack, eax
mov microVU0.x86callstack, eax
add esp, 4
call mVUexecute
/*backup cpu state*/
mov megaVU0.x86ebp, ebp
mov megaVU0.x86esi, esi
mov megaVU0.x86edi, edi
mov megaVU0.x86ebx, ebx
/*mov megaVU0.x86esp, esp*/
mov microVU0.x86ebp, ebp
mov microVU0.x86esi, esi
mov microVU0.x86edi, edi
mov microVU0.x86ebx, ebx
/*mov microVU0.x86esp, esp*/
ldmxcsr g_sseVUMXCSR
jmp eax
}
}
__declspec(naked) void runVU1(megaVU* mVU, u32 startPC, u32 cycles) {
__declspec(naked) void runVU1(microVU* mVU, u32 startPC, u32 cycles) {
__asm {
mov eax, dword ptr [esp]
mov megaVU1.x86callstack, eax
mov microVU1.x86callstack, eax
add esp, 4
call mVUexecute
/*backup cpu state*/
mov megaVU1.x86ebp, ebp
mov megaVU1.x86esi, esi
mov megaVU1.x86edi, edi
mov megaVU1.x86ebx, ebx
/*mov megaVU1.x86esp, esp*/
mov microVU1.x86ebp, ebp
mov microVU1.x86esi, esi
mov microVU1.x86edi, edi
mov microVU1.x86ebx, ebx
/*mov microVU1.x86esp, esp*/
ldmxcsr g_sseVUMXCSR
@ -250,33 +249,33 @@ __declspec(naked) void runVU1(megaVU* mVU, u32 startPC, u32 cycles) {
//------------------------------------------------------------------
__forceinline void initVUrec(VURegs* vuRegs, int vuIndex) {
if (!vuIndex) mVUinit(&megaVU0, vuRegs, 0);
else mVUinit(&megaVU1, vuRegs, 1);
if (!vuIndex) mVUinit(&microVU0, vuRegs, 0);
else mVUinit(&microVU1, vuRegs, 1);
}
__forceinline void closeVUrec(int vuIndex) {
if (!vuIndex) mVUclose(&megaVU0);
else mVUclose(&megaVU1);
if (!vuIndex) mVUclose(&microVU0);
else mVUclose(&microVU1);
}
__forceinline void resetVUrec(int vuIndex) {
if (!vuIndex) mVUreset(&megaVU0);
else mVUreset(&megaVU1);
if (!vuIndex) mVUreset(&microVU0);
else mVUreset(&microVU1);
}
__forceinline void clearVUrec(u32 addr, u32 size, int vuIndex) {
if (!vuIndex) mVUclear(&megaVU0, addr, size);
else mVUclear(&megaVU1, addr, size);
if (!vuIndex) mVUclear(&microVU0, addr, size);
else mVUclear(&microVU1, addr, size);
}
__forceinline void runVUrec(u32 startPC, int vuIndex) {
if (!vuIndex) runVU0(&megaVU0, startPC);
else runVU1(&megaVU1, startPC);
if (!vuIndex) runVU0(&microVU0, startPC);
else runVU1(&microVU1, startPC);
}
__forceinline void runVUrec(u32 startPC, u32 cycles, int vuIndex) {
if (!vuIndex) runVU0(&megaVU0, startPC, cycles);
else runVU1(&megaVU1, startPC, cycles);
if (!vuIndex) runVU0(&microVU0, startPC, cycles);
else runVU1(&microVU1, startPC, cycles);
}
#endif // PCSX2_MEGAVU

View File

@ -1,4 +1,4 @@
/* Pcsx2-Playground - Pc Ps2 Emulator
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2009 Pcsx2-Playground Team
*
* This program is free software; you can redistribute it and/or modify
@ -17,12 +17,13 @@
*/
#pragma once
#include "PrecompiledHeader.h"
#include "Common.h"
#include "VU.h"
#include "megaVU_Tables.h"
#include "microVU_Tables.h"
//#include <vector>
struct megaBlock {
struct microBlock {
u32 pipelineState; // FMACx|y|z|w | FDiv | EFU | IALU | BRANCH // Still thinking of how I'm going to do this
u32 x86ptrStart;
u32 x86ptrEnd;
@ -31,19 +32,19 @@ struct megaBlock {
};
#define mMaxBlocks 32 // Max Blocks With Different Pipeline States (For n = 1, 2, 4, 8, 16, etc...)
class megaBlockManager {
class microBlockManager {
private:
static const int MaxBlocks = mMaxBlocks - 1;
u32 startPC;
u32 endPC;
int listSize; // Total Items - 1
int callerSize; // Total Callers - 1
megaBlock blockList[mMaxBlocks];
megaBlock callersList[mMaxBlocks]; // Foreign Blocks that call Local Blocks
microBlock blockList[mMaxBlocks];
microBlock callersList[mMaxBlocks]; // Foreign Blocks that call Local Blocks
public:
megaBlockManager() { init(); }
~megaBlockManager() { close(); }
microBlockManager() { init(); }
~microBlockManager() { close(); }
void init() {
listSize = -1;
callerSize = -1;
@ -58,7 +59,7 @@ public:
blockList[listSize].x86ptrStart = x86ptrStart;
}
}
megaBlock* search(u32 pipelineState) {
microBlock* search(u32 pipelineState) {
for (int i = 0; i < listSize; i++) {
if (blockList[i].pipelineState == pipelineState) return &blockList[i];
}
@ -80,7 +81,7 @@ struct microProgram {
u8 data[progSize];
u32 used; // Number of times its been used
int cached; // Has been Cached?
megaBlockManager* block[progSize];
microBlockManager* block[progSize];
};
#define mMaxProg 16 // The amount of Micro Programs Recs will 'remember' (For n = 1, 2, 4, 8, 16, etc...)
@ -94,7 +95,7 @@ struct microProgManager {
int finished; // Completed MicroProgram to E-bit Termination
};
struct megaVU {
struct microVU {
int index; // VU Index (VU0 or VU1)
u32 microSize; // VU Micro Memory Size
u32 progSize; // VU Micro Program Size (microSize/8)
@ -120,13 +121,13 @@ extern void (*mVU_UPPER_OPCODE[64])( VURegs* VU, s32 info );
extern void (*mVU_LOWER_OPCODE[128])( VURegs* VU, s32 info );
//void invalidateBlocks(u32 addr, u32 size); // Invalidates Blocks in the range [addr, addr+size)
__forceinline void mVUinit(megaVU* mVU, VURegs* vuRegsPtr, const int vuIndex);
__forceinline void mVUreset(megaVU* mVU);
__forceinline void mVUclose(megaVU* mVU);
__forceinline void mVUclear(megaVU* mVU, u32 addr, u32 size); // Clears part of a Micro Program (must use before modifying micro program!)
void* mVUexecute(megaVU* mVU, u32 startPC, u32 cycles); // Recompiles/Executes code for the number of cycles indicated (will always run for >= 'cycles' amount unless 'finished')
void* mVUexecuteF(megaVU* mVU, u32 startPC); // Recompiles/Executes code till finished
__forceinline void mVUinit(microVU* mVU, VURegs* vuRegsPtr, const int vuIndex);
__forceinline void mVUreset(microVU* mVU);
__forceinline void mVUclose(microVU* mVU);
__forceinline void mVUclear(microVU* mVU, u32 addr, u32 size); // Clears part of a Micro Program (must use before modifying micro program!)
void* mVUexecute(microVU* mVU, u32 startPC, u32 cycles); // Recompiles/Executes code for the number of cycles indicated (will always run for >= 'cycles' amount unless 'finished')
void* mVUexecuteF(microVU* mVU, u32 startPC); // Recompiles/Executes code till finished
__forceinline int mVUfindLeastUsedProg(megaVU* mVU);
__forceinline int mVUsearchProg(megaVU* mVU);
__forceinline void mVUcacheProg(megaVU* mVU);
__forceinline int mVUfindLeastUsedProg(microVU* mVU);
__forceinline int mVUsearchProg(microVU* mVU);
__forceinline void mVUcacheProg(microVU* mVU);

View File

@ -1,4 +1,4 @@
/* Pcsx2-Playground - Pc Ps2 Emulator
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2009 Pcsx2-Playground Team
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
/* Pcsx2-Playground - Pc Ps2 Emulator
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2009 Pcsx2-Playground Team
*
* This program is free software; you can redistribute it and/or modify
@ -16,10 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "PrecompiledHeader.h"
#include "megaVU.h"
#include "microVU.h"
#ifdef PCSX2_MEGAVU_lulz
#ifdef PCSX2_MICROVU_lulz
void mVU_UPPER_FD_00(VURegs* VU, s32 info);
void mVU_UPPER_FD_01(VURegs* VU, s32 info);

View File

@ -1,4 +1,4 @@
/* Pcsx2-Playground - Pc Ps2 Emulator
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2009 Pcsx2-Playground Team
*
* This program is free software; you can redistribute it and/or modify
@ -99,12 +99,12 @@ void mVU_MAXx(VURegs *vuRegs, int info);
void mVU_MAXy(VURegs *vuRegs, int info);
void mVU_MAXz(VURegs *vuRegs, int info);
void mVU_MAXw(VURegs *vuRegs, int info);
void mVU_MIN(VURegs *vuRegs, int info);
void mVU_MINi(VURegs *vuRegs, int info);
void mVU_MINx(VURegs *vuRegs, int info);
void mVU_MINy(VURegs *vuRegs, int info);
void mVU_MINz(VURegs *vuRegs, int info);
void mVU_MINw(VURegs *vuRegs, int info);
void mVU_MINI(VURegs *vuRegs, int info);
void mVU_MINIi(VURegs *vuRegs, int info);
void mVU_MINIx(VURegs *vuRegs, int info);
void mVU_MINIy(VURegs *vuRegs, int info);
void mVU_MINIz(VURegs *vuRegs, int info);
void mVU_MINIw(VURegs *vuRegs, int info);
void mVU_OPMULA(VURegs *vuRegs, int info);
void mVU_OPMSUB(VURegs *vuRegs, int info);
void mVU_NOP(VURegs *vuRegs, int info);

View File

@ -1,4 +1,4 @@
/* Pcsx2-Playground - Pc Ps2 Emulator
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2009 Pcsx2-Playground Team
*
* This program is free software; you can redistribute it and/or modify