This commit is contained in:
zilmar 2017-07-19 16:35:25 +10:00
commit ad8566ac1f
32 changed files with 696 additions and 644 deletions

View File

@ -23,6 +23,7 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/Project64-video/CRC.cpp \
$(SRCDIR)/Project64-video/Debugger.cpp \
$(SRCDIR)/Project64-video/DepthBufferRender.cpp \
$(SRCDIR)/Project64-video/F3DTEXA.cpp \
$(SRCDIR)/Project64-video/FBtoScreen.cpp \
$(SRCDIR)/Project64-video/Main.cpp \
$(SRCDIR)/Project64-video/rdp.cpp \

View File

@ -15,6 +15,9 @@
// 6 - S2DEX 1.XX (Yoshi's Story - SimCity 2000)
// 7 - RSP SW PD (Perfect Dark)
// 8 - F3DEXBG 2.08 (Conker's Bad Fur Day)
// 9 - zSort
// 10 - F3DTEXA (64 de Hakken)
// 21 - Turbo 3D
[ucode]
006bd77f=0
03044b84=2
@ -158,7 +161,7 @@ e89c2b92=1
e9231df2=1
ec040469=1
ee47381b=1
ef54ee35=1
ef54ee35=10
f9893f70=21
fb816260=1
ff372492=21

View File

@ -2004,8 +2004,7 @@ Culling=1
[F774EAEE-F0D8B13E-C:4A]
Good Name=Fushigi no Dungeon - Fuurai no Shiren 2 - Oni Shuurai! Shiren Jou! (J)
Internal Name=F3 フウライノシレン2
Status=Issues (Core)
Core Note=Constant SRAM use
Status=Compatible
Counter Factor=1
32bit=No
@ -2491,9 +2490,8 @@ Counter Factor=1
[3A6F8C6B-2897BAEB-C:50]
Good Name=Indiana Jones and the Infernal Machine (E) (Unreleased)
Internal Name=Indiana Jones
Status=Only intro/part OK
Core Note=Camera issue; can't play
Plugin Note=[Glide64] errors:various
Status=Issues (plugin)
Plugin Note=[video] HLE not supported
32bit=No
AudioResetOnLoad=Yes
Counter Factor=1
@ -2511,9 +2509,8 @@ ViRefresh=1800
[AF9DCC15-1A723D88-C:45]
Good Name=Indiana Jones and the Infernal Machine (U)
Internal Name=Indiana Jones
Status=Only intro/part OK
Core Note=Camera issue; can't play
Plugin Note=[Glide64] errors:various
Status=Issues (plugin)
Plugin Note=[video] HLE not supported
32bit=No
AudioResetOnLoad=Yes
Counter Factor=1
@ -3264,6 +3261,7 @@ Self Texture=1
Good Name=Mario Kart 64 (E) (V1.0)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A1C 2409,81001A1E 0002,81001C74 240A,81001C76 0002 //Multiplayer timing fix
Plugin Note=[Glide64] missing TVs
Culling=1
Primary Frame Buffer=1
@ -3272,6 +3270,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (E) (V1.1)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A1C 2409,81001A1E 0002,81001C74 240A,81001C76 0002 //Multiplayer timing fix
Plugin Note=[Glide64] missing TVs
Culling=1
Primary Frame Buffer=1
@ -3280,6 +3279,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (J) (V1.0)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A1C 2409,81001A1E 0002,81001C74 240A,81001C76 0002 //Multiplayer timing fix
Plugin Note=[Glide64] missing TVs
Culling=1
Primary Frame Buffer=1
@ -3288,6 +3288,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (J) (V1.1)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A1C 2409,81001A1E 0002,81001C74 240A,81001C76 0002 //Multiplayer timing fix
Plugin Note=[Glide64] missing TVs
Culling=1
Primary Frame Buffer=1
@ -5425,9 +5426,8 @@ RDRAM Size=8
[EAE6ACE2-020B4384-C:50]
Good Name=Star Wars Episode I - Battle for Naboo (E)
Internal Name=Battle for Naboo
Status=Only intro/part OK
Core Note=Camera issue; can't play
Plugin Note=[Glide64] errors:various
Status=Issues (plugin)
Plugin Note=[video] HLE not supported
32bit=No
AudioResetOnLoad=Yes
Counter Factor=1
@ -5438,9 +5438,8 @@ SMM-FUNC=0
[3D02989B-D4A381E2-C:45]
Good Name=Star Wars Episode I - Battle for Naboo (U)
Internal Name=Battle for Naboo
Status=Only intro/part OK
Core Note=Camera issue; can't play
Plugin Note=[Glide64] errors:various
Status=Issues (plugin)
Plugin Note=[video] HLE not supported
32bit=No
AudioResetOnLoad=Yes
Counter Factor=1

10
Directory.Build.props Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Platform Condition="'$(Platform)' == ''">Win32</Platform>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>
</Project>

View File

@ -107,6 +107,7 @@ bool pjutil::TerminatedExistingExe()
if (TerminateProcess(hHandle, 0))
{
bTerminated = true;
WaitForSingleObject(hHandle, 30 * 1000);
}
else
{

View File

@ -321,6 +321,7 @@ enum LanguageStringID
ROM_COUNTPERBYTE = 537,
ROM_32BIT = 538,
ROM_DELAY_DP = 539,
ROM_OVER_CLOCK_MODIFIER = 5400,
//Core Styles
CORE_INTERPTER = 540,
@ -535,7 +536,7 @@ enum LanguageStringID
MSG_DEL_TITLE = 2042,
MSG_CHEAT_NAME_IN_USE = 2043,
MSG_MAX_CHEATS = 2044,
MSG_PLUGIN_INIT = 2045,
MSG_PLUGIN_INIT = 2045,
MSG_NO_SHORTCUT_SEL = 2046,
MSG_NO_MENUITEM_SEL = 2047,
MSG_MENUITEM_ASSIGNED = 2048,
@ -591,7 +592,7 @@ enum LanguageStringID
ANDROID_MENU_DUMPFUNCTIONTIMES = 3113,
//Video plugin
ANDROID_VIDEO_NATIVE_RES = 3200,
ANDROID_VIDEO_NATIVE_RES = 3200,
};
#include "Multilanguage/LanguageClass.h"

View File

@ -289,6 +289,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(ROM_COUNTPERBYTE, "AI count per byte:");
DEF_STR(ROM_32BIT, "32-bit engine:");
DEF_STR(ROM_DELAY_DP, "Delay DP interrupt:");
DEF_STR(ROM_OVER_CLOCK_MODIFIER, "Over Clock Modifier:");
//Core Styles
DEF_STR(CORE_INTERPTER, "Interpreter");
@ -822,4 +823,4 @@ const std::wstring wGS(LanguageStringID StringID)
{
return stdstr(g_Lang->GetString(StringID)).ToUTF16();
}
#endif
#endif

View File

