User:Xerxes: Difference between revisions

From Dolphin Emulator Wiki
Jump to navigation Jump to search
(the gameid page already had all this worked out so i did a bunch of dpls for no reason... the takeaway from this should be to actually read the whole documentation page before doing anything)
No edit summary
 
(99 intermediate revisions by the same user not shown)
Line 1: Line 1:
I test games and enjoy boring pedantic work. If I do something wrong/stupid please tell me on my discussion page or right here, I don't care where. If you want me to extensively test something specific, just tell me and I will.
I test games and enjoy boring pedantic work. If I do something wrong/stupid please tell me on my discussion page or right here, I don't care where.


== TODO ==
== TMD scrape script ==
Adapted from [[User:PowerKitten]]'s script to work on Linux.


* Make infoboxes look nicer.
Open a terminal, make a TMDs directory (<code>mkdir ~/TMDs</code>), then save the following script to your desktop in a text editor as <code>curl.sh</code>:


:* Space them out evenly.
<pre>
#!/bin/bash


:* Change the ordering of entries in the template to match how it looks on the final page, as they can be scrambled.
cd ~/TMDs && curl -f http://ccs.cdn.shop.wii.com/ccs/download/00010001{41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}{30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}{30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}{41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}/tmd --output 00010001#1#2#3#4.tmd
</pre>


:* Check that release dates are correct.
Then in your terminal run <code>sh ~/Desktop/curl.sh</code> and it'll begin scraping the 850,000 possible IDs.


:* Put dates and publishers in chronological order, as specified by the conventions.
Make a copy of the ~/TMDs directory to ~/TMDcopy, and make another folder ~/renamedTMD. This is the C program I used to rename them all to Dolphin's 6-character IDs (pls no bully I wrote this, not portable, requires changing all the numbers and the username from "xerxes" to your username because I'm garbage):


* Validate GameIDs and add missing ones using data primarily from GameFAQs and GameTDB.
<pre>
#include <stdio.h>
#include <string.h>


:* Virtual Console titles apparently use uniform publisher IDs depending on console.
char hexToChar(int n)
{
switch (n)
{
case 0x0:
return '0';
case 0x1:
return '1';
case 0x2:
return '2';
case 0x3:
return '3';
case 0x4:
return '4';
case 0x5:
return '5';
case 0x6:
return '6';
case 0x7:
return '7';
case 0x8:
return '8';
case 0x9:
return '9';
case 0xA:
return 'A';
case 0xB:
return 'B';
case 0xC:
return 'C';
case 0xD:
return 'D';
case 0xE:
return 'E';
case 0xF:
return 'F';
default:
return '0';
}
return '0';
}


::* Commodore 64 titles have a uniform publisher ID of GX.
int main()
{
char fromfilename[100] = {0};
strcpy(fromfilename, "/home/xerxes/TMDcopy/000100014A414A4A.tmd\0");
char tofilename[100] = {0};
strcpy(tofilename, "/home/xerxes/renamedTMD/JAJJ01.tmd\0");
char buffer[2] = {0};
FILE *file;
int count = 1;
int i, k, m, o;
for (i = 0x41; i <= 0x5A; ++i)
{
fromfilename[29] = hexToChar(i / 16);
fromfilename[30] = hexToChar(i % 16);
for (k = 0x30; k <= 0x5A; ++k)
{
if (k == 0x3A)
{
k = 0x41;
}
fromfilename[31] = hexToChar(k / 16);
fromfilename[32] = hexToChar(k % 16);
for (m = 0x30; m <= 0x5A; ++m)
{
if (m == 0x3A)
{
m = 0x41;
}
fromfilename[33] = hexToChar(m / 16);
fromfilename[34] = hexToChar(m % 16);
for (o = 0x41; o <= 0x5A; ++o)
{
fromfilename[35] = hexToChar(o / 16);
fromfilename[36] = hexToChar(o % 16);
++count;
if ((file = fopen(fromfilename, "rb")))
{
tofilename[24] = i;
tofilename[25] = k;
tofilename[26] = m;
tofilename[27] = o;
fseek(file, 0x198, SEEK_SET);
fread(buffer, 1, 2, file);
tofilename[28] = buffer[0];
tofilename[29] = buffer[1];
printf("%d\t\t%s\n", count, tofilename);
fclose(file);
rename(fromfilename, tofilename);
}
}
}
}
}
}
</pre>


::* Neo Geo and MSX titles have J8, though [[XAEJA4]] breaks this rule. Presumed wrong.
With that done, this should rename and then move each TMD file to an appropriate "ID".tmd file with the ID used by Dolphin within the ~/renamedTMD folder. Then you're done!


::* Arcade titles seem to use the normal publisher ID, but not a large enough sample size to confirm this.
== Trivia ==
 
