User:Xerxes: Difference between revisions

From Dolphin Emulator Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
(18 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.
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.


== GameID adding guide ==
== TMD scrape script ==
Can now be found [[User:Xerxes/GameID confirmation guide|here]].
Adapted from [[User:PowerKitten]]'s script to work on Linux.


== TODO ==
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>:
* Validate GameIDs and add missing ones using data from first party sources.
* Investigate digital IDs further.
* Finish game lists (pending on digital ID stuff).
* Make pages look nicer - consistency in general formatting.


== Trivia ==
<pre>
As of today (August 20, 2017), I've handwritten the words "improve infobox" in an edit summary five hundred and two times since I made my account. Maybe someone will get a chuckle out of that.
#!/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
</pre>
 
Then in your terminal run <code>sh ~/Desktop/curl.sh</code> 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):
 
<pre>
#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';
}


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].
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>


{{#vardefine:u_xerxes_inputs|
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!
{{rand|1000000|{{#time:z}}|17}} {{rand|1000000|{{#time:z}}|19}} {{rand|1000000|{{#time:z}}|23}} {{rand|1000000|{{#time:z}}|29}} {{rand|1000000|{{#time:z}}|31}} {{rand|1000000|{{#time:z}}|37}} {{rand|1000000|{{#time:z}}|41}} {{rand|1000000|{{#time:z}}|43}} {{rand|1000000|{{#time:z}}|47}} {{rand|1000000|{{#time:z}}|51}} {{rand|1000000|{{#time:z}}|53}} {{rand|1000000|{{#time:z}}|59}} {{rand|1000000|{{#time:z}}|61}} {{rand|1000000|{{#time:z}}|67}} {{rand|1000000|{{#time:z}}|71}}
}}Random numbers of the day: {{#var:u_xerxes_inputs}}


Bubble sort (expanded algorithm [https://pastebin.com/JDBtBHgF here]):
== Trivia ==
{{#while:|{{#if:{{#var:u_xerxes_inputs}}|{{#if:{{#regex:{{#var:u_xerxes_inputs}}|/^\s*\d?\d?,?\d?\d?\d?,?\d?\d?\d( {{!}}\s*$)/m}}|true}}}}|{{#vardefine:u_xerxes_counter|{{#expr:{{#var:u_xerxes_counter|0}}+1}}}}{{#vardefine:u_xerxes_member{{#var:u_xerxes_counter}}|{{#regex:{{#var:u_xerxes_inputs}}|/^\s*\d?\d?,?\d?\d?\d?,?\d?\d?\d( {{!}}\s*$)/m}}}}{{#vardefine:u_xerxes_inputs|{{#regex:{{#var:u_xerxes_inputs}}|/^\s*\d?\d?,?\d?\d?\d?,?\d?\d?\d( {{!}}\s*$)/m|}}}}}}{{#vardefine:u_xerxes_sortend|{{#var:u_xerxes_counter|0}}}}{{#vardefine:u_xerxes_counter|1}}{{#while:|{{#ifexpr:{{#var:u_xerxes_sortend}}>1|true}}|{{#vardefine:u_xerxes_wasswapped|false}}{{#while:|{{#ifexpr:{{#var:u_xerxes_counter}}<{{#var:u_xerxes_sortend}}|true}}|{{#ifexpr:{{#var:u_xerxes_member{{#var:u_xerxes_counter}}}}>{{#var:u_xerxes_member{{#expr:{{#var:u_xerxes_counter}}+1}}}}|{{#vardefine:u_xerxes_member{{#var:u_xerxes_counter}}|{{#var:u_xerxes_member{{#expr:{{#var:u_xerxes_counter}}+1}}}}{{#vardefine:u_xerxes_member{{#expr:{{#var:u_xerxes_counter}}+1}}|{{#var:u_xerxes_member{{#var:u_xerxes_counter}}}}}}}}{{#vardefine:u_xerxes_wasswapped|true}}}}{{#vardefine:u_xerxes_counter|{{#expr:{{#var:u_xerxes_counter}}+1}}}}}}{{#ifeq:{{#var:u_xerxes_wasswapped}}|false|{{#vardefine:u_xerxes_sortend|1}}|{{#vardefine:u_xerxes_sortend|{{#expr:{{#var:u_xerxes_sortend}}-1}}}}}}{{#vardefine:u_xerxes_counter|1}}}}{{#if:{{#var:u_xerxes_member1}}|{{#while:|{{#var:u_xerxes_member{{#var:u_xerxes_counter}}}}|{{#ifeq:{{#var:u_xerxes_haslooped|false}}|true|, <nowiki/>|{{#vardefine:u_xerxes_haslooped|true}}}}{{#var:u_xerxes_member{{#var:u_xerxes_counter}}}}{{#vardefine:u_xerxes_counter|{{#expr:{{#var:u_xerxes_counter}}+1}}}}}}}}
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].

Revision as of 20:12, 24 October 2019

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.