@ -16,9 +16,12 @@
#include <Project64-core/Plugins/AudioPlugin.h>
#include <Project64-core/Plugins/RSPPlugin.h>
#include <Project64-core/Plugins/ControllerPlugin.h>
#include <Project64-core/N64System/SystemGlobals.h>
#include <Project64-core/N64System/Recompiler/RecompilerClass.h>
#include <stdlib.h>
CCheats::CCheats()
CCheats::CCheats(CMipsMemoryVM & MMU) :
m_MMU(MMU)
{
}
@ -26,15 +29,32 @@ CCheats::~CCheats()
{
}
bool CCheats::LoadCode(int CheatNo, const char * CheatString)
bool CCheats::LoadCode(const stdstr & CheatEntry, SettingID ExtensionSetting, int ExtensionIndex)
{
//Find the start and end of the name which is surrounded in ""
int StartOfName = CheatEntry.find("\"");
if (StartOfName == -1)
{
return false;
}
int EndOfName = CheatEntry.find("\"", StartOfName + 1);
if (EndOfName == -1)
{
return false;
}
const char * CheatString = &CheatEntry.c_str()[EndOfName + 2];
if (!IsValid16BitCode(CheatString))
{
return false;
}
const char * ReadPos = CheatString;
stdstr Extension;
if (!g_Settings->LoadStringIndex(ExtensionSetting, ExtensionIndex, Extension))
{
Extension.clear();
}
const char * ReadPos = CheatString;
CODES Code;
while (ReadPos)
{
@ -47,26 +67,20 @@ bool CCheats::LoadCode(int CheatNo, const char * CheatString)
if (strncmp(ReadPos, "????", 4) == 0)
{
if (CheatNo < 0 || CheatNo > MaxCheats) { return false; }
stdstr CheatExt = g_Settings->LoadStringIndex(Cheat_Extension, CheatNo);
if (CheatExt.empty()) { return false; }
CodeEntry.Value = CheatExt[0] == '$' ? (uint16_t)strtoul(&CheatExt.c_str()[1], 0, 16) : (uint16_t)atol(CheatExt.c_str());
if (Extension.length() == 0) { return false; }
CodeEntry.Value = Extension[0] == '$' ? (uint16_t)strtoul(&Extension[1], 0, 16) : (uint16_t)atol(Extension.c_str());
}
else if (strncmp(ReadPos, "??", 2) == 0)
{
if (CheatNo < 0 || CheatNo > MaxCheats) { return false; }
stdstr CheatExt = g_Settings->LoadStringIndex(Cheat_Extension, CheatNo);
if (CheatExt.empty()) { return false; }
if (Extension.length() == 0) { return false; }
CodeEntry.Value = (uint8_t)(strtoul(ReadPos, 0, 16));
CodeEntry.Value |= (CheatExt[0] == '$' ? (uint8_t)strtoul(&CheatExt.c_str()[1], 0, 16) : (uint8_t)atol(CheatExt.c_str())) << 16;
CodeEntry.Value |= (Extension[0] == '$' ? (uint8_t)strtoul(&Extension[1], 0, 16) : (uint8_t)atol(Extension.c_str())) << 16;
}
else if (strncmp(&ReadPos[2], "??", 2) == 0)
{
if (CheatNo < 0 || CheatNo > MaxCheats) { return false; }
stdstr CheatExt = g_Settings->LoadStringIndex(Cheat_Extension, CheatNo);
if (CheatExt.empty()) { return false; }
if (Extension.length() == 0) { return false; }
CodeEntry.Value = (uint16_t)(strtoul(ReadPos, 0, 16) << 16);
CodeEntry.Value |= CheatExt[0] == '$' ? (uint8_t)strtoul(&CheatExt.c_str()[1], 0, 16) : (uint8_t)atol(CheatExt.c_str());
CodeEntry.Value |= Extension[0] == '$' ? (uint8_t)strtoul(&Extension[1], 0, 16) : (uint8_t)atol(Extension.c_str());
}
else
{
@ -139,14 +153,14 @@ void CCheats::LoadPermCheats(CPlugins * Plugins)
if (LoadEntry)
{
LoadCode(-1, LineEntry.c_str());
LoadCode(LineEntry.c_str(), Default_None, CheatNo);
}
}
}
void CCheats::LoadCheats(bool DisableSelected, CPlugins * Plugins)
{
m_Codes.clear();
ResetCodes();
LoadPermCheats(Plugins);
for (int CheatNo = 0; CheatNo < MaxCheats; CheatNo++)
@ -163,13 +177,7 @@ void CCheats::LoadCheats(bool DisableSelected, CPlugins * Plugins)
continue;
}
//Find the start and end of the name which is surrounded in ""
int StartOfName = LineEntry.find("\"");
if (StartOfName == -1) { continue; }
int EndOfName = LineEntry.find("\"", StartOfName + 1);
if (EndOfName == -1) { continue; }
LoadCode(CheatNo, &LineEntry.c_str()[EndOfName + 2]);
LoadCode(LineEntry, Cheat_Extension, CheatNo);
}
}
@ -211,21 +219,21 @@ uint16_t ConvertXP64Value(uint16_t Value)
return tmpValue;
}
void CCheats::ApplyCheats(CMipsMemoryVM * MMU)
void CCheats::ApplyCheats()
{
for (size_t CurrentCheat = 0; CurrentCheat < m_Codes.size(); CurrentCheat++)
{
const CODES & CodeEntry = m_Codes[CurrentCheat];
CODES & CodeEntry = m_Codes[CurrentCheat];
for (size_t CurrentEntry = 0; CurrentEntry < CodeEntry.size();)
{
CurrentEntry += ApplyCheatEntry(MMU, CodeEntry, CurrentEntry, true);
ApplyCheatEntry(CodeEntry, CurrentEntry);
CurrentEntry += EntrySize(CodeEntry, CurrentEntry);
}
}
}
void CCheats::ApplyGSButton(CMipsMemoryVM * MMU)
void CCheats::ApplyGSButton()
{
uint32_t Address;
for (size_t CurrentCheat = 0; CurrentCheat < m_Codes.size(); CurrentCheat++)
{
const CODES & CodeEntry = m_Codes[CurrentCheat];
@ -234,21 +242,17 @@ void CCheats::ApplyGSButton(CMipsMemoryVM * MMU)
const GAMESHARK_CODE & Code = CodeEntry[CurrentEntry];
switch (Code.Command & 0xFF000000) {
case 0x88000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
MMU->SB_VAddr(Address, (uint8_t)Code.Value);
ModifyMemory8(0x80000000 | (Code.Command & 0xFFFFFF), (uint8_t)Code.Value);
break;
case 0x89000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
MMU->SH_VAddr(Address, Code.Value);
ModifyMemory16(0x80000000 | (Code.Command & 0xFFFFFF), Code.Value);
break;
// Xplorer64
case 0xA8000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
MMU->SB_VAddr(Address, (uint8_t)ConvertXP64Value(Code.Value));
ModifyMemory8(0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), (uint8_t)ConvertXP64Value(Code.Value));
break;
case 0xA9000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
MMU->SH_VAddr(Address, ConvertXP64Value(Code.Value));
ModifyMemory16(0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), ConvertXP64Value(Code.Value));
break;
}
}
@ -291,11 +295,11 @@ bool CCheats::IsValid16BitCode(const char * CheatString)
break;
case 0x88000000:
case 0xA8000000:
if (FirstEntry) { GSButtonCheat = true; }
if (FirstEntry) { GSButtonCheat = true; }
if (!GSButtonCheat) { return false; }
break;
case 0x89000000:
if (FirstEntry) { GSButtonCheat = true; }
if (FirstEntry) { GSButtonCheat = true; }
if (!GSButtonCheat) { return false; }
if (((CodeEntry.Command & 0xFFFFFF) & 1) == 1)
{
@ -303,7 +307,7 @@ bool CCheats::IsValid16BitCode(const char * CheatString)
}
break;
case 0xA9000000:
if (FirstEntry) { GSButtonCheat = true; }
if (FirstEntry) { GSButtonCheat = true; }
if (!GSButtonCheat) { return false; }
if (((ConvertXP64Address(CodeEntry.Command) & 0xFFFFFF) & 1) == 1)
{
@ -334,147 +338,238 @@ bool CCheats::IsValid16BitCode(const char * CheatString)
return true;
}
int CCheats::ApplyCheatEntry(CMipsMemoryVM * MMU, const CODES & CodeEntry, int CurrentEntry, bool Execute)
void CCheats::ModifyMemory8(uint32_t Address, uint8_t Value)
{
MEM_VALUE8 OriginalValue;
if (!m_MMU.LB_VAddr(Address, OriginalValue.Original))
{
return;
}
if (OriginalValue.Original == Value)
{
return;
}
OriginalValue.Changed = Value;
std::pair<ORIGINAL_VALUES8::iterator, bool> itr = m_OriginalValues8.insert(ORIGINAL_VALUES8::value_type(Address, OriginalValue));
m_MMU.SB_VAddr(Address, OriginalValue.Changed);
if (g_Recompiler)
{
g_Recompiler->ClearRecompCode_Virt(Address, 1, CRecompiler::Remove_Cheats);
}
}
void CCheats::ModifyMemory16(uint32_t Address, uint16_t Value)
{
MEM_VALUE16 OriginalValue;
if (!m_MMU.LH_VAddr(Address, OriginalValue.Original))
{
return;
}
if (OriginalValue.Original == Value)
{
return;
}
OriginalValue.Changed = Value;
std::pair<ORIGINAL_VALUES16::iterator, bool> itr = m_OriginalValues16.insert(ORIGINAL_VALUES16::value_type(Address, OriginalValue));
m_MMU.SH_VAddr(Address, OriginalValue.Changed);
if (g_Recompiler)
{
g_Recompiler->ClearRecompCode_Virt(Address, 2, CRecompiler::Remove_Cheats);
}
}
void CCheats::ApplyCheatEntry(CODES & CodeEntry, int32_t CurrentEntry)
{
if (CurrentEntry < 0 || CurrentEntry >= (int)CodeEntry.size())
{
return;
}
GAMESHARK_CODE & Code = CodeEntry[CurrentEntry];
uint16_t wMemory;
uint8_t bMemory;
switch (Code.Command & 0xFF000000)
{
case 0x50000000: // Gameshark / AR
if ((CurrentEntry + 1) >= (int)CodeEntry.size())
{
return;
}
{
const GAMESHARK_CODE & NextCodeEntry = CodeEntry[CurrentEntry + 1];
int numrepeats = (Code.Command & 0x0000FF00) >> 8;
int offset = Code.Command & 0x000000FF;
uint32_t Address;
int incr = Code.Value;
int i;
switch (NextCodeEntry.Command & 0xFF000000) {
case 0x10000000: // Xplorer64
case 0x80000000:
Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF);
wMemory = NextCodeEntry.Value;
for (i = 0; i < numrepeats; i++)
{
ModifyMemory8(Address, (uint8_t)wMemory);
Address += offset;
wMemory += (uint16_t)incr;
}
break;
case 0x11000000: // Xplorer64
case 0x81000000:
Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF);
wMemory = NextCodeEntry.Value;
for (i = 0; i < numrepeats; i++)
{
ModifyMemory16(Address, wMemory);
Address += offset;
wMemory += (uint16_t)incr;
}
break;
}
}
break;
case 0x80000000:
case 0x30000000:
case 0x82000000:
case 0x84000000:
ModifyMemory8(0x80000000 | (Code.Command & 0xFFFFFF), (uint8_t)Code.Value);
break;
case 0x81000000:
ModifyMemory16(0x80000000 | (Code.Command & 0xFFFFFF), Code.Value);
break;
case 0xA0000000:
ModifyMemory8(0xA0000000 | (Code.Command & 0xFFFFFF), (uint8_t)Code.Value);
break;
case 0xA1000000:
ModifyMemory16(0xA0000000 | (Code.Command & 0xFFFFFF), Code.Value);
break;
case 0xD0000000:
m_MMU.LB_VAddr(0x80000000 | (Code.Command & 0xFFFFFF), bMemory);
if (bMemory == Code.Value)
{
ApplyCheatEntry(CodeEntry, CurrentEntry + 1);
}
break;
case 0xD1000000:
m_MMU.LH_VAddr(0x80000000 | (Code.Command & 0xFFFFFF), wMemory);
if (wMemory == Code.Value)
{
ApplyCheatEntry(CodeEntry, CurrentEntry + 1);
}
break;
case 0xD2000000:
m_MMU.LB_VAddr(0x80000000 | (Code.Command & 0xFFFFFF), bMemory);
if (bMemory != Code.Value)
{
ApplyCheatEntry(CodeEntry, CurrentEntry + 1);
}
break;
case 0xD3000000:
m_MMU.LH_VAddr(0x80000000 | (Code.Command & 0xFFFFFF), wMemory);
if (wMemory != Code.Value)
{
ApplyCheatEntry(CodeEntry, CurrentEntry + 1);
}
break;
case 0x31000000:
case 0x83000000:
case 0x85000000:
ModifyMemory16(0x80000000 | (Code.Command & 0xFFFFFF), Code.Value);
break;
case 0xE8000000:
ModifyMemory8(0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), (uint8_t)ConvertXP64Value(Code.Value));
break;
case 0xE9000000:
ModifyMemory16(0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), ConvertXP64Value(Code.Value));
break;
case 0xC8000000:
ModifyMemory8(0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), (uint8_t)Code.Value);
break;
case 0xC9000000:
ModifyMemory16(0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), ConvertXP64Value(Code.Value));
break;
case 0xB8000000:
case 0xBA000000:
m_MMU.LB_VAddr(0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), bMemory);
if (bMemory == ConvertXP64Value(Code.Value))
{
ApplyCheatEntry(CodeEntry, CurrentEntry + 1);
}
break;
case 0xB9000000:
case 0xBB000000:
m_MMU.LH_VAddr(0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF), wMemory);
if (wMemory == ConvertXP64Value(Code.Value))
{
ApplyCheatEntry(CodeEntry, CurrentEntry + 1);
}
break;
}
}
int32_t CCheats::EntrySize(const CODES & CodeEntry, int32_t CurrentEntry)
{
if (CurrentEntry < 0 || CurrentEntry >= (int)CodeEntry.size())
{
return 0;
}
const GAMESHARK_CODE & Code = CodeEntry[CurrentEntry];
uint32_t Address;
uint16_t wMemory;
uint8_t bMemory;
switch (Code.Command & 0xFF000000)
{
// Gameshark / AR
case 0x50000000:
{
case 0x50000000: // Gameshark / AR
if ((CurrentEntry + 1) >= (int)CodeEntry.size())
{
return 1;
}
const GAMESHARK_CODE & NextCodeEntry = CodeEntry[CurrentEntry + 1];
int numrepeats = (Code.Command & 0x0000FF00) >> 8;
int offset = Code.Command & 0x000000FF;
int incr = Code.Value;
int i;
switch (NextCodeEntry.Command & 0xFF000000) {
switch (CodeEntry[CurrentEntry + 1].Command & 0xFF000000)
{
case 0x10000000: // Xplorer64
case 0x80000000:
Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF);
wMemory = NextCodeEntry.Value;
for (i = 0; i < numrepeats; i++)
{
MMU->SB_VAddr(Address, (uint8_t)wMemory);
Address += offset;
wMemory += (uint16_t)incr;
}
return 2;
case 0x11000000: // Xplorer64
case 0x81000000:
Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF);
wMemory = NextCodeEntry.Value;
for (i = 0; i < numrepeats; i++)
{
MMU->SH_VAddr(Address, wMemory);
Address += offset;
wMemory += (uint16_t)incr;
}
return 2;
default: return 1;
}
}
break;
case 0x80000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
if (Execute) { MMU->SB_VAddr(Address, (uint8_t)Code.Value); }
break;
case 0x81000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
if (Execute) { MMU->SH_VAddr(Address, Code.Value); }
break;
case 0xA0000000:
Address = 0xA0000000 | (Code.Command & 0xFFFFFF);
if (Execute) { MMU->SB_VAddr(Address, (uint8_t)Code.Value); }
break;
case 0xA1000000:
Address = 0xA0000000 | (Code.Command & 0xFFFFFF);
if (Execute) { MMU->SH_VAddr(Address, Code.Value); }
break;
case 0xD0000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
MMU->LB_VAddr(Address, bMemory);
if (bMemory != Code.Value) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0xD1000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
MMU->LH_VAddr(Address, wMemory);
if (wMemory != Code.Value) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0xD2000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
MMU->LB_VAddr(Address, bMemory);
if (bMemory == Code.Value) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0xD3000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
MMU->LH_VAddr(Address, wMemory);
if (wMemory == Code.Value) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
// Xplorer64 (Author: Witten)
case 0x30000000:
case 0x82000000:
case 0x84000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
if (Execute) { MMU->SB_VAddr(Address, (uint8_t)Code.Value); }
break;
case 0x31000000:
case 0x83000000:
case 0x85000000:
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
if (Execute) { MMU->SH_VAddr(Address, Code.Value); }
break;
case 0xE8000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
if (Execute) { MMU->SB_VAddr(Address, (uint8_t)ConvertXP64Value(Code.Value)); }
break;
case 0xE9000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
if (Execute) { MMU->SH_VAddr(Address, ConvertXP64Value(Code.Value)); }
break;
case 0xC8000000:
Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
if (Execute) { MMU->SB_VAddr(Address, (uint8_t)Code.Value); }
break;
case 0xC9000000:
Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
if (Execute) { MMU->SH_VAddr(Address, ConvertXP64Value(Code.Value)); }
break;
case 0xB8000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
MMU->LB_VAddr(Address, bMemory);
if (bMemory != ConvertXP64Value(Code.Value)) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0xB9000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
MMU->LH_VAddr(Address, wMemory);
if (wMemory != ConvertXP64Value(Code.Value)) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0xBA000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
MMU->LB_VAddr(Address, bMemory);
if (bMemory == ConvertXP64Value(Code.Value)) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0xBB000000:
Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
MMU->LH_VAddr(Address, wMemory);
if (wMemory == ConvertXP64Value(Code.Value)) { Execute = false; }
return ApplyCheatEntry(MMU, CodeEntry, CurrentEntry + 1, Execute) + 1;
case 0: return MaxGSEntries; break;
return EntrySize(CodeEntry, CurrentEntry + 1) + 1;
case 0:
return MaxGSEntries;
}
return 1;
}
void CCheats::ResetCodes(void)
{
m_Codes.clear();
for (ORIGINAL_VALUES8::iterator itr = m_OriginalValues8.begin(); itr != m_OriginalValues8.end(); itr++)
{
uint8_t CurrentValue;
if (m_MMU.LB_VAddr(itr->first, CurrentValue) &&
itr->second.Changed == CurrentValue)
{
m_MMU.SB_VAddr(itr->first, itr->second.Original);
}
}
m_OriginalValues8.clear();
for (ORIGINAL_VALUES16::iterator itr = m_OriginalValues16.begin(); itr != m_OriginalValues16.end(); itr++)
{
uint16_t CurrentValue;
if (m_MMU.LH_VAddr(itr->first, CurrentValue) &&
itr->second.Changed == CurrentValue)
{
m_MMU.SH_VAddr(itr->first, itr->second.Original);
}
}
m_OriginalValues16.clear();
}