On September 3-5, 2017, I got to watch [[User:Lucario]] and [[User:Kolano]] make a [https://wiki.dolphin-emu.org/index.php?title=Template%3AGlobalProblems%2Fsandbox&type=revision&diff=150359&oldid=149179 near-perfect forgery] of MediaWiki's default header because it [https://wiki.dolphin-emu.org/index.php?title=Template_talk%3AGlobalProblems%2FVirtual_Console&type=revision&diff=150376&oldid=149204 seemed like a better place to put a link].
::* Sega Master System and Genesis titles have 8P.
 
::* Nintendo 64, NES, and SNES titles have 01.
 
::* TurboGrafx-16 and TurboGrafx-16 CD titles have 18.
 
:::* Fix [[Samurai-Ghost]], [[Downtown Nekketsu Kōshinkyoku: Soreyuke Daiundōkai]], [[Super Air Zonk: Rockabilly-Paradise]], [[Nuts & Milk]], [[Shockman]] IDs according to this realization.

Latest revision as of 23:14, 29 May 2020

I test games and enjoy boring pedantic work. If I do something wrong/stupid please tell me on my discussion page or right here, I don't care where.

TMD scrape script

Adapted from User:PowerKitten's script to work on Linux.

Open a terminal, make a TMDs directory (mkdir ~/TMDs), then save the following script to your desktop in a text editor as curl.sh:

#!/bin/bash

cd ~/TMDs && curl -f http://ccs.cdn.shop.wii.com/ccs/download/00010001{41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}{30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}{30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}{41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A}/tmd --output 00010001#1#2#3#4.tmd

Then in your terminal run sh ~/Desktop/curl.sh and it'll begin scraping the 850,000 possible IDs.

Make a copy of the ~/TMDs directory to ~/TMDcopy, and make another folder ~/renamedTMD. This is the C program I used to rename them all to Dolphin's 6-character IDs (pls no bully I wrote this, not portable, requires changing all the numbers and the username from "xerxes" to your username because I'm garbage):

#include <stdio.h>
#include <string.h>

char hexToChar(int n)
{
	switch (n)
	{
		case 0x0:
			return '0';
		case 0x1:
			return '1';
		case 0x2:
			return '2';
		case 0x3:
			return '3';
		case 0x4:
			return '4';
		case 0x5:
			return '5';
		case 0x6:
			return '6';
		case 0x7:
			return '7';
		case 0x8:
			return '8';
		case 0x9:
			return '9';
		case 0xA:
			return 'A';
		case 0xB:
			return 'B';
		case 0xC:
			return 'C';
		case 0xD:
			return 'D';
		case 0xE:
			return 'E';
		case 0xF:
			return 'F';
		default:
			return '0';
	}
	return '0';
}

int main()
{
	char fromfilename[100] = {0};
	strcpy(fromfilename, "/home/xerxes/TMDcopy/000100014A414A4A.tmd\0");
	
	char tofilename[100] = {0};
	strcpy(tofilename, "/home/xerxes/renamedTMD/JAJJ01.tmd\0");
	
	char buffer[2] = {0};
	
	FILE *file;
	
	int count = 1;
	
	int i, k, m, o;
	
	for (i = 0x41; i <= 0x5A; ++i)
	{
		fromfilename[29] = hexToChar(i / 16);
		fromfilename[30] = hexToChar(i % 16);
		for (k = 0x30; k <= 0x5A; ++k)
		{
			if (k == 0x3A)
			{
				k = 0x41;
			}
			fromfilename[31] = hexToChar(k / 16);
			fromfilename[32] = hexToChar(k % 16);
			for (m = 0x30; m <= 0x5A; ++m)
			{
				if (m == 0x3A)
				{
					m = 0x41;
				}
				fromfilename[33] = hexToChar(m / 16);
				fromfilename[34] = hexToChar(m % 16);
				for (o = 0x41; o <= 0x5A; ++o)
				{
					fromfilename[35] = hexToChar(o / 16);
					fromfilename[36] = hexToChar(o % 16);
					
					++count;
					
					if ((file = fopen(fromfilename, "rb")))
					{
						tofilename[24] = i;
						tofilename[25] = k;
						tofilename[26] = m;
						tofilename[27] = o;
						fseek(file, 0x198, SEEK_SET);
						fread(buffer, 1, 2, file);
						tofilename[28] = buffer[0];
						tofilename[29] = buffer[1];
						printf("%d\t\t%s\n", count, tofilename);
						fclose(file);
						rename(fromfilename, tofilename);
					}
				}
			}
		}
	}
}

With that done, this should rename and then move each TMD file to an appropriate "ID".tmd file with the ID used by Dolphin within the ~/renamedTMD folder. Then you're done!

Trivia

On September 3-5, 2017, I got to watch User:Lucario and User:Kolano make a near-perfect forgery of MediaWiki's default header because it seemed like a better place to put a link.