View File

@ -16,7 +16,7 @@
class CCheats
{
public:
CCheats();
CCheats(CMipsMemoryVM & MMU);
~CCheats(void);
enum
@ -25,8 +25,8 @@ public:
MaxGSEntries = 100,
};
void ApplyCheats(CMipsMemoryVM * MMU);
void ApplyGSButton(CMipsMemoryVM * MMU);
void ApplyCheats();
void ApplyGSButton();
void LoadCheats(bool DisableSelected, CPlugins * Plugins);
static bool IsValid16BitCode(const char * CheatString);
@ -38,13 +38,34 @@ private:
uint16_t Value;
};
struct MEM_VALUE16
{
uint16_t Original;
uint16_t Changed;
};
struct MEM_VALUE8
{
uint8_t Original;
uint8_t Changed;
};
typedef std::vector<GAMESHARK_CODE> CODES;
typedef std::vector<CODES> CODES_ARRAY;
typedef std::vector<CODES> CODES_ARRAY;
typedef std::map<uint32_t, MEM_VALUE16> ORIGINAL_VALUES16;
typedef std::map<uint32_t, MEM_VALUE8> ORIGINAL_VALUES8;
void LoadPermCheats(CPlugins * Plugins);
int32_t EntrySize(const CODES & CodeEntry, int32_t CurrentEntry);
CODES_ARRAY m_Codes;
CMipsMemoryVM & m_MMU;
CODES_ARRAY m_Codes;
ORIGINAL_VALUES16 m_OriginalValues16;
ORIGINAL_VALUES8 m_OriginalValues8;
bool LoadCode(int32_t CheatNo, const char * CheatString);
int32_t ApplyCheatEntry(CMipsMemoryVM * MMU, const CODES & CodeEntry, int32_t CurrentEntry, bool Execute);
bool LoadCode(const stdstr & CheatEntry, SettingID ExtensionSetting, int ExtensionIndex);
void ApplyCheatEntry(CODES & CodeEntry, int32_t CurrentEntry);
void ModifyMemory8(uint32_t Address, uint8_t Value);
void ModifyMemory16(uint32_t Address, uint16_t Value);
void ResetCodes(void);
};

View File

@ -182,7 +182,7 @@ void CSystemEvents::ExecuteEvents()
m_System->SetCheatsSlectionChanged(false);
m_System->m_Cheats.LoadCheats(false, m_Plugins);
}
m_System->m_Cheats.ApplyGSButton(g_MMU);
m_System->m_Cheats.ApplyGSButton();
break;
case SysEvent_PauseCPU_FromMenu:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))

View File

@ -44,6 +44,7 @@ void CSystemTimer::Reset()
void CSystemTimer::SetTimer(TimerType Type, uint32_t Cycles, bool bRelative)
{
Cycles *= CGameSettings::OverClockModifier();
if (Type >= MaxTimer || Type == UnknownTimer)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -90,7 +91,7 @@ uint32_t CSystemTimer::GetTimer(TimerType Type)
{
return 0x7FFFFFFF;
}
return (uint32_t)CyclesToTimer;
return (uint32_t)(CyclesToTimer / CGameSettings::OverClockModifier());
}
void CSystemTimer::StopTimer(TimerType Type)
@ -167,7 +168,7 @@ void CSystemTimer::UpdateTimers()
{
int32_t random, wired;
m_LastUpdate = m_NextTimer;
m_Reg.COUNT_REGISTER += TimeTaken;
m_Reg.COUNT_REGISTER += (TimeTaken / CGameSettings::OverClockModifier());
random = m_Reg.RANDOM_REGISTER - (TimeTaken / g_System->CountPerOp());
wired = m_Reg.WIRED_REGISTER;
if (random < wired)

View File

@ -38,6 +38,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
m_SyncCPU(NULL),
m_SyncPlugins(NULL),
m_MMU_VM(SavesReadOnly),
m_Cheats(m_MMU_VM),
m_TLB(this),
m_Reg(this, this),
m_Recomp(NULL),
@ -2175,7 +2176,7 @@ void CN64System::RefreshScreen()
SetCheatsSlectionChanged(false);
m_Cheats.LoadCheats(false, g_BaseSystem->m_Plugins);
}
m_Cheats.ApplyCheats(g_MMU);
m_Cheats.ApplyCheats();
}
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }
}

View File

@ -36,6 +36,7 @@ public:
Remove_TLB,
Remove_DMA,
Remove_StoreInstruc,
Remove_Cheats,
};
typedef void(*DelayFunc)();

View File

@ -13,30 +13,31 @@
#include <Project64-core/N64System/N64Class.h>
#include <Project64-core/Settings/GameSettings.h>
bool CGameSettings::m_bSMM_StoreInstruc;
bool CGameSettings::m_bSMM_Protect;
bool CGameSettings::m_bSMM_ValidFunc;
bool CGameSettings::m_bSMM_PIDMA;
bool CGameSettings::m_bSMM_TLB;
bool CGameSettings::m_bUseTlb;
bool CGameSettings::m_bSMM_StoreInstruc;
bool CGameSettings::m_bSMM_Protect;
bool CGameSettings::m_bSMM_ValidFunc;
bool CGameSettings::m_bSMM_PIDMA;
bool CGameSettings::m_bSMM_TLB;
bool CGameSettings::m_bUseTlb;
uint32_t CGameSettings::m_CountPerOp = 2;
uint32_t CGameSettings::m_ViRefreshRate = 1500;
uint32_t CGameSettings::m_AiCountPerBytes = 500;
bool CGameSettings::m_DelayDP = false;
bool CGameSettings::m_DelaySI = false;
bool CGameSettings::m_DelayDP = false;
bool CGameSettings::m_DelaySI = false;
uint32_t CGameSettings::m_RdramSize = 0;
bool CGameSettings::m_bFixedAudio = true;
bool CGameSettings::m_bSyncingToAudio = true;
bool CGameSettings::m_bSyncToAudio = true;
bool CGameSettings::m_bFastSP = true;
bool CGameSettings::m_b32Bit = true;
bool CGameSettings::m_RspAudioSignal;
bool CGameSettings::m_bRomInMemory;
bool CGameSettings::m_RegCaching;
bool CGameSettings::m_bLinkBlocks;
bool CGameSettings::m_bFixedAudio = true;
bool CGameSettings::m_bSyncingToAudio = true;
bool CGameSettings::m_bSyncToAudio = true;
bool CGameSettings::m_bFastSP = true;
bool CGameSettings::m_b32Bit = true;
bool CGameSettings::m_RspAudioSignal;
bool CGameSettings::m_bRomInMemory;
bool CGameSettings::m_RegCaching;
bool CGameSettings::m_bLinkBlocks;
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;
uint32_t CGameSettings::m_OverClockModifier = 1;
void CGameSettings::RefreshGameSettings()
{
@ -68,12 +69,14 @@ void CGameSettings::RefreshGameSettings()
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
m_OverClockModifier = g_Settings->LoadDword(Game_OverClockModifier);
m_bSyncingToAudio = m_bSyncToAudio;
if (m_CountPerOp == 0)
{
m_CountPerOp = 2;
}
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
WriteTrace(TraceN64System, TraceDebug, "Done");
}

View File

@ -40,6 +40,7 @@ public:
inline static bool bSMM_TLB(void) { return m_bSMM_TLB; }
inline static SYSTEM_TYPE SystemType(void) { return m_SystemType; }
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
inline static uint32_t OverClockModifier(void) { return m_OverClockModifier; }
protected:
static void SpeedChanged(int32_t SpeedLimit);
@ -50,24 +51,25 @@ private:
static bool m_RegCaching;
static bool m_bLinkBlocks;
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
static bool m_bUseTlb;
static bool m_bUseTlb;
static uint32_t m_CountPerOp;
static uint32_t m_ViRefreshRate;
static uint32_t m_AiCountPerBytes;
static bool m_DelayDP;
static bool m_DelaySI;
static bool m_DelayDP;
static bool m_DelaySI;
static uint32_t m_RdramSize;
static bool m_bFixedAudio;
static bool m_bSyncingToAudio;
static bool m_bSyncToAudio;
static bool m_bFastSP;
static bool m_b32Bit;
static bool m_RspAudioSignal;
static bool m_bSMM_StoreInstruc;
static bool m_bSMM_Protect;
static bool m_bSMM_ValidFunc;
static bool m_bSMM_PIDMA;
static bool m_bSMM_TLB;
static bool m_bFixedAudio;
static bool m_bSyncingToAudio;
static bool m_bSyncToAudio;
static bool m_bFastSP;
static bool m_b32Bit;
static bool m_RspAudioSignal;
static bool m_bSMM_StoreInstruc;
static bool m_bSMM_Protect;
static bool m_bSMM_ValidFunc;
static bool m_bSMM_PIDMA;
static bool m_bSMM_TLB;
static SYSTEM_TYPE m_SystemType;
static CPU_TYPE m_CpuType;
static uint32_t m_OverClockModifier;
};

View File

@ -94,6 +94,7 @@ enum SettingID
Rdb_AudioResetOnLoad,
Rdb_AllowROMWrites,
Rdb_CRC_Recalc,
Rdb_OverClockModifier,
//Individual Game Settings
Game_IniKey,
@ -147,6 +148,7 @@ enum SettingID
Game_Transferpak_ROM,
Game_Transferpak_Sav,
Game_LoadSaveAtStart,
Game_OverClockModifier,
// General Game running info
GameRunning_LoadingInProgress,

View File

@ -164,6 +164,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDBYesNo("AudioResetOnLoad", false));
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDBYesNo("AllowROMWrites", false));
AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDBYesNo("CRC-Recalc", false));
AddHandler(Rdb_OverClockModifier, new CSettingTypeRomDatabase("OverClockModifier", 1));
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_File, new CSettingTypeTempString(""));
@ -220,6 +221,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Game_Transferpak_ROM, new CSettingTypeGame("Tpak-ROM-dir", Default_None));
AddHandler(Game_Transferpak_Sav, new CSettingTypeGame("Tpak-Sav-dir", Default_None));
AddHandler(Game_LoadSaveAtStart, new CSettingTypeTempBool(false));
AddHandler(Game_OverClockModifier, new CSettingTypeGame("OverClockModifier", Rdb_OverClockModifier));
//User Interface
AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("", "Display CPU Usage", (uint32_t)false));

View File

@ -0,0 +1,58 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include "F3DTEXA.h"
void f3dttexa_loadtex()
{
uint32_t cmd0, cmd1;
cmd0 = rdp.cmd0;
cmd1 = rdp.cmd1;
rdp.cmd0 = 0x3d100000;
rdp_settextureimage();
rdp.cmd0 = 0x35100000;
rdp.cmd1 = 0x07000000;
rdp_settile();
rdp.cmd0 = 0x33000000;
rdp.cmd1 = 0x27000000 | (cmd0 & 0x00FFFFFF);
rdp_loadblock();
rdp.cmd0 = cmd0; //restore to original values
rdp.cmd1 = cmd1;
}
void f3dttexa_settilesize()
{
uint32_t cmd0, cmd1, firstHalf;
cmd0 = rdp.cmd0;
cmd1 = rdp.cmd1;
firstHalf = (cmd1 & 0xFF000000) >> 15;
rdp.cmd0 = 0x35400000 | firstHalf;
rdp.cmd1 = cmd0 & 0x00FFFFFF;
rdp_settile();
rdp.cmd0 = 0x32000000;
rdp.cmd1 = cmd1 & 0x00FFFFFF;
rdp_settilesize();
rdp.cmd0 = cmd0; //restore to original values
rdp.cmd1 = cmd1;
}

View File

@ -0,0 +1,17 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void f3dttexa_loadtex();
void f3dttexa_settilesize();

View File

@ -47,6 +47,7 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="F3DTEXA.h" />
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="Renderer\Renderer.h" />
<ClInclude Include="Renderer\types.h" />
@ -120,6 +121,7 @@
<ItemGroup>
<ClCompile Include="Android.cpp" />
<ClCompile Include="CRC.cpp" />
<ClCompile Include="F3DTEXA.cpp" />
<ClCompile Include="Renderer\OGLcombiner.cpp" />
<ClCompile Include="Renderer\OGLEScombiner.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>

View File

@ -160,6 +160,9 @@
<ClInclude Include="Renderer\types.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="F3DTEXA.h">
<Filter>ucode</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp">
@ -275,6 +278,9 @@
<ClCompile Include="Renderer\Renderer.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="F3DTEXA.cpp">
<Filter>ucode</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="gpl.txt">

View File

@ -164,6 +164,7 @@ public:
ucode_PerfectDark = 7,
ucode_CBFD = 8,
ucode_zSort = 9,
ucode_F3DTEXA = 10,
ucode_Turbo3d = 21,
};

View File

@ -25,8 +25,9 @@
#include "ucode07.h"
#include "ucode08.h"
#include "ucode09.h"
#include "F3DTEXA.h"
rdp_instr gfx_instruction[10][256] =
rdp_instr gfx_instruction[11][256] =
{
{
// uCode 0 - RSP SW 2.0X
@ -774,4 +775,81 @@ rdp_instr gfx_instruction[10][256] =
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
{
// uCode 10 - F3DTEXA
// games: 64 de Hakken
// 00-3f
spnoop, uc0_matrix, rsp_reserved0, uc0_movemem,
uc1_vertex, rsp_reserved1, uc0_displaylist, rsp_reserved2,
rsp_reserved3, uc6_sprite2d, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, uc2_load_ucode,
uc1_branch_z, uc2_quad, uc2_modifyvtx, rdphalf_2,
rdphalf_1, f3dttexa_loadtex, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, f3dttexa_settilesize, uc1_tri1,
// c0-ff: RDP commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
};

View File

@ -15,4 +15,4 @@
typedef void(*rdp_instr)();
extern rdp_instr gfx_instruction[10][256];
extern rdp_instr gfx_instruction[11][256];

View File

@ -151,11 +151,22 @@
<ItemGroup>
<None Include="res\divider.cur" />
<None Include="res\hand.cur" />
<None Include="UserInterface\Icons\divider.cur" />
<None Include="UserInterface\Icons\hand.cur" />
</ItemGroup>
<ItemGroup>
<Image Include="res\ListItems.bmp" />
<Image Include="UserInterface\Bitmaps\AboutScreenLogo.bmp" />
<Image Include="UserInterface\Bitmaps\ListItems.bmp" />
<Image Include="UserInterface\Bitmaps\tri-state.bmp" />
<Image Include="UserInterface\Icons\left.ico" />
<Image Include="UserInterface\Icons\PJ64.ICO" />
<Image Include="UserInterface\Icons\right.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UserInterface\UIResources.rc" />
</ItemGroup>
<ItemGroup>
<Manifest Include="Project64.exe.manifest" />
</ItemGroup>
</Project>

View File

@ -313,15 +313,42 @@
<None Include="res\hand.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="UserInterface\Icons\divider.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="UserInterface\Icons\hand.cur">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="res\ListItems.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="UserInterface\Icons\PJ64.ICO">
<Filter>Resource Files</Filter>
</Image>
<Image Include="UserInterface\Icons\right.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="UserInterface\Icons\left.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="UserInterface\Bitmaps\tri-state.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="UserInterface\Bitmaps\ListItems.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="UserInterface\Bitmaps\AboutScreenLogo.bmp">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UserInterface\UIResources.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Manifest Include="Project64.exe.manifest" />
</ItemGroup>
</Project>

View File

@ -28,6 +28,7 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
SetDlgItemTextW(m_hWnd, IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str());
SetDlgItemTextW(m_hWnd, IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str());
SetDlgItemTextW(m_hWnd, IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str());
SetDlgItemTextW(m_hWnd, IDC_OVER_CLOCK_MODIFIER_TEXT, wGS(ROM_OVER_CLOCK_MODIFIER).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str());
@ -85,6 +86,9 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE), Game_AiCountPerBytes, false);
TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_OVER_CLOCK_MODIFIER), Game_OverClockModifier, false);
TxtBox->SetTextField(GetDlgItem(IDC_OVER_CLOCK_MODIFIER_TEXT));
UpdatePageSettings();
}
@ -112,4 +116,4 @@ bool CGameGeneralPage::EnableReset(void)
void CGameGeneralPage::ResetPage()
{
CSettingsPageImpl<CGameGeneralPage>::ResetPage();
}
}

View File

@ -30,7 +30,8 @@ class CGameGeneralPage :
COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL, CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE, EN_UPDATE, EditBoxChanged)
END_MSG_MAP()
COMMAND_HANDLER_EX(IDC_OVER_CLOCK_MODIFIER, EN_UPDATE, EditBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_GameGeneral };

View File

@ -194,7 +194,7 @@ BEGIN
EDITTEXT IDC_INFO_MD5,77,59,153,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_CLIENTEDGE | WS_EX_STATICEDGE
END
IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 158
IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 169
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@ -212,14 +212,16 @@ BEGIN
EDITTEXT IDC_VIREFRESH,102,75,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,90,91,10
EDITTEXT IDC_COUNTPERBYTE,102,88,109,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,103,208,1
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,107,91,10
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,107,91,10
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,118,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,118,91,10
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,129,91,10
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,129,91,10
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,140,91,10
LTEXT "Over Clock Modifier",IDC_OVER_CLOCK_MODIFIER_TEXT,6,103,91,10
EDITTEXT IDC_OVER_CLOCK_MODIFIER,102,101,109,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,116,208,1
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,121,91,10
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,121,91,10
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,132,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,132,91,10
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,143,91,10
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,143,91,10
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,154,91,10
END
IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183
@ -716,7 +718,7 @@ BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 216
TOPMARGIN, 4
BOTTOMMARGIN, 152
BOTTOMMARGIN, 163
END
IDD_Settings_Accelerator, DIALOG

View File

@ -244,11 +244,13 @@
#define IDC_DIR_FRAME1 1101
#define IDC_ROM_FASTSP 1101
#define IDC_INFO 1101
#define IDC_OVER_CLOCK_MODIFIER_TEXT 1101
#define IDC_AUDIO_SIGNAL 1102
#define IDC_DIR_TEXTURE_FRAME 1102
#define IDC_ENTER_CODE 1102
#define IDC_DESCRIPTION 1102
#define IDC_DIR_FRAME3 1103
#define IDC_OVER_CLOCK_MODIFIER 1103
#define IDC_DIR_FRAME4 1104
#define IDC_DIR_FRAME5 1105
#define IDC_MAXROMS_TXT 1111
@ -354,7 +356,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 152
#define _APS_NEXT_RESOURCE_VALUE 153
#define _APS_NEXT_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1104
#define _APS_NEXT_SYMED_VALUE 101

View File

@ -41,7 +41,7 @@ copy "%base_dir%\Config\Project64.rdx" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Lang\*.pj.Lang" "%base_dir%\Bin\Package\Lang"
copy "%base_dir%\Plugin\Audio\Jabo_Dsound.dll" "%base_dir%\Bin\Package\Plugin\Audio"
copy "%base_dir%\Plugin\GFX\Jabo_Direct3D8.dll" "%base_dir%\Bin\Package\Plugin\GFX"
copy "%base_dir%\Plugin\GFX\PJ64Glide64.dll" "%base_dir%\Bin\Package\Plugin\GFX"
copy "%base_dir%\Plugin\GFX\Project64-Video.dll" "%base_dir%\Bin\Package\Plugin\GFX"
copy "%base_dir%\Plugin\Input\PJ64_NRage.dll" "%base_dir%\Bin\Package\Plugin\Input"
copy "%base_dir%\Plugin\RSP\RSP 1.7.dll" "%base_dir%\Bin\Package\Plugin\RSP"

View File

@ -1,286 +1,63 @@
' On Error Resume Next
if WScript.Arguments.Count < 4 then
WScript.StdOut.WriteLine "Missing parameters"
WScript.StdOut.WriteLine "[password] [file to upload] [BuildUrl] [Posttitle]"
WScript.Quit 1
end if
Set IE = CreateIeWindow()
WScript.StdOut.WriteLine IE.HWND
IE.Visible = True
Login IE
PostThread IE
IE.Quit
WScript.Quit 0
function CreateIeWindow ()
on error resume next
Set CreateIeWindow = nothing
For count = 0 to 100
WScript.StdOut.WriteLine count & ": Trying to create Internet Explorer"
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
if not IE is nothing then
WScript.StdOut.WriteLine count & ": Created Internet Explorer"
WScript.StdOut.WriteLine IE.HWND
IE.Visible = True
WScript.StdOut.WriteLine IE.HWND
Set CreateIeWindow = IE
exit for
end if
WScript.StdOut.WriteLine count & ": Not created"
WScript.Sleep 100
WScript.StdOut.WriteLine count & ": Should loop"
Next
if CreateIeWindow is nothing then
WScript.StdOut.WriteLine "Failed to create InternetExplorer.Application"
WScript.Quit 1
end if
End Function
Sub Wait(IE)
Dim complete
complete = False
WScript.StdOut.WriteLine "Waiting for IE"
For count = 0 to 1000
WScript.StdOut.WriteLine "before sleep"
WScript.Sleep 100
WScript.StdOut.WriteLine "after sleep"
if IE is nothing then
WScript.StdOut.WriteLine "after sleep"
end if
WScript.StdOut.WriteLine count & ": IE.readyState: " & IE.readyState
if IE.readyState >= 4 then
WScript.StdOut.WriteLine count & ": IE.Busy: " & IE.Busy
if not IE.Busy then
WScript.StdOut.WriteLine count & ": IE.document.readyState: " & IE.document.readyState
if StrComp(IE.document.readyState, "complete", vbTextCompare) = 0 then
complete = true
exit for
end if
end if
end if
Next
if not complete then
WScript.StdOut.WriteLine "Failed to wait for IE"
WScript.Quit 1
end if
WScript.StdOut.WriteLine "IE Done"
End Sub
Function FindIeWindow(ieID)
on error resume next
set IE = nothing
For count = 0 to 100
Set Shell = CreateObject("Shell.Application")
For i = 0 to Shell.Windows.Count -1
set Win = Shell.Windows.Item(i)
WScript.StdOut.WriteLine i & ": " & TypeName(win.Document)
If TypeName(win.Document) = "HTMLDocument" Then
WScript.StdOut.WriteLine "uniqueID: @" & win.HWND & "@" & ieID & "@"
if win.HWND = ieID then
WScript.StdOut.WriteLine "matched"
set IE = win
end if
End If
if not IE is nothing then
exit for
end if
Next
if not IE is nothing then
exit for
end if
WScript.StdOut.WriteLine count & ": failed, trying again"
WScript.Sleep 100
Next
set FindIeWindow = IE
if IE is nothing then
WScript.StdOut.WriteLine "Failed to find navigating window"
if WScript.Arguments.Count < 3 then
ShowUsage()
ElseIf StrComp("--create",WScript.Arguments(0)) = 0 Then
if WScript.Arguments.Count < 4 then
ShowUsage()
else
WScript.StdOut.WriteLine "HWND : " & IE.HWND
CreateUploadTarget()
end if
ElseIf StrComp("--files",WScript.Arguments(0)) = 0 Then
if WScript.Arguments.Count < 4 then
ShowUsage()
else
UploadFiles()
end if
Else
ShowUsage()
End if
sub ShowUsage()
WScript.StdOut.WriteLine "incorrect parameters"
WScript.StdOut.WriteLine "--create [password] [BuildUrl] [BuildName]"
WScript.StdOut.WriteLine "--files [password] [dir to upload] [BuildName]"
WScript.Quit 1
end sub
function Project64Url()
Project64Url = "http://www.pj64-emu.com"
End Function
Sub Navigate(IE, url)
dim ieId
ieID = IE.HWND
WScript.StdOut.WriteLine "Navigating (" & IE.HWND & ") to: " & url
IE.Navigate url
WScript.Sleep 100
' set IE = FindIeWindow(ieID)
Wait IE
End Sub
sub CreateUploadTarget()
dim BuildUrl
BuildUrl = WScript.Arguments(2)
Sub ValidateLoggedIn(IE)
WScript.StdOut.WriteLine "ValidateLoggedIn - 1"
WScript.StdOut.WriteLine "ValidateLoggedIn start"
WScript.StdOut.WriteLine "ValidateLoggedIn - 2"
Navigate IE, "http://forum.pj64-emu.com/"
WScript.StdOut.WriteLine "ValidateLoggedIn - 3"
Wait IE
WScript.StdOut.WriteLine "ValidateLoggedIn - 4"
Dim LoggedIn
LoggedIn = False
WScript.StdOut.WriteLine "ValidateLoggedIn - 5"
Set NodeList = IE.document.getElementsByTagName("a")
WScript.StdOut.WriteLine "ValidateLoggedIn - 6"
WScript.StdOut.WriteLine "Got Node list"
For Each Elem In NodeList
WScript.StdOut.WriteLine Elem.href
if lcase(Mid(Elem.href,1,39)) = "http://forum.pj64-emu.com/member.php?u=" then
if lcase(Mid(Elem.parentElement.innerHTML,1,11)) = "welcome, <a" then
if lcase(Elem.innerHTML) = "buildbot" then
WScript.StdOut.WriteLine "Found welcome message"
LoggedIn = true
exit for
end if
end if
end if
Next
if LoggedIn = false then
WScript.StdOut.WriteLine "Failed to login"
Dim objHTTP
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.open "GET", BuildUrl & "buildTimestamp", False
objHTTP.send
if (objHTTP.status <> 200) then
WScript.StdOut.WriteLine "failed to get job timestamp (" & BuildUrl & "buildTimestamp)"
WScript.Quit 1
end if
WScript.StdOut.WriteLine "ValidateLoggedIn Done"
End Sub
dim d
Sub Login(IE)
On Error resume next
Set IE2 = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE2.Visible = True
WScript.StdOut.WriteLine "Login start"
Navigate IE2, "http://forum.pj64-emu.com/"
set navbar_username = IE2.document.getelementbyid("navbar_username")
set navbar_password = IE2.document.getelementbyid("navbar_password")
if navbar_username is nothing then
WScript.StdOut.WriteLine "Failed to find login form, checking if already logged in"
ValidateLoggedIn IE
exit sub
end if
WScript.StdOut.WriteLine "Found login form"
navbar_username.value = "buildbot"
navbar_password.value = WScript.Arguments(0)
navbar_username.form.submit
Wait IE2
Dim FoundIt
FoundIt = False
WScript.StdOut.WriteLine "Looking for redirect"
For count = 0 to 100
Set NodeList = IE2.document.getElementsByTagName("a")
WScript.StdOut.WriteLine count & ": Found " & NodeList.length & " a tags"
For Each Elem In NodeList
if StrComp(Elem.href, "http://forum.pj64-emu.com/", vbTextCompare) = 0 then
if StrComp(Elem.innerHTML, "Click here if your browser does not automatically redirect you.", vbTextCompare) = 0 then
FoundIt = True
Exit For
End if
end if
if StrComp(Mid(Elem.href,1,57), "http://forum.pj64-emu.com/login.php?do=logout&logouthash=", vbTextCompare) = 0 then
if StrComp(Elem.innerHTML, "Log Out buildbot", vbTextCompare) = 0 then
WScript.StdOut.WriteLine "missed redirect link, found logout link"
FoundIt = True
Exit For
End if
end if
Next
if FoundIt = True then
Exit For
end if
WScript.Sleep 100
Next
if FoundIt = false then
WScript.StdOut.WriteLine "Failed to find redirect"
WScript.Quit 1
end if
WScript.StdOut.WriteLine "found redirect"
Navigate IE, "http://forum.pj64-emu.com/"
Wait IE
WScript.StdOut.WriteLine "Quitting IE2"
IE2.Quit
ValidateLoggedIn IE
WScript.StdOut.WriteLine "Login Done"
End Sub
Sub PostThread(IE)
dim ieId
ieID = IE.HWND
SetLocale 1033
build_date=CDate(objHTTP.responseText)
WScript.StdOut.WriteLine "PostThread start"
Navigate IE, "http://forum.pj64-emu.com/newthread.php?do=newthread&f=10"
Wait IE
set IE = FindIeWindow(ieID)
Dim submitButton
For count = 0 to 100
WScript.StdOut.WriteLine count & ": looking for submit button"
set submitButton = nothing
Set NodeList = IE.document.getElementsByTagName("input")
For Each Elem In NodeList
WScript.StdOut.WriteLine count & ": " & lcase(Elem.className)
if lcase(Elem.className) = "button" and lcase(Elem.value) = "submit new thread" then
WScript.StdOut.WriteLine count & ": found submit button"
set submitButton = Elem
exit for
end if
Next
if not submitButton is nothing then
exit for
end if
WScript.Sleep 300
Next
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.open "GET", BuildUrl & "api/xml?wrapper=changes", False
objHTTP.send
if submitButton is nothing then
WScript.StdOut.WriteLine "failed to find submit button"
WScript.Quit 1
end if
SetPostDetails IE, WScript.Arguments(2), WScript.Arguments(3)
UploadDirectory ieID, WScript.Arguments(1)
WScript.StdOut.WriteLine "submitting"
submitButton.click
WScript.Sleep 100
set IE = FindIeWindow(ieID)
Wait IE
WScript.StdOut.WriteLine "PostThread Finished"
End Sub
Sub SetPostDetails(IE, BuildUrl, PostTitle)
WScript.StdOut.WriteLine "Posting Details"
Dim oReq
Set oReq = CreateObject("MSXML2.XMLHTTP")
oReq.open "GET", BuildUrl & "api/xml?wrapper=changes", False
oReq.send
if (oReq.status <> 200) then
if (objHTTP.status <> 200) then
WScript.StdOut.WriteLine "failed to get job details (" & BuildUrl & "api/xml?wrapper=changes)"
WScript.Quit 1
end if
Dim xmlDoc
Set xmlDoc = oReq.responseXML
Set xmlDoc = objHTTP.responseXML
Set objLst = xmlDoc.getElementsByTagName("freeStyleBuild")
Dim PostContent
Dim ProductDescription
For each elem in objLst
set childNodes = elem.childNodes
for each node in childNodes
@ -301,70 +78,60 @@ Sub SetPostDetails(IE, BuildUrl, PostTitle)
next
if (Len(comment) > 0 and Len(commitId) > 0) then
PostContent = PostContent & "[*]" & comment & " (commit: [URL=""https://github.com/project64/project64/commit/" & commitId & """]"& commitId & "[/URL])" & vbCr
ProductDescription = ProductDescription & "[*]" & comment & " (commit: [URL=""https://github.com/project64/project64/commit/" & commitId & """]"& commitId & "[/URL])" & vbCrLf
end if
next
end if
next
Next
if (Len(PostContent) > 0) then
PostContent = "Changes:"&vbCr&"[LIST=1]" & vbCr & PostContent & "[/LIST]"
if (Len(ProductDescription) > 0) then
ProductDescription = "Changes:"&vbCrLf&"[LIST]" & vbCrLf & ProductDescription & "[/LIST]"
else
PostContent = "No code changes"
ProductDescription = "No code changes"
end if
Dim url
url = Project64Url() + "/index.php"
WScript.StdOut.WriteLine "PostTitle = """ & PostTitle & """"
WScript.StdOut.WriteLine "PostContent = """ & PostContent & """"
dim data
data = "option=com_betafile"
data = data & "&task=CreateProduct"
data = data & "&password="&WScript.Arguments(1)
data = data & "&jform[product_name]="&WScript.Arguments(3)
data = data & "&jform[product_desc]="&ProductDescription
data = data & "&jform[product_date]="&Year(build_date) & "-" & Month(build_date) & "-" & Day(build_date)
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", url, False
Dim SetTitle
SetTitle = False
Set NodeList = IE.document.getElementsByTagName("input")
For Each Elem In NodeList
if lcase(Elem.name) = "subject" then
Elem.value = PostTitle
SetTitle = true
exit for
end if
Next
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.send data
if not SetTitle then
WScript.StdOut.WriteLine "failed to set post title"
WScript.Quit 1
end if
Dim SetMessage
SetMessage = False
Set NodeList = IE.document.getElementsByTagName("textarea")
For Each Elem In NodeList
WScript.StdOut.WriteLine Elem.name
if lcase(Elem.name) = "message" then
Elem.value = PostContent
SetMessage = true
exit for
end if
Next
if not SetMessage then
WScript.StdOut.WriteLine "failed to set post message"
if objHTTP.Status <> 200 then
WScript.StdOut.WriteLine "Create beta file failed"
WScript.StdOut.WriteLine "status: " & objHTTP.Status
WScript.StdOut.WriteLine objHTTP.responseText
WScript.Quit 1
end if
Set objHTTP = Nothing
end sub
sub UploadDirectory(ieID, DirToUpload)
sub UploadFiles()
DirToUpload = WScript.Arguments(2)
WScript.StdOut.WriteLine "UploadDirectory start - " & DirToUpload
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(DirToUpload)
Set colFiles = objFolder.Files
For Each objFile in colFiles
UploadFile ieID, DirToUpload & "\" & objFile.Name
UploadFile DirToUpload & "\" & objFile.Name
Next
WScript.StdOut.WriteLine "UploadDirectory Finished"
end sub
sub UploadFile(ieID, FileToUpload)
set IE = FindIeWindow(ieID)
sub UploadFile(FileToUpload)
Const adTypeBinary = 1
WScript.StdOut.WriteLine "UploadFile start - " & FileToUpload
dim filePos
@ -389,70 +156,21 @@ sub UploadFile(ieID, FileToUpload)
WScript.Quit 1
end if
set manage_attachments_button = IE.document.getelementbyid("manage_attachments_button")
if manage_attachments_button is nothing then
WScript.StdOut.WriteLine "failed to find manage_attachments_button"
WScript.Quit 1
end if
WScript.StdOut.WriteLine "InStr(1, lcase(manage_attachments_button.onclick), ""vb_attachments"") = " & InStr(1, lcase(manage_attachments_button.onclick), "vb_attachments")
dim startPos, endPos
startPos = InStr(1, lcase(manage_attachments_button.onclick), "vb_attachments")
if startPos = 0 then
WScript.StdOut.WriteLine "failed to find vb_attachments in " & manage_attachments_button.onclick
WScript.Quit 1
end if
startPos = InStr(startPos, lcase(manage_attachments_button.onclick), "'")
if startPos = 0 then
WScript.StdOut.WriteLine "failed to find first quote in " & manage_attachments_button.onclick
WScript.Quit 1
end if
startPos = startPos + 1
endPos = InStr(startPos,manage_attachments_button.onclick, "'")
if endPos = 0 then
WScript.StdOut.WriteLine "failed to find second quote in " & manage_attachments_button.onclick
WScript.Quit 1
end if
Set IE2 = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE2.Visible = True
Navigate IE2, "http://forum.pj64-emu.com/" & Mid(manage_attachments_button.onclick, startPos, endPos - startPos)
Wait IE2
Set FormList = IE2.document.getElementsByTagName("form")
if FormList.length <> 1 or FormList(0).name <> "newattachment" then
WScript.StdOut.WriteLine "failed to find attachement form"
WScript.Quit 1
end if
Set InputList = FormList(0).getElementsByTagName("input")
WScript.StdOut.WriteLine "InputList.length = " & InputList.length
dim PreFormData, PostFormData
For Each Input In InputList
if lcase(Input.type) = "hidden" then
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""" & Input.name & """" & vbCrLf & vbCrLf & Input.value& vbCrLf
end if
WScript.StdOut.WriteLine "Input.type: " & Input.type & " Input.name: " & Input.name & " Input.value: " & Input.value
next
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""attachment[]""; filename=""" & fileName & """" & vbCrLf
PreFormData = PreFormData & "Content-Type: application/zip" & vbCrLf & vbCrLf
PostFormData = vbCrLf & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""upload""" & vbCrLf & vbCrLf & "Upload" & vbCrLf
PostFormData = PostFormData & vbCrLf & vbCrLf & "--AaB03x--"& vbCrLf
WScript.StdOut.WriteLine PreFormData & PostFormData
Dim url
url = Project64Url() + "/index.php"
dim fileContents
fileContents = ReadBinaryFile(FileToUpload)
dim UploadUrl
UploadUrl = "http://forum.pj64-emu.com/" & FormList(0).action
IE2.Quit
Header = "Content-Type: multipart/form-data; boundary=AaB03x" & vbCrLf
Const adTypeBinary = 1
dim PreFormData, PostFormData
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""option""" & vbCrLf & vbCrLf & "com_betafile"& vbCrLf
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""task""" & vbCrLf & vbCrLf & "AddFile"& vbCrLf
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""password""" & vbCrLf & vbCrLf & WScript.Arguments(1) & vbCrLf
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""jform[product_name]""" & vbCrLf & vbCrLf & WScript.Arguments(3) & vbCrLf
PreFormData = PreFormData & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""jform[add_file]""; filename=""" & fileName & """" & vbCrLf
PreFormData = PreFormData & "Content-Type: application/zip" & vbCrLf & vbCrLf
PostFormData = vbCrLf & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""upload""" & vbCrLf & vbCrLf & "Upload" & vbCrLf
PostFormData = PostFormData & vbCrLf & vbCrLf & "--AaB03x--"& vbCrLf
Dim DataToPOSTStream
Set DataToPOSTStream = CreateObject("ADODB.Stream")
@ -465,48 +183,47 @@ sub UploadFile(ieID, FileToUpload)
DataToPOSTStream.Write = Stream_StringToBinary(PostFormData,"us-ascii")
DataToPOSTStream.Position = 0
DataToPOSTStream.Type = adTypeBinary
Dim DataToPOST
DataToPOST = DataToPOSTStream.Read
Set IE3 = CreateIeWindow()
IE3.Visible = 1
dim ie3Id
ie3Id = IE3.HWND
WScript.StdOut.WriteLine "Uploading form to: " & UploadUrl
IE3.Navigate UploadUrl, Nothing, Nothing, DataToPOST, Header
WScript.Sleep 100
'set IE3 = FindIeWindow(ie3Id)
Wait IE3
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", url, False
Dim UploadDone
UploadDone = False
For count = 0 to 1000
WScript.StdOut.WriteLine count & ": Waiting for upload done"
Set NodeList = IE3.document.getElementsByTagName("legend")
For Each Elem In NodeList
if (len(Elem.innerHTML) > 19) and lcase(Mid(Elem.innerHTML, 1, 19)) = "current attachments" then
UploadDone = true
WScript.StdOut.WriteLine "Upload done"
exit for
end if
Next
if UploadDone then
exit for
end if
Next
if not UploadDone then
objHTTP.setRequestHeader "Content-Type", "multipart/form-data; boundary=AaB03x"
objHTTP.setRequestHeader "Content-Length", Len(fileContents)
objHTTP.send DataToPOST
if objHTTP.Status <> 200 then
WScript.StdOut.WriteLine "Failed to upload file"
WScript.StdOut.WriteLine "status: " & objHTTP.Status
WScript.StdOut.WriteLine objHTTP.responseText
WScript.Quit 1
end if
IE3.Quit
WScript.StdOut.WriteLine "UploadFile Finished"
end sub
Function ReadBinaryFile(path)
Const adTypeBinary = 1
Const adTypeText = 2
dim inStream
dim myByte,myByteValue,myCharacter
set inStream=WScript.CreateObject("ADODB.Stream")
inStream.Open
inStream.type=1
inStream.LoadFromFile path
ReadBinaryFile=inStream.Read()
inStream.Close
End Function
Function Stream_StringToBinary(Text, CharSet)
Const adTypeText = 2
Const adTypeBinary = 1
Const adTypeText = 2
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
@ -523,21 +240,3 @@ Function Stream_StringToBinary(Text, CharSet)
Set BinaryStream = Nothing
End Function
Function ReadBinaryFile(path)
Const adTypeText = 2
Const adTypeBinary = 1
dim inStream
dim myByte,myByteValue,myCharacter
set inStream=WScript.CreateObject("ADODB.Stream")
inStream.Open
inStream.type=1
inStream.LoadFromFile path
ReadBinaryFile=inStream.Read()
inStream.Close
End Function