Can view all teams in the rom.

Can export as jpk1 file to use with pkhex.
This commit is contained in:
suloku 2017-03-24 12:46:50 +01:00
commit 8b686374ef
13 changed files with 4196 additions and 0 deletions

236
.gitignore vendored Normal file
View File

@ -0,0 +1,236 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/

18
Stadium_Viewer.sln Normal file
View File

@ -0,0 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 5.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stadium_Viewer", "Stadium_Viewer\Stadium_Viewer.csproj", "{65D9D223-0FB6-4CA8-BF8C-6242BF62F284}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{65D9D223-0FB6-4CA8-BF8C-6242BF62F284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65D9D223-0FB6-4CA8-BF8C-6242BF62F284}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65D9D223-0FB6-4CA8-BF8C-6242BF62F284}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65D9D223-0FB6-4CA8-BF8C-6242BF62F284}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,75 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 08/02/2017
* Time: 1:11
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace Stadium_Viewer
{
public static class BigEndian
{
public static uint ToUInt32(byte[] data, int offset)
{
int val = 0;
val |= data[offset + 0] << 24;
val |= data[offset + 1] << 16;
val |= data[offset + 2] << 8;
val |= data[offset + 3] << 0;
return (uint)val;
}
public static ushort ToUInt16(byte[] data, int offset)
{
int val = 0;
val |= data[offset + 0] << 8;
val |= data[offset + 1] << 0;
return (ushort)val;
}
public static int ToInt32(byte[] data, int offset)
{
int val = 0;
val |= data[offset + 0] << 24;
val |= data[offset + 1] << 16;
val |= data[offset + 2] << 8;
val |= data[offset + 3] << 0;
return val;
}
public static short ToInt16(byte[] data, int offset)
{
int val = 0;
val |= data[offset + 0] << 8;
val |= data[offset + 1] << 0;
return (short)val;
}
public static byte[] GetBytes(int value)
{
return Invert(BitConverter.GetBytes(value));
}
public static byte[] GetBytes(short value)
{
return Invert(BitConverter.GetBytes(value));
}
public static byte[] GetBytes(uint value)
{
return Invert(BitConverter.GetBytes(value));
}
public static byte[] GetBytes(ushort value)
{
return Invert(BitConverter.GetBytes(value));
}
private static byte[] Invert(byte[] data)
{
byte[] result = new byte[data.Length];
int o = 0;
int i = data.Length;
while (o != data.Length)
result[--i] = data[o++];
return result;
}
}
}

161
Stadium_Viewer/FileIO.cs Normal file
View File

@ -0,0 +1,161 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 07/02/2017
* Time: 19:13
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Stadium_Viewer
{
/// <summary>
/// Description of FileIO.
/// </summary>
public class FileIO
{
/// <summary>
/// Reads data into a complete array, throwing an EndOfStreamException
/// if the stream runs out of data first, or if an IOException
/// naturally occurs.
/// </summary>
/// <param name="stream">The stream to read data from</param>
/// <param name="data">The array to read bytes into. The array
/// will be completely filled from the stream, so an appropriate
/// size must be given.</param>
private static void ReadWholeArray (Stream stream, ref byte[] data)
{
int offset=0;
int remaining = data.Length;
while (remaining > 0)
{
int read = stream.Read(data, offset, remaining);
if (read <= 0)
throw new EndOfStreamException
(String.Format("End of stream reached with {0} bytes left to read", remaining));
remaining -= read;
offset += read;
}
}
private static void _read_data(ref byte [] buffer, string path)
{
System.IO.FileStream saveFile;
saveFile = new FileStream(path, FileMode.Open);
if (saveFile.Length < 1){
MessageBox.Show("Invalid file length", "Error");
return;
}
buffer = new byte[saveFile.Length];
//MessageBox.Show(buffer.Length.ToString());
ReadWholeArray(saveFile, ref buffer);
saveFile.Close();
return;
}
public static int load_file(ref byte[] buffer, ref string path, string filter)
{
if (path == null)
{
OpenFileDialog openFD = new OpenFileDialog();
//openFD.InitialDirectory = "c:\\";
openFD.Filter = filter;
if (openFD.ShowDialog() == DialogResult.OK)
{
#region filename
path = openFD.FileName;
//MessageBox.Show(path.ToString());
#endregion
_read_data(ref buffer, path);
//MessageBox.Show(buffer.Length.ToString());
return buffer.Length;
}else{
return -1;
}
}
else
{
_read_data(ref buffer, path);
return buffer.Length;
}
}
private static byte[] dsvfoot = new byte[] {
0x7C, 0x3C, 0x2D, 0x2D, 0x53, 0x6E, 0x69, 0x70, 0x20, 0x61, 0x62, 0x6F,
0x76, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x6F, 0x20, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x72, 0x61, 0x77, 0x20,
0x73, 0x61, 0x76, 0x20, 0x62, 0x79, 0x20, 0x65, 0x78, 0x63, 0x6C, 0x75,
0x64, 0x69, 0x6E, 0x67, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x44, 0x65,
0x53, 0x6D, 0x75, 0x4D, 0x45, 0x20, 0x73, 0x61, 0x76, 0x65, 0x64, 0x61,
0x74, 0x61, 0x20, 0x66, 0x6F, 0x6F, 0x74, 0x65, 0x72, 0x3A, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x2D,
0x44, 0x45, 0x53, 0x4D, 0x55, 0x4D, 0x45, 0x20, 0x53, 0x41, 0x56, 0x45,
0x2D, 0x7C
};
public static void save_data(byte[] buffer)
{ //if (savegamename.Text.Length < 1) return;
if (buffer == null) return;
SaveFileDialog saveFD = new SaveFileDialog();
//saveFD.InitialDirectory = "c:\\";
saveFD.Filter = "NDS RAW save data|*.sav|NDS Desmune/Drastic save data|*.dsv|All Files (*.*)|*.*";
if (saveFD.ShowDialog() == DialogResult.OK)
{
System.IO.FileStream saveFile;
saveFile = new FileStream(saveFD.FileName, FileMode.Create);
//Write file
var extension = Path.GetExtension(saveFD.FileName);
switch(extension.ToLower())
{
case ".sav":
//Write file
saveFile.Write(buffer, 0, buffer.Length);
break;
/*
case ".dsv":
//Add dsv footer
byte[] dsv_save = new byte[SAV5.SIZERAW+122];
buffer.CopyTo(dsv_save, 0);
dsvfoot.CopyTo(dsv_save, SAV5.SIZERAW);
//Write file
saveFile.Write( dsv_save, 0, dsv_save.Length);
break;
*/
default:
//throw new ArgumentOutOfRangeException(extension);
break;
}
saveFile.Close();
MessageBox.Show("File Saved.", "Save file");
}
}
public static void save_file(byte[] buffer, string filter)
{ //if (savegamename.Text.Length < 1) return;
if (buffer == null) return;
SaveFileDialog saveFD = new SaveFileDialog();
//saveFD.InitialDirectory = "c:\\";
saveFD.Filter = filter;
if (saveFD.ShowDialog() == DialogResult.OK)
{
System.IO.FileStream saveFile;
saveFile = new FileStream(saveFD.FileName, FileMode.Create);
//Write file
saveFile.Write(buffer, 0, buffer.Length);
saveFile.Close();
MessageBox.Show("File Saved.", "Save file");
}
}
}
}

1959
Stadium_Viewer/MainForm.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

486
Stadium_Viewer/MainForm.cs Normal file
View File

@ -0,0 +1,486 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 07/02/2017
* Time: 19:12
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Stadium_Viewer
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
PartySlot.Value = 0;
offset_val.Maximum = 0xFFFFFFFF;
trainer_start = fifties_tournament;
trainers.SelectedIndex = 0;
cups.SelectedIndex = 0;
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
public string z64filter = "N64 rom|*.z64|All Files (*.*)|*.*";
public string jpk1filter = "PkHex JPK1|*.jpk1|All Files (*.*)|*.*";
public byte[] savebuffer;
public static js1pk pokemon;
public int trainer_start;
public int fifties_tournament = 0x175980;
public int pokecup = 0x177690;
public int greatcup = 0x178610;
public int ultracup = 0x179590;
public int mastercup = 0x17A510;
void Load_butClick(object sender, EventArgs e)
{
load_rom(null);
}
void load_rom(string filepath)
{
string path = filepath;
int filesize = FileIO.load_file(ref savebuffer, ref path, z64filter);
if( filesize == 0x1000000 )
{
filelocation.Text = path;
offset_val.Value = trainer_start;
load_pokemon();
}
else
{
MessageBox.Show("Invalid file.");
}
}
void load_pokemon()
{
if (filelocation.Text != "")
{
offset_val.Value = (int)(trainer_start+(trainers.SelectedIndex*js1pk.Size*6)+(trainers.SelectedIndex*0x10)+(PartySlot.Value*js1pk.Size));
pokemon = new js1pk(getDatafromSave((int)offset_val.Value, js1pk.Size));
//Fill data
Species.SelectedIndex = pokemon.Species;
ID.Value = pokemon.TID;
move1.SelectedIndex = pokemon.Move1;
move2.SelectedIndex = pokemon.Move2;
move3.SelectedIndex = pokemon.Move3;
move4.SelectedIndex = pokemon.Move4;
ppup1.SelectedIndex = pokemon.Move1_PPUps;
ppup2.SelectedIndex = pokemon.Move2_PPUps;
ppup3.SelectedIndex = pokemon.Move3_PPUps;
ppup4.SelectedIndex = pokemon.Move4_PPUps;
hp.Value = pokemon.IV_HP;
atk.Value = pokemon.IV_ATK;
def.Value = pokemon.IV_DEF;
spc.Value = pokemon.IV_SPC;
spe.Value = pokemon.IV_SPE;
hpEv.Value = pokemon.EV_HP;
atkEv.Value = pokemon.EV_ATK;
defEv.Value = pokemon.EV_DEF;
spcEv.Value = pokemon.EV_SPC;
speEv.Value = pokemon.EV_SPE;
//Stats
hpStat.Text = pokemon.Stat_HPCurrent.ToString()+"/"+pokemon.Stat_HPMax;
atkStat.Text = pokemon.Stat_ATK.ToString();
defStat.Text = pokemon.Stat_DEF.ToString();
spcStat.Text = pokemon.Stat_SPC.ToString();
speStat.Text = pokemon.Stat_SPE.ToString();
level.Value = pokemon.Stat_Level;
exp.Value = pokemon.EXP;
//Extra data
type1.SelectedIndex = pokemon.Type_A;
type2.SelectedIndex = pokemon.Type_B;
catchrate.Value = pokemon.Catch_Rate;
status.Text = "0x"+pokemon.Status_Condition.ToString("X");
//OT and nickname
otraw.Text = pokemon.raw_OT();
nickraw.Text = pokemon.raw_Nick();
}
}
byte[] getDatafromSave(int Offset, int Length)
{
return savebuffer.Skip(Offset).Take(Length).ToArray();
}
void PartySlotValueChanged(object sender, EventArgs e)
{
load_pokemon();
}
void MainFormLoad(object sender, EventArgs e)
{
}
void Offset_valValueChanged(object sender, EventArgs e)
{
//load_pokemon();
}
void Jpk1Click(object sender, EventArgs e)
{
FileIO.save_file(pokemon.convertojpk1(), jpk1filter);
}
void CupsSelectedIndexChanged(object sender, EventArgs e)
{
trainers.Items.Clear();
trainers.Items.AddRange(new object[] {
"0: Bug Catcher",
"1: Burglar",
"2: Bird Keeper",
"3: Picnicker",
"4: Super Nerd",
"5: Youngster",
"6: Camper",
"7: Lass"});
switch(cups.SelectedIndex)
{
case 0:
trainer_start = fifties_tournament;
trainers.Items.Clear();
trainers.Items.AddRange(new object[] {
"0: Katou Kazuhito",
"1: Yukiyo Jiro",
"2: Takahashi Jun",
"3: Toru",
"4: Suzuki Yusuke",
"5: Fujita Mika",
"6: Hiro Hayashiyasu",
"7: Yamadataka Hisa",
"8: Kitagawa Yasunori",
"9: Nishimura Shun",
"10: Imai Daisuke",
"11: Yuwamasa Kenji",
"12: Hiroki Yoshii",
"13: Tomitaisei Yoshi",
"14: Hiro Fuchiwakiaki"});
break;
case 1:
trainer_start = pokecup;
break;
case 2:
trainer_start = greatcup;
break;
case 3:
trainer_start = ultracup;
break;
case 4:
trainer_start = mastercup;
break;
}
trainers.SelectedIndex = 0;
PartySlot.Value = 0;
load_pokemon();
}
void TrainersSelectedIndexChanged(object sender, EventArgs e)
{
PartySlot.Value = 0;
load_pokemon();
}
}
}
/*
chartable[0x00] = 0x00 //NULL
chartable[0x01] = 0xA5A4 //イ゛ //SPECIAL (2 CHARACTERS) A5A4 + A59B
chartable[0x02] = 0xA5F4 //ヴ
chartable[0x03] = 0xA5A8 //エ゛ //SPECIAL (2 CHARACTERS) A5A8 + A59B
chartable[0x04] = 0xA5AA //オ゛ //SPECIAL (2 CHARACTERS) A5AA + A59B
chartable[0x05] = 0xA5AC //ガ
chartable[0x06] = 0xA5AE //ギ
chartable[0x07] = 0xA5B0 //グ
chartable[0x08] = 0xA5B2 //ゲ
chartable[0x09] = 0xA5B4 //ゴ
chartable[0x0A] = 0xA5B6 //ザ
chartable[0x0B] = 0xA5B8 //ジ
chartable[0x0C] = 0xA5BA //ズ
chartable[0x0D] = 0xA5BC //ゼ
chartable[0x0E] = 0xA5BE //ゾ
chartable[0x0F] = 0xA5C0 //ダ
chartable[0x10] = 0xA5C2 //ヂ
chartable[0x11] = 0xA5C5 //ヅ
chartable[0x12] = 0xA5C7 //デ
chartable[0x13] = 0xA5C9 //ド
chartable[0x14] = 0xA5CA //ナ゛ //SPECIAL (2 CHARACTERS) A5CA + A59B
chartable[0x15] = 0xA5CB //ニ゛ //SPECIAL (2 CHARACTERS) A5CB + A59B
chartable[0x16] = 0xA5CC //ヌ゛ //SPECIAL (2 CHARACTERS) A5CC + A59B
chartable[0x17] = 0xA5CD //ネ゛ //SPECIAL (2 CHARACTERS) A5CD + A59B
chartable[0x18] = 0xA5CE //ノ゛ //SPECIAL (2 CHARACTERS) A5CE + A59B
chartable[0x19] = 0xA5D0 //バ
chartable[0x1A] = 0xA5D3 //ビ
chartable[0x1B] = 0xA5D6 //ブ
chartable[0x1C] = 0xA5DC //ボ
chartable[0x1D] = 0xA5DE //マ゛ //SPECIAL (2 CHARACTERS) A5DE + A59B
chartable[0x1E] = 0xA5DF //ミ゛ //SPECIAL (2 CHARACTERS) A5DF + A59B
chartable[0x1F] = 0xA5E0 //ム゛ //SPECIAL (2 CHARACTERS) A5E0 + A59B
chartable[0x20] = 0xA5A3 //ィ゛ //SPECIAL (2 CHARACTERS) A5A3 + A59B
chartable[0x21] = 0xA542 //あ゛ //SPECIAL (2 CHARACTERS) A543 + A59B
chartable[0x22] = 0xA544 //い゛ //SPECIAL (2 CHARACTERS) A544 + A59B
chartable[0x23] = 0xA5F4 //ゔ
chartable[0x24] = 0xA548 //え゛ //SPECIAL (2 CHARACTERS) A548 + A59B
chartable[0x25] = 0xA54A //お゛ //SPECIAL (2 CHARACTERS) A54A + A59B
chartable[0x26] = 0xA54C //が
chartable[0x27] = 0xA54E //ぎ
chartable[0x28] = 0xA550 //ぐ
chartable[0x29] = 0xA552 //げ
chartable[0x2A] = 0xA554 //ご
chartable[0x2B] = 0xA556 //ざ
chartable[0x2C] = 0xA558 //じ
chartable[0x2D] = 0xA55A //ず
chartable[0x2E] = 0xA55C //ぜ
chartable[0x2F] = 0xA55E //ぞ
chartable[0x30] = 0xA560 //だ
chartable[0x31] = 0xA562 //ぢ
chartable[0x32] = 0xA565 //づ
chartable[0x33] = 0xA567 //で
chartable[0x34] = 0xA569 //ど
chartable[0x35] = 0xA56A //な゛ //SPECIAL (2 CHARACTERS) A56A + A59B
chartable[0x36] = 0xA56B //に゛ //SPECIAL (2 CHARACTERS) A56B + A59B
chartable[0x37] = 0xA56C //ぬ゛ //SPECIAL (2 CHARACTERS) A56C + A59B
chartable[0x38] = 0xA56D //ね゛ //SPECIAL (2 CHARACTERS) A56D + A59B
chartable[0x39] = 0xA56E //の゛ //SPECIAL (2 CHARACTERS) A56E + A59B
chartable[0x3A] = 0xA570 //ば
chartable[0x3B] = 0xA573 //び
chartable[0x3C] = 0xA576 //ぶ
chartable[0x3D] = 0xA579 //べ
chartable[0x3E] = 0xA57C //ぼ
chartable[0x3F] = 0xA57E //ま゛ //SPECIAL (2 CHARACTERS) A57E + A59B
chartable[0x40] = 0xA5D1 //パ
chartable[0x41] = 0xA5D4 //ピ
chartable[0x42] = 0xA5D7 //プ
chartable[0x43] = 0xA5DD //ポ
chartable[0x44] = 0xA571 //ぱ
chartable[0x45] = 0xA574 //ぴ
chartable[0x46] = 0xA577 //ぷ
chartable[0x47] = 0xA57A //ぺ
chartable[0x48] = 0xA57D //ぽ
chartable[0x49] = 0xA57E //ま゜ //SPECIAL (2 CHARACTERS) A57E + A59C
chartable[0x4A] = 0x00 //Control
chartable[0x4B] = 0x00 //Control
chartable[0x4C] = 0x00 //Control
chartable[0x4D] = 0xA5 //も゜
chartable[0x4E] = 0x00 //Control
chartable[0x4F] = 0x00 //Control
chartable[0x50] = 0x00 //Control
chartable[0x51] = 0x00 //Control
chartable[0x52] = 0x00 //Control
chartable[0x53] = 0x00 //Control
chartable[0x54] = 0x00 //Control
chartable[0x55] = 0x00 //Control
chartable[0x56] = 0x00 //Control
chartable[0x57] = 0x00 //Control
chartable[0x58] = 0x00 //Control
chartable[0x59] = 0x00 //Control
chartable[0x5A] = 0x00 //Control
chartable[0x5B] = 0x00 //Control
chartable[0x5C] = 0x00 //Control
chartable[0x5D] = 0x00 //Control
chartable[0x5E] = 0x00 //Control
chartable[0x5F] = 0x00 //Control
chartable[0x60] = 0xA541 //A
chartable[0x61] = 0xA542 //B
chartable[0x62] = 0xA543 //C
chartable[0x63] = 0xA544 //D
chartable[0x64] = 0xA545 //E
chartable[0x65] = 0xA546 //F
chartable[0x66] = 0xA547 //G
chartable[0x67] = 0xA548 //H
chartable[0x68] = 0xA549 //I
chartable[0x69] = 0xA556 //V
chartable[0x6A] = 0xA553 //S
chartable[0x6B] = 0xA543 //L
chartable[0x6C] = 0xA54D //M
chartable[0x6D] = 0xA53A //:
chartable[0x6E] = 0xA543 //ぃ
chartable[0x6F] = 0xA545 //ぅ
chartable[0x70] = 0xA50C //「
chartable[0x71] = 0xA50D //」
chartable[0x72] = 0xA50E //『
chartable[0x73] = 0xA50F //』
chartable[0x74] = 0xA5FB //・
chartable[0x75] = 0xA526 //…
chartable[0x76] = 0xA541 //ぁ
chartable[0x77] = 0xA547 //ぇ
chartable[0x78] = 0xA549 //ぉ
chartable[0x79] = 0 //Unknown unicode
chartable[0x7A] = 0xA53D //=
chartable[0x7B] = 0 //Unknown unicode
chartable[0x7C] = 0xA57C //| ****The character in GB is actually two ||
chartable[0x7D] = 0 //Unknown unicode
chartable[0x7E] = 0 //Unknown unicode
chartable[0x7F] = 0xA520 // space character
chartable[0x80] = 0xA5A2 //ア
chartable[0x81] = 0xA5A4 //イ
chartable[0x82] = 0xA5A6 //ウ
chartable[0x83] = 0xA5A8 //エ
chartable[0x84] = 0xA5AA //オ
chartable[0x85] = 0xA5AB //カ
chartable[0x86] = 0xA5AD //キ
chartable[0x87] = 0xA5AF //ク
chartable[0x88] = 0xA5B1 //ケ
chartable[0x89] = 0xA5B3 //コ
chartable[0x8A] = 0xA5B5 //サ
chartable[0x8B] = 0xA5B7 //シ
chartable[0x8C] = 0xA5B9 //ス
chartable[0x8D] = 0xA5BB //セ
chartable[0x8E] = 0xA5BD //ソ
chartable[0x8E] = 0xA5BF //タ
chartable[0x90] = 0xA5C1 //チ
chartable[0x91] = 0xA5C4 //ツ
chartable[0x92] = 0xA5C6 //テ
chartable[0x93] = 0xA5C8 //ト
chartable[0x94] = 0xA5CA //ナ
chartable[0x95] = 0xA5CB //ニ
chartable[0x96] = 0xA5CC //ヌ
chartable[0x97] = 0xA5CD //ネ
chartable[0x98] = 0xA5CE //
chartable[0x99] = 0xA5CF //ハ
chartable[0x9A] = 0xA5D2 //ヒ
chartable[0x9B] = 0xA5D5 //フ
chartable[0x9C] = 0xA5DB //ホ
chartable[0x9D] = 0xA5DE //マ
chartable[0x9E] = 0xA5DF //ミ
chartable[0x9F] = 0xA5E0 //ム
chartable[0xA0] = 0xA5E1 //メ
chartable[0xA1] = 0xA5E2 //モ
chartable[0xA2] = 0xA5E4 //ヤ
chartable[0xA3] = 0xA5E6 //ユ
chartable[0xA4] = 0xA5E8 //ヨ
chartable[0xA5] = 0xA5E9 //ラ
chartable[0xA6] = 0xA5EB //ル
chartable[0xA7] = 0xA5EC //レ
chartable[0xA8] = 0xA5ED //ロ
chartable[0xA9] = 0xA5EF //ワ
chartable[0xAA] = 0xA5F2 //ヲ
chartable[0xAB] = 0xA5F3 //ン
chartable[0xAC] = 0xA5C3 //ッ
chartable[0xAD] = 0xA5E3 //ャ
chartable[0xAE] = 0xA5E5 //ュ
chartable[0xAF] = 0xA5E7 //ョ
chartable[0xB0] = 0xA5A3 //ィ
chartable[0xB1] = 0xA542 //あ
chartable[0xB2] = 0xA544 //い
chartable[0xB3] = 0xA546 //う
chartable[0xB4] = 0xA548 //え
chartable[0xB5] = 0xA54A //お
chartable[0xB6] = 0xA54B //か
chartable[0xB7] = 0xA54D //き
chartable[0xB8] = 0xA54F //く
chartable[0xB9] = 0xA551 //け
chartable[0xBA] = 0xA553 //さ
chartable[0xBB] = 0xA555 //こ
chartable[0xBC] = 0xA557 //し
chartable[0xBD] = 0xA559 //す
chartable[0xBE] = 0xA55B //せ
chartable[0xBF] = 0xA55D //そ
chartable[0xc0] = 0xA55F //た
chartable[0xc1] = 0xA561 //ち
chartable[0xc2] = 0xA564 //つ
chartable[0xc3] = 0xA566 //て
chartable[0xc4] = 0xA568 //と
chartable[0xc5] = 0xA56A //な
chartable[0xc6] = 0xA56B //に
chartable[0xc7] = 0xA56C //ぬ
chartable[0xc8] = 0xA56D //ね
chartable[0xc9] = 0xA56E //の
chartable[0xcA] = 0xA56F //は
chartable[0xcB] = 0xA572 //ひ
chartable[0xcC] = 0xA575 //ふ
chartable[0xcD] = 0xA58 //へ
chartable[0xcE] = 0xA57B //ほ
chartable[0xcF] = 0xA57E //ま
chartable[0xD0] = 0xA57F //み
chartable[0xD1] = 0xA580 //む
chartable[0xD2] = 0xA581 //め
chartable[0xD3] = 0xA582 //も
chartable[0xD4] = 0xA584 //や
chartable[0xD5] = 0xA586 //ゆ
chartable[0xD6] = 0xA588 //よ
chartable[0xD7] = 0xA589 //ら
chartable[0xD8] = 0xA58A //り
chartable[0xD9] = 0xA58B //る
chartable[0xDA] = 0xA58C //れ
chartable[0xDB] = 0xA58D //ろ
chartable[0xDC] = 0xA58F //わ //small version isn't in GB charset (A58E)
chartable[0xDD] = 0xA592 //を
chartable[0xDE] = 0xA593 //ん
chartable[0xDF] = 0xA563 //っ
chartable[0xE0] = 0xA583 //ゃ
chartable[0xE1] = 0xA585 //ゅ
chartable[0xE2] = 0xA587 //ょ
chartable[0xE3] = 0xA5FC //ー
chartable[0xE4] = 0xA59C //゜ //needs special handling
chartable[0xE5] = 0xA59B //゛ //needs special handling
chartable[0xE6] = 0xA53F //?
chartable[0xE7] = 0xA521 //!
chartable[0xE8] = 0xA502 //。
chartable[0xE9] = 0xA5A1 //ァ
chartable[0xEA] = 0xA5A5 //ゥ
chartable[0xEB] = 0xA5A7 //ェ
chartable[0xEC] = 0xA5B7 //▷
chartable[0xED] = 0xA5B6 //▶
chartable[0xEE] = 0xA5BC //▼
chartable[0xEF] = 0xA542 //♂
chartable[0xF0] = 0xA5A5 //円 //Yen sign, conflicts with ゥ (0xEA in GB table)
chartable[0xF1] = 0xA5D7 //×
chartable[0xF2] = 0xA52E //.
chartable[0xF3] = 0xA52F //'/'
chartable[0xF4] = 0xA5A9 //ォ
chartable[0xF5] = 0xA540 //♀
chartable[0xF6] = 0xA530 //0
chartable[0xF7] = 0xA531 //1
chartable[0xF8] = 0xA532 //2
chartable[0xF9] = 0xA533 //3
chartable[0xFA] = 0xA534 //4
chartable[0xFB] = 0xA535 //5
chartable[0xFC] = 0xA536 //6
chartable[0xFD] = 0xA537 //7
chartable[0xFE] = 0xA538 //8
chartable[0xFF] = 0xA539 //9
*/

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

31
Stadium_Viewer/Program.cs Normal file
View File

@ -0,0 +1,31 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 07/02/2017
* Time: 19:12
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
namespace Stadium_Viewer
{
/// <summary>
/// Class with program entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// Program entry point.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@ -0,0 +1,31 @@
#region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Stadium_Viewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Stadium_Viewer")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{65D9D223-0FB6-4CA8-BF8C-6242BF62F284}</ProjectGuid>
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>WinExe</OutputType>
<RootNamespace>Stadium_Viewer</RootNamespace>
<AssemblyName>Stadium_Viewer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BigEndian.cs" />
<Compile Include="FileIO.cs" />
<Compile Include="jpk1.cs" />
<Compile Include="js1pk.cs" />
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>

95
Stadium_Viewer/jpk1.cs Normal file
View File

@ -0,0 +1,95 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 08/02/2017
* Time: 0:47
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Linq;
namespace Stadium_Viewer
{
/// <summary>
/// Description of jpk1.
/// </summary>
public class jpk1
{
public jpk1()
{
}
public int Size = 44;
public byte[] Data;
public jpk1(byte[] data = null)
{
Data = data ?? new byte[Size];
}
//Quite riped from pkhex
public int Species
{
get { return Data[0]; }
set
{
Data[0] = (byte)value;
}
}
public int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x1); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1); } }
public int Status_Condition { get { return Data[4]; } set { Data[4] = (byte)value; } }
public int Type_A { get { return Data[5]; } set { Data[5] = (byte)value; } }
public int Type_B { get { return Data[6]; } set { Data[6] = (byte)value; } }
public int Catch_Rate { get { return Data[7]; } set { Data[7] = (byte)value; } }
public int Move1 { get { return Data[8]; } set { Data[8] = (byte) value; } }
public int Move2 { get { return Data[9]; } set { Data[9] = (byte)value; } }
public int Move3 { get { return Data[10]; } set { Data[10] = (byte)value; } }
public int Move4 { get { return Data[11]; } set { Data[11] = (byte)value; } }
public int TID { get { return BigEndian.ToUInt16(Data, 0xC); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xC); } }
public uint EXP
{
get { return (BigEndian.ToUInt32(Data, 0xE) >> 8) & 0x00FFFFFF; }
set { Array.Copy(BigEndian.GetBytes((value << 8) & 0xFFFFFF00), 0, Data, 0xE, 3); }
}
public int EV_HP { get { return BigEndian.ToUInt16(Data, 0x11); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x11); } }
public int EV_ATK { get { return BigEndian.ToUInt16(Data, 0x13); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x13); } }
public int EV_DEF { get { return BigEndian.ToUInt16(Data, 0x15); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x15); } }
public int EV_SPE { get { return BigEndian.ToUInt16(Data, 0x17); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x17); } }
public int EV_SPC { get { return BigEndian.ToUInt16(Data, 0x19); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x19); } }
public int EV_SPA { get { return EV_SPC; } set { EV_SPC = value; } }
public int EV_SPD { get { return EV_SPC; } set { } }
public ushort DV16 { get { return BigEndian.ToUInt16(Data, 0x1B); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x1B); } }
public int IV_HP { get { return ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); } set { } }
public int IV_ATK { get { return (DV16 >> 12) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } }
public int IV_DEF { get { return (DV16 >> 8) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } }
public int IV_SPE { get { return (DV16 >> 4) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } }
public int IV_SPC { get { return (DV16 >> 0) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } }
public int IV_SPA { get { return IV_SPC; } set { IV_SPC = value; } }
public int IV_SPD { get { return IV_SPC; } set { } }
public int Move1_PP { get { return Data[0x1D] & 0x3F; } set { Data[0x1D] = (byte)((Data[0x1D] & 0xC0) | (value & 0x3F)); } }
public int Move2_PP { get { return Data[0x1E] & 0x3F; } set { Data[0x1E] = (byte)((Data[0x1E] & 0xC0) | (value & 0x3F)); } }
public int Move3_PP { get { return Data[0x1F] & 0x3F; } set { Data[0x1F] = (byte)((Data[0x1F] & 0xC0) | (value & 0x3F)); } }
public int Move4_PP { get { return Data[0x20] & 0x3F; } set { Data[0x20] = (byte)((Data[0x20] & 0xC0) | (value & 0x3F)); } }
public int Move1_PPUps { get { return (Data[0x1D] & 0xC0) >> 6; } set { Data[0x1D] = (byte)((Data[0x1D] & 0x3F) | ((value & 0x3) << 6)); } }
public int Move2_PPUps { get { return (Data[0x1E] & 0xC0) >> 6; } set { Data[0x1E] = (byte)((Data[0x1E] & 0x3F) | ((value & 0x3) << 6)); } }
public int Move3_PPUps { get { return (Data[0x1F] & 0xC0) >> 6; } set { Data[0x1F] = (byte)((Data[0x1F] & 0x3F) | ((value & 0x3) << 6)); } }
public int Move4_PPUps { get { return (Data[0x20] & 0xC0) >> 6; } set { Data[0x20] = (byte)((Data[0x20] & 0x3F) | ((value & 0x3) << 6)); } }
public int Stat_Level
{
get { return Data[0x21]; }
set { Data[0x21] = (byte)value; Data[0x3] = (byte)value; }
}
public int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x22); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x22); } }
public int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x24); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } }
public int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x26); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } }
public int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x28); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } }
public int Stat_SPC { get { return BigEndian.ToUInt16(Data, 0x2A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } }
// Leave SPA and SPD as alias for SPC
public int Stat_SPA { get { return Stat_SPC; } set { Stat_SPC = value; } }
public int Stat_SPD { get { return Stat_SPC; } set { } }
}
}

905
Stadium_Viewer/js1pk.cs Normal file
View File

@ -0,0 +1,905 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 08/02/2017
* Time: 0:47
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Linq;
using System.Windows.Forms;
namespace Stadium_Viewer
{
/// <summary>
/// Description of js1pk.
/// </summary>
public class js1pk
{
public js1pk()
{
}
public static int Size = 80;
public byte[] Data;
public js1pk(byte[] data = null)
{
Data = data ?? new byte[Size];
init_table();
init_speciestable();
}
//Quite riped from pkhex
public int Species
{
get { return Data[0]; }
set
{
Data[0] = (byte)value;
}
}
public int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x2); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2); } }
public int Status_Condition { get { return Data[5]; } set { Data[5] = (byte)value; } }
public int Type_A { get { return Data[6]; } set { Data[6] = (byte)value; } }
public int Type_B { get { return Data[7]; } set { Data[7] = (byte)value; } }
public int Catch_Rate { get { return Data[8]; } set { Data[8] = (byte)value; } }
public int Move1 { get { return Data[9]; } set { Data[9] = (byte) value; } }
public int Move2 { get { return Data[10]; } set { Data[10] = (byte)value; } }
public int Move3 { get { return Data[11]; } set { Data[11] = (byte)value; } }
public int Move4 { get { return Data[12]; } set { Data[12] = (byte)value; } }
public int TID { get { return BigEndian.ToUInt16(Data, 0xE); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xE); } }
public uint EXP
{
get { return (BigEndian.ToUInt32(Data, 0x11) >> 8) & 0x00FFFFFF; }
set { Array.Copy(BigEndian.GetBytes((value << 8) & 0xFFFFFF00), 0, Data, 0x11, 3); }
}
public int EV_HP { get { return BigEndian.ToUInt16(Data, 0x14); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x14); } }
public int EV_ATK { get { return BigEndian.ToUInt16(Data, 0x16); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x16); } }
public int EV_DEF { get { return BigEndian.ToUInt16(Data, 0x18); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x18); } }
public int EV_SPE { get { return BigEndian.ToUInt16(Data, 0x1A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1A); } }
public int EV_SPC { get { return BigEndian.ToUInt16(Data, 0x1C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1C); } }
public int EV_SPA { get { return EV_SPC; } set { EV_SPC = value; } }
public int EV_SPD { get { return EV_SPC; } set { } }
public ushort DV16 { get { return BigEndian.ToUInt16(Data, 0x1E); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x1E); } }
public int IV_HP { get { return ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); } set { } }
public int IV_ATK { get { return (DV16 >> 12) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } }
public int IV_DEF { get { return (DV16 >> 8) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } }
public int IV_SPE { get { return (DV16 >> 4) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } }
public int IV_SPC { get { return (DV16 >> 0) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } }
public int IV_SPA { get { return IV_SPC; } set { IV_SPC = value; } }
public int IV_SPD { get { return IV_SPC; } set { } }
public int Move1_PP { get { return Data[0x20] & 0x3F; } set { Data[0x20] = (byte)((Data[0x1D] & 0xC0) | (value & 0x3F)); } }
public int Move2_PP { get { return Data[0x21] & 0x3F; } set { Data[0x21] = (byte)((Data[0x1E] & 0xC0) | (value & 0x3F)); } }
public int Move3_PP { get { return Data[0x22] & 0x3F; } set { Data[0x22] = (byte)((Data[0x1F] & 0xC0) | (value & 0x3F)); } }
public int Move4_PP { get { return Data[0x23] & 0x3F; } set { Data[0x23] = (byte)((Data[0x20] & 0xC0) | (value & 0x3F)); } }
public int Move1_PPUps { get { return (Data[0x20] & 0xC0) >> 6; } set { Data[0x20] = (byte)((Data[0x1D] & 0x3F) | ((value & 0x3) << 6)); } }
public int Move2_PPUps { get { return (Data[0x21] & 0xC0) >> 6; } set { Data[0x21] = (byte)((Data[0x1E] & 0x3F) | ((value & 0x3) << 6)); } }
public int Move3_PPUps { get { return (Data[0x22] & 0xC0) >> 6; } set { Data[0x22] = (byte)((Data[0x1F] & 0x3F) | ((value & 0x3) << 6)); } }
public int Move4_PPUps { get { return (Data[0x23] & 0xC0) >> 6; } set { Data[0x23] = (byte)((Data[0x20] & 0x3F) | ((value & 0x3) << 6)); } }
public int Stat_Level
{
get { return Data[0x24]; }
set { Data[0x24] = (byte)value; Data[0x4] = (byte)value; }
}
public int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x26); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } }
public int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x28); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } }
public int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x2A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } }
public int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x2C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } }
public int Stat_SPC { get { return BigEndian.ToUInt16(Data, 0x2E); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
// Leave SPA and SPD as alias for SPC
public int Stat_SPA { get { return Stat_SPC; } set { Stat_SPC = value; } }
public int Stat_SPD { get { return Stat_SPC; } set { } }
public string raw_Nick()
{
return BitConverter.ToString(Data, 0x30, 0xF);
}
public string raw_OT()
{
return BitConverter.ToString(Data, 0x40, 0xF);
}
public byte[] gb_string(int name) //0 nickname, 1 OT
{
int offset = 0x30;
if (name == 1)
offset = 0x40;
byte[] jnick = new byte[6];
int i, j;
UInt16 temp = 0;
UInt16 temp2 = 0;
for (i=0;i<0x5;i++)
{
temp = BitConverter.ToUInt16(Data, offset+(i*2));
temp = (ushort)((ushort)((temp & 0xff) << 8) | ((temp >> 8) & 0xff));
temp2 = 0;
//Handle special ゜ (0xA59C) and ゛ (0xA59B) characters
//I don't actually know if the n64 game handles this characters as a separate character,
//but since it seems to follow some kind of standard and not use a custom font/encoding like the GB games,
//this seems the most reasonable way to do it (without actual knowledge of the specific encoding the game uses)
if(i<0x5)
{
temp2 = BitConverter.ToUInt16(Data, offset+(i*2)+2);
temp2 = (ushort)((ushort)((temp2 & 0xff) << 8) | ((temp2 >> 8) & 0xff));
}
if (temp2 == 0xA59C)
{
if (temp == 0xA5A4)
jnick[i] = 0x01;
else if (temp == 0xA5A8)
jnick[i] = 0x03;
else if (temp == 0xA5AA)
jnick[i] = 0x04;
else if (temp == 0xA5CA)
jnick[i] = 0x14;
else if (temp == 0xA5CB)
jnick[i] = 0x14;
else if (temp == 0xA5CC)
jnick[i] = 0x16;
else if (temp == 0xA5CD)
jnick[i] = 0x17;
else if (temp == 0xA5CE)
jnick[i] = 0x18;
else if (temp == 0xA5DE)
jnick[i] = 0x1D;
else if (temp == 0xA5DF)
jnick[i] = 0x1E;
else if (temp == 0xA5E0)
jnick[i] = 0x1F;
else if (temp == 0xA5A3)
jnick[i] = 0x20;
else if (temp == 0xA542)
jnick[i] = 0x21;
else if (temp == 0xA544)
jnick[i] = 0x22;
else if (temp == 0xA548)
jnick[i] = 0x24;
else if (temp == 0xA54A)
jnick[i] = 0x25;
else if (temp == 0xA56A)
jnick[i] = 0x35;
else if (temp == 0xA56B)
jnick[i] = 0x36;
else if (temp == 0xA56C)
jnick[i] = 0x37;
else if (temp == 0xA56D)
jnick[i] = 0x38;
else if (temp == 0xA56E)
jnick[i] = 0x39;
else if (temp == 0xA57E)
jnick[i] = 0x3F;
else //This should not happen afaik
{
MessageBox.Show("Unrecognized n64 string encoding 0x"+temp.ToString("X")+" 0x"+temp2.ToString("X"));
jnick[i] = 0x00;
}
i++;//Skip the special character
}
else if (temp2 == 0xA59B)
{
if (temp == 0xA57E)
jnick[i] = 0x49;
else if (temp == 0xA582)
jnick[i] = 0x4D;
else //This should not happen afaik
{
MessageBox.Show("Unrecognized n64 string encoding 0x"+temp.ToString("X")+" 0x"+temp2.ToString("X"));
jnick[i] = 0x00;
}
i++;//Skip the special character
}
else //Not a special ゜ (0xA59C) or ゛ (0xA59B)
{
if (temp == 0)
{
jnick[i] = 0x50;
break;
}
for (j=0xFF;j>0;j--) //Reverse for loop, because this way characters without special ゜ (0xA59C) or ゛ (0xA59B) are asigned first.
{
if (temp == 0xA1A1)//Invalid chars are mapped to this
{
}
else if (chartable[j] == temp)
{
jnick[i] = (byte)j;
break;
}
}
}
}
return jnick;
}
public byte[] convertojpk1()
{
byte [] temparray = new byte[44];
jpk1 jpoke = new jpk1(temparray);
jpoke.Species = speciestable[Species];
jpoke.Stat_HPCurrent = Stat_HPCurrent;
jpoke.Stat_Level = Stat_Level;
jpoke.Status_Condition = Status_Condition;
jpoke.Type_A = Type_A;
jpoke.Type_B = Type_B;
jpoke.Catch_Rate = Catch_Rate;
jpoke.Move1 = Move1;
jpoke.Move2 = Move2;
jpoke.Move3 = Move3;
jpoke.Move4 = Move4;
jpoke.TID = TID;
jpoke.EXP = EXP;
jpoke.EV_HP = EV_HP;
jpoke.EV_ATK = EV_ATK;
jpoke.EV_DEF = EV_DEF;
jpoke.EV_SPE = EV_SPE;
jpoke.EV_SPC = EV_SPC;
jpoke.DV16 = DV16;
jpoke.Move1_PPUps = Move1_PPUps;
jpoke.Move2_PPUps = Move2_PPUps;
jpoke.Move3_PPUps = Move3_PPUps;
jpoke.Move4_PPUps = Move4_PPUps;
jpoke.Stat_HPMax = Stat_HPMax;
jpoke.Stat_ATK = Stat_ATK;
jpoke.Stat_DEF = Stat_DEF;
jpoke.Stat_SPE = Stat_SPE;
jpoke.Stat_SPC = Stat_SPC;
byte[] finalpoke = new byte[59];
finalpoke[0] = 0x01;
finalpoke[1] = (byte)Species;
finalpoke[2] = 0xFF;
jpoke.Data.CopyTo(finalpoke, 3);
gb_string(1).CopyTo(finalpoke, 47);//OT
gb_string(0).CopyTo(finalpoke, 53);//Nickname
//To do: NICK and OT conversion
return finalpoke;
}
internal int[] speciestable = new int[152];
internal void init_speciestable()
{
speciestable[1] = 0x99;
speciestable[2] = 0x9;
speciestable[3] = 0x9A;
speciestable[4] = 0xB0;
speciestable[5] = 0xB2;
speciestable[6] = 0xB4;
speciestable[7] = 0xB1;
speciestable[8] = 0xB3;
speciestable[9] = 0x1C;
speciestable[10] = 0x7B;
speciestable[11] = 0x7C;
speciestable[12] = 0x7D;
speciestable[13] = 0x70;
speciestable[14] = 0x71;
speciestable[15] = 0x72;
speciestable[16] = 0x24;
speciestable[17] = 0x96;
speciestable[18] = 0x97;
speciestable[19] = 0xA5;
speciestable[20] = 0xA6;
speciestable[21] = 0x5;
speciestable[22] = 0x23;
speciestable[23] = 0x6C;
speciestable[24] = 0x2D;
speciestable[25] = 0x54;
speciestable[26] = 0x55;
speciestable[27] = 0x60;
speciestable[28] = 0x61;
speciestable[29] = 0x0F;
speciestable[30] = 0xA8;
speciestable[31] = 0x10;
speciestable[32] = 0x3;
speciestable[33] = 0xA7;
speciestable[34] = 0x7;
speciestable[35] = 0x4;
speciestable[36] = 0x8E;
speciestable[37] = 0x52;
speciestable[38] = 0x53;
speciestable[39] = 0x64;
speciestable[40] = 0x65;
speciestable[41] = 0x6B;
speciestable[42] = 0x82;
speciestable[43] = 0xB9;
speciestable[44] = 0xBA;
speciestable[45] = 0xBB;
speciestable[46] = 0x6D;
speciestable[47] = 0x2E;
speciestable[48] = 0x41;
speciestable[49] = 0x77;
speciestable[50] = 0x3B;
speciestable[51] = 0x76;
speciestable[52] = 0x4D;
speciestable[53] = 0x90;
speciestable[54] = 0x2F;
speciestable[55] = 0x80;
speciestable[56] = 0x39;
speciestable[57] = 0x75;
speciestable[58] = 0x21;
speciestable[59] = 0x14;
speciestable[60] = 0x47;
speciestable[61] = 0x6E;
speciestable[62] = 0x6F;
speciestable[63] = 0x94;
speciestable[64] = 0x26;
speciestable[65] = 0x95;
speciestable[66] = 0x6A;
speciestable[67] = 0x29;
speciestable[68] = 0x7E;
speciestable[69] = 0xBC;
speciestable[70] = 0xBD;
speciestable[71] = 0xBE;
speciestable[72] = 0x18;
speciestable[73] = 0x9B;
speciestable[74] = 0xA9;
speciestable[75] = 0x27;
speciestable[76] = 0x31;
speciestable[77] = 0xA3;
speciestable[78] = 0xA4;
speciestable[79] = 0x25;
speciestable[80] = 0x8;
speciestable[81] = 0xAD;
speciestable[82] = 0x36;
speciestable[83] = 0x40;
speciestable[84] = 0x46;
speciestable[85] = 0x74;
speciestable[86] = 0x3A;
speciestable[87] = 0x78;
speciestable[88] = 0x0D;
speciestable[89] = 0x88;
speciestable[90] = 0x17;
speciestable[91] = 0x8B;
speciestable[92] = 0x19;
speciestable[93] = 0x93;
speciestable[94] = 0x0E;
speciestable[95] = 0x22;
speciestable[96] = 0x30;
speciestable[97] = 0x81;
speciestable[98] = 0x4E;
speciestable[99] = 0x8A;
speciestable[100] = 0x6;
speciestable[101] = 0x8D;
speciestable[102] = 0x0C;
speciestable[103] = 0x0A;
speciestable[104] = 0x11;
speciestable[105] = 0x91;
speciestable[106] = 0x2B;
speciestable[107] = 0x2C;
speciestable[108] = 0x0B;
speciestable[109] = 0x37;
speciestable[110] = 0x8F;
speciestable[111] = 0x12;
speciestable[112] = 0x1;
speciestable[113] = 0x28;
speciestable[114] = 0x1E;
speciestable[115] = 0x2;
speciestable[116] = 0x5C;
speciestable[117] = 0x5D;
speciestable[118] = 0x9D;
speciestable[119] = 0x9E;
speciestable[120] = 0x1B;
speciestable[121] = 0x98;
speciestable[122] = 0x2A;
speciestable[123] = 0x1A;
speciestable[124] = 0x48;
speciestable[125] = 0x35;
speciestable[126] = 0x33;
speciestable[127] = 0x1D;
speciestable[128] = 0x3C;
speciestable[129] = 0x85;
speciestable[130] = 0x16;
speciestable[131] = 0x13;
speciestable[132] = 0x4C;
speciestable[133] = 0x66;
speciestable[134] = 0x69;
speciestable[135] = 0x68;
speciestable[136] = 0x67;
speciestable[137] = 0xAA;
speciestable[138] = 0x62;
speciestable[139] = 0x63;
speciestable[140] = 0x5A;
speciestable[141] = 0x5B;
speciestable[142] = 0xAB;
speciestable[143] = 0x84;
speciestable[144] = 0x4A;
speciestable[145] = 0x4B;
speciestable[146] = 0x49;
speciestable[147] = 0x58;
speciestable[148] = 0x59;
speciestable[149] = 0x42;
speciestable[150] = 0x83;
speciestable[151] = 0x15;
/*
//Some Gen 1 Missingnos
speciestable[] = 0x1F;
speciestable[] = 0x20;
speciestable[] = 0x32;
speciestable[] = 0x34;
speciestable[] = 0x38;
speciestable[] = 0x3D;
speciestable[] = 0x3E;
speciestable[] = 0x3F;
speciestable[] = 0x43;
speciestable[] = 0x44;
speciestable[] = 0x45;
speciestable[] = 0x4F;
speciestable[] = 0x50;
speciestable[] = 0x51;
speciestable[] = 0x56;
speciestable[] = 0x57;
speciestable[] = 0x5E;
speciestable[] = 0x5F;
speciestable[] = 0x73;
speciestable[] = 0x79;
speciestable[] = 0x7A;
speciestable[] = 0x7F;
speciestable[] = 0x86;
speciestable[] = 0x87;
speciestable[] = 0x89;
speciestable[] = 0x8C;
speciestable[] = 0x92;
speciestable[] = 0x9C;
speciestable[] = 0x9F;
speciestable[] = 0xA0;
speciestable[] = 0xA1;
speciestable[] = 0xA2;
speciestable[] = 0xAC;
speciestable[] = 0xAE;
speciestable[] = 0xAF;
speciestable[] = 0xB5;
speciestable[] = 0xB6;
speciestable[] = 0xB7;
speciestable[] = 0xB8;
*/
/*
speciestable[112] = 0x1;
speciestable[115] = 0x2;
speciestable[32] = 0x3;
speciestable[35] = 0x4;
speciestable[21] = 0x5;
speciestable[100] = 0x6;
speciestable[34] = 0x7;
speciestable[80] = 0x8;
speciestable[2] = 0x9;
speciestable[103] = 0x0A;
speciestable[108] = 0x0B;
speciestable[102] = 0x0C;
speciestable[88] = 0x0D;
speciestable[94] = 0x0E;
speciestable[29] = 0x0F;
speciestable[31] = 0x10;
speciestable[104] = 0x11;
speciestable[111] = 0x12;
speciestable[131] = 0x13;
speciestable[59] = 0x14;
speciestable[151] = 0x15;
speciestable[130] = 0x16;
speciestable[90] = 0x17;
speciestable[72] = 0x18;
speciestable[92] = 0x19;
speciestable[123] = 0x1A;
speciestable[120] = 0x1B;
speciestable[9] = 0x1C;
speciestable[127] = 0x1D;
speciestable[114] = 0x1E;
speciestable[58] = 0x21;
speciestable[95] = 0x22;
speciestable[22] = 0x23;
speciestable[16] = 0x24;
speciestable[79] = 0x25;
speciestable[64] = 0x26;
speciestable[75] = 0x27;
speciestable[113] = 0x28;
speciestable[67] = 0x29;
speciestable[122] = 0x2A;
speciestable[106] = 0x2B;
speciestable[107] = 0x2C;
speciestable[24] = 0x2D;
speciestable[47] = 0x2E;
speciestable[54] = 0x2F;
speciestable[96] = 0x30;
speciestable[76] = 0x31;
speciestable[126] = 0x33;
speciestable[125] = 0x35;
speciestable[82] = 0x36;
speciestable[109] = 0x37;
speciestable[56] = 0x39;
speciestable[86] = 0x3A;
speciestable[50] = 0x3B;
speciestable[128] = 0x3C;
speciestable[83] = 0x40;
speciestable[48] = 0x41;
speciestable[149] = 0x42;
speciestable[84] = 0x46;
speciestable[60] = 0x47;
speciestable[124] = 0x48;
speciestable[146] = 0x49;
speciestable[144] = 0x4A;
speciestable[145] = 0x4B;
speciestable[132] = 0x4C;
speciestable[52] = 0x4D;
speciestable[98] = 0x4E;
speciestable[37] = 0x52;
speciestable[38] = 0x53;
speciestable[25] = 0x54;
speciestable[26] = 0x55;
speciestable[147] = 0x58;
speciestable[148] = 0x59;
speciestable[140] = 0x5A;
speciestable[141] = 0x5B;
speciestable[116] = 0x5C;
speciestable[117] = 0x5D;
speciestable[27] = 0x60;
speciestable[28] = 0x61;
speciestable[138] = 0x62;
speciestable[139] = 0x63;
speciestable[39] = 0x64;
speciestable[40] = 0x65;
speciestable[133] = 0x66;
speciestable[136] = 0x67;
speciestable[135] = 0x68;
speciestable[134] = 0x69;
speciestable[66] = 0x6A;
speciestable[41] = 0x6B;
speciestable[23] = 0x6C;
speciestable[46] = 0x6D;
speciestable[61] = 0x6E;
speciestable[62] = 0x6F;
speciestable[13] = 0x70;
speciestable[14] = 0x71;
speciestable[15] = 0x72;
speciestable[85] = 0x74;
speciestable[57] = 0x75;
speciestable[51] = 0x76;
speciestable[49] = 0x77;
speciestable[87] = 0x78;
speciestable[10] = 0x7B;
speciestable[11] = 0x7C;
speciestable[12] = 0x7D;
speciestable[68] = 0x7E;
speciestable[55] = 0x80;
speciestable[97] = 0x81;
speciestable[42] = 0x82;
speciestable[150] = 0x83;
speciestable[143] = 0x84;
speciestable[129] = 0x85;
speciestable[89] = 0x88;
speciestable[99] = 0x8A;
speciestable[91] = 0x8B;
speciestable[101] = 0x8D;
speciestable[36] = 0x8E;
speciestable[110] = 0x8F;
speciestable[53] = 0x90;
speciestable[105] = 0x91;
speciestable[93] = 0x93;
speciestable[63] = 0x94;
speciestable[65] = 0x95;
speciestable[17] = 0x96;
speciestable[18] = 0x97;
speciestable[121] = 0x98;
speciestable[1] = 0x99;
speciestable[3] = 0x9A;
speciestable[73] = 0x9B;
speciestable[118] = 0x9D;
speciestable[119] = 0x9E;
speciestable[77] = 0xA3;
speciestable[78] = 0xA4;
speciestable[19] = 0xA5;
speciestable[20] = 0xA6;
speciestable[33] = 0xA7;
speciestable[30] = 0xA8;
speciestable[74] = 0xA9;
speciestable[137] = 0xAA;
speciestable[142] = 0xAB;
speciestable[81] = 0xAD;
speciestable[4] = 0xB0;
speciestable[7] = 0xB1;
speciestable[5] = 0xB2;
speciestable[8] = 0xB3;
speciestable[6] = 0xB4;
speciestable[43] = 0xB9;
speciestable[44] = 0xBA;
speciestable[45] = 0xBB;
speciestable[69] = 0xBC;
speciestable[70] = 0xBD;
speciestable[71] = 0xBE;
*/
}
internal UInt16[] chartable = new UInt16[256];
internal void init_table()
{
//All commented chars become 0xA1A1 in stadium (space character)
chartable[0x00] = 0x00; //NULL
//chartable[0x01] = 0xA5A4; //イ゛ //SPECIAL (2 CHARACTERS) A5A4 + A59B
//chartable[0x02] = 0xA5F4; //ヴ
//chartable[0x03] = 0xA5A8; //エ゛ //SPECIAL (2 CHARACTERS) A5A8 + A59B
//chartable[0x04] = 0xA5AA; //オ゛ //SPECIAL (2 CHARACTERS) A5AA + A59B
chartable[0x05] = 0xA5AC; //ガ
chartable[0x06] = 0xA5AE; //ギ
chartable[0x07] = 0xA5B0; //グ
chartable[0x08] = 0xA5B2; //ゲ
chartable[0x09] = 0xA5B4; //ゴ
chartable[0x0A] = 0xA5B6; //ザ
chartable[0x0B] = 0xA5B8; //ジ
chartable[0x0C] = 0xA5BA; //ズ
chartable[0x0D] = 0xA5BC; //ゼ
chartable[0x0E] = 0xA5BE; //ゾ
chartable[0x0F] = 0xA5C0; //ダ
chartable[0x10] = 0xA5C2; //ヂ
chartable[0x11] = 0xA5C5; //ヅ
chartable[0x12] = 0xA5C7; //デ
chartable[0x13] = 0xA5C9; //ド
//chartable[0x14] = 0xA5CA; //ナ゛ //SPECIAL (2 CHARACTERS) A5CA + A59B
//chartable[0x15] = 0xA5CB; //ニ゛ //SPECIAL (2 CHARACTERS) A5CB + A59B
//chartable[0x16] = 0xA5CC; //ヌ゛ //SPECIAL (2 CHARACTERS) A5CC + A59B
//chartable[0x17] = 0xA5CD; //ネ゛ //SPECIAL (2 CHARACTERS) A5CD + A59B
//chartable[0x18] = 0xA5CE; //ノ゛ //SPECIAL (2 CHARACTERS) A5CE + A59B
chartable[0x19] = 0xA5D0; //バ
chartable[0x1A] = 0xA5D3; //ビ
chartable[0x1B] = 0xA5D6; //ブ
chartable[0x1C] = 0xA5DC; //ボ
//chartable[0x1D] = 0xA5DE; //マ゛ //SPECIAL (2 CHARACTERS) A5DE + A59B
//chartable[0x1E] = 0xA5DF; //ミ゛ //SPECIAL (2 CHARACTERS) A5DF + A59B
//chartable[0x1F] = 0xA5E0; //ム゛ //SPECIAL (2 CHARACTERS) A5E0 + A59B
//chartable[0x20] = 0xA5A3; //ィ゛ //SPECIAL (2 CHARACTERS) A5A3 + A59B
//chartable[0x21] = 0xA542; //あ゛ //SPECIAL (2 CHARACTERS) A543 + A59B
//chartable[0x22] = 0xA544; //い゛ //SPECIAL (2 CHARACTERS) A544 + A59B
//chartable[0x23] = 0xA5F4; //ゔ
//chartable[0x24] = 0xA548; //え゛ //SPECIAL (2 CHARACTERS) A548 + A59B
//chartable[0x25] = 0xA54A; //お゛ //SPECIAL (2 CHARACTERS) A54A + A59B
chartable[0x26] = 0xA4AC; //が
chartable[0x27] = 0xA4AE; //ぎ
chartable[0x28] = 0xA4B0; //ぐ
chartable[0x29] = 0xA4B2; //げ
chartable[0x2A] = 0xA4B4; //ご
chartable[0x2B] = 0xA4B6; //ざ
chartable[0x2C] = 0xA4B8; //じ
chartable[0x2D] = 0xA4BA; //ず
chartable[0x2E] = 0xA4BC; //ぜ
chartable[0x2F] = 0xA4BE; //ぞ
chartable[0x30] = 0xA4C0; //だ
chartable[0x31] = 0xA4C2; //ぢ
chartable[0x32] = 0xA4C5; //づ
chartable[0x33] = 0xA4C7; //で
chartable[0x34] = 0xA4C9; //ど
//chartable[0x35] = 0xA56A; //な゛ //SPECIAL (2 CHARACTERS) A56A + A59B
//chartable[0x36] = 0xA56B; //に゛ //SPECIAL (2 CHARACTERS) A56B + A59B
//chartable[0x37] = 0xA56C; //ぬ゛ //SPECIAL (2 CHARACTERS) A56C + A59B
//chartable[0x38] = 0xA56D; //ね゛ //SPECIAL (2 CHARACTERS) A56D + A59B
//chartable[0x39] = 0xA56E; //の゛ //SPECIAL (2 CHARACTERS) A56E + A59B
chartable[0x3A] = 0xA4D0; //ば
chartable[0x3B] = 0xA4D3; //び
chartable[0x3C] = 0xA4D6; //ぶ
chartable[0x3D] = 0xA4DA; //べ
chartable[0x3E] = 0xA4DD; //ぼ
//chartable[0x3F] = 0xA57E; //ま゛ //SPECIAL (2 CHARACTERS) A57E + A59B
//chartable[0x40] = 0xA5D1; //パ
//chartable[0x41] = 0xA5D4; //ピ
chartable[0x42] = 0xA5D7; //プ
chartable[0x43] = 0xA5DD; //ポ
chartable[0x44] = 0xA4D1; //ぱ
chartable[0x45] = 0xA4D4; //ぴ
chartable[0x46] = 0xA4D7; //ぷ
//chartable[0x47] = 0xAA; //ぺ
//chartable[0x48] = 0xA57D; //ぽ
//chartable[0x49] = 0xA57E; //ま゜ //SPECIAL (2 CHARACTERS) A57E + A59C
//chartable[0x4A] = 0x00; //Control
//chartable[0x4B] = 0x00; //Control
//chartable[0x4C] = 0x00; //Control
//chartable[0x4D] = 0xA582; //も゜ //SPECIAL (2 CHARACTERS) A582 + A59C
//chartable[0x4E] = 0x00; //Control
//chartable[0x4F] = 0x00; //Control
/*
chartable[0x50] = 0x00; //Control
chartable[0x51] = 0x00; //Control
chartable[0x52] = 0x00; //Control
chartable[0x53] = 0x00; //Control
chartable[0x54] = 0x00; //Control
chartable[0x55] = 0x00; //Control
chartable[0x56] = 0x00; //Control
chartable[0x57] = 0x00; //Control
chartable[0x58] = 0x00; //Control
chartable[0x59] = 0x00; //Control
chartable[0x5A] = 0x00; //Control
chartable[0x5B] = 0x00; //Control
chartable[0x5C] = 0x00; //Control
chartable[0x5D] = 0x00; //Control
chartable[0x5E] = 0x00; //Control
chartable[0x5F] = 0x00; //Control
*/
chartable[0x60] = 0xA3C1; //A
chartable[0x61] = 0xA3C2; //B
chartable[0x62] = 0xA3C3; //C
chartable[0x63] = 0xA3C4; //D
chartable[0x64] = 0xA3C5; //E
chartable[0x65] = 0xA3C6; //F
chartable[0x66] = 0xA3C7; //G
chartable[0x67] = 0xA3C8; //H
chartable[0x68] = 0xA3C9; //I
chartable[0x69] = 0xA3CA; //V
chartable[0x6A] = 0xA3CB; //S
chartable[0x6B] = 0xA3CC; //L
chartable[0x6C] = 0xA3CD; //M
chartable[0x6D] = 0xA5CE; //: //N in stadium 1 jap
chartable[0x6E] = 0xA4A3; //ぃ
chartable[0x6F] = 0xA4A5; //ぅ
chartable[0x70] = 0xA3D1; //「 //Q in stadium 1 jap
chartable[0x71] = 0xA3D2; //」 //R in stadium 1 jap
chartable[0x72] = 0xA3D3; //『 //S in stadium 1 jap
chartable[0x73] = 0xA3D4; //』 //T in stadium 1 jap
chartable[0x74] = 0xA3D5; //・ //U in stadium 1 jap
chartable[0x75] = 0xA3D6; //… //V in stadium 1 jap
chartable[0x76] = 0xA4A1; //ぁ
chartable[0x77] = 0xA4A7; //ぇ
chartable[0x78] = 0xA4A9; //ぉ
chartable[0x79] = 0xA3DA; //Unknown unicode //Z in stadium 1 jap
//chartable[0x7A] = 0xA53D; //=
//chartable[0x7B] = 0; //Unknown unicode
//chartable[0x7C] = 0xA57C; //| ****The character in GB is actually two || (need to check if it is a valid in-game text input)
//chartable[0x7D] = 0; //Unknown unicode
//chartable[0x7E] = 0; //Unknown unicode
chartable[0x7F] = 0xA1A1; // space character
chartable[0x80] = 0xA5A2; //ア
chartable[0x81] = 0xA5A4; //イ
chartable[0x82] = 0xA5A6; //ウ
chartable[0x83] = 0xA5A8; //エ
chartable[0x84] = 0xA5AA; //オ
chartable[0x85] = 0xA5AB; //カ
chartable[0x86] = 0xA5AD; //キ
chartable[0x87] = 0xA5AF; //ク
chartable[0x88] = 0xA5B1; //ケ
chartable[0x89] = 0xA5B3; //コ
chartable[0x8A] = 0xA5B5; //サ
chartable[0x8B] = 0xA5B7; //シ
chartable[0x8C] = 0xA5B9; //ス
chartable[0x8D] = 0xA5BB; //セ
chartable[0x8E] = 0xA5BD; //ソ
chartable[0x8E] = 0xA5BF; //タ
chartable[0x90] = 0xA5C1; //チ
chartable[0x91] = 0xA5C4; //ツ
chartable[0x92] = 0xA5C6; //テ
chartable[0x93] = 0xA5C8; //ト
chartable[0x94] = 0xA5CA; //ナ
chartable[0x95] = 0xA5CB; //ニ
chartable[0x96] = 0xA5CC; //ヌ
chartable[0x97] = 0xA5CD; //ネ
chartable[0x98] = 0xA5CE; //
chartable[0x99] = 0xA5CF; //ハ
chartable[0x9A] = 0xA5D2; //ヒ
chartable[0x9B] = 0xA5D5; //フ
chartable[0x9C] = 0xA5DB; //ホ
chartable[0x9D] = 0xA5DE; //マ
chartable[0x9E] = 0xA5DF; //ミ
chartable[0x9F] = 0xA5E0; //ム
chartable[0xA0] = 0xA5E1; //メ
chartable[0xA1] = 0xA5E2; //モ
chartable[0xA2] = 0xA5E4; //ヤ
chartable[0xA3] = 0xA5E6; //ユ
chartable[0xA4] = 0xA5E8; //ヨ
chartable[0xA5] = 0xA5E9; //ラ
chartable[0xA6] = 0xA5EB; //ル
chartable[0xA7] = 0xA5EC; //レ
chartable[0xA8] = 0xA5ED; //ロ
chartable[0xA9] = 0xA5EF; //ワ
chartable[0xAA] = 0xA5F2; //ヲ
chartable[0xAB] = 0xA5F3; //ン
chartable[0xAC] = 0xA5C3; //ッ
chartable[0xAD] = 0xA5E3; //ャ
chartable[0xAE] = 0xA5E5; //ュ
chartable[0xAF] = 0xA5E7; //ョ
chartable[0xB0] = 0xA5A3; //ィ
chartable[0xB1] = 0xA4A2; //あ
chartable[0xB2] = 0xA4A4; //い
chartable[0xB3] = 0xA4A6; //う
chartable[0xB4] = 0xA4A8; //え
chartable[0xB5] = 0xA4AA; //お
chartable[0xB6] = 0xA4AB; //か
chartable[0xB7] = 0xA4AD; //き
chartable[0xB8] = 0xA4AF; //く
chartable[0xB9] = 0xA4B1; //け
chartable[0xBA] = 0xA4B3; //さ
chartable[0xBB] = 0xA4B5; //こ
chartable[0xBC] = 0xA4B7; //し
chartable[0xBD] = 0xA4B9; //す
chartable[0xBE] = 0xA4BB; //せ
chartable[0xBF] = 0xA4BD; //そ
chartable[0xc0] = 0xA4BF; //た
chartable[0xc1] = 0xA4C1; //ち
chartable[0xc2] = 0xA4C4; //つ
chartable[0xc3] = 0xA4C6; //て
chartable[0xc4] = 0xA4C8; //と
chartable[0xc5] = 0xA4CA; //な
chartable[0xc6] = 0xA4CB; //に
chartable[0xc7] = 0xA4CC; //ぬ
chartable[0xc8] = 0xA4CD; //ね
chartable[0xc9] = 0xA4CE; //の
chartable[0xcA] = 0xA4CF; //は
chartable[0xcB] = 0xA4D2; //ひ
chartable[0xcC] = 0xA4D5; //ふ
chartable[0xcD] = 0xA4D8; //へ
chartable[0xcE] = 0xA4DB; //ほ
chartable[0xcF] = 0xA4DE; //ま
chartable[0xD0] = 0xA4DF; //み
chartable[0xD1] = 0xA4E0; //む
chartable[0xD2] = 0xA4E1; //め
chartable[0xD3] = 0xA4E2; //も
chartable[0xD4] = 0xA4E4; //や
chartable[0xD5] = 0xA4E6; //ゆ
chartable[0xD6] = 0xA4E8; //よ
chartable[0xD7] = 0x44E9; //ら
chartable[0xD8] = 0xA4EA; //り
chartable[0xD9] = 0xA4EB; //る
chartable[0xDA] = 0xA4EC; //れ
chartable[0xDB] = 0xA4ED; //ろ
chartable[0xDC] = 0xA4EF; //わ //small version isn't in GB charset (A58E)
chartable[0xDD] = 0xA4F2; //を
chartable[0xDE] = 0xA4F3; //ん
chartable[0xDF] = 0xA4C3; //っ
chartable[0xE0] = 0xA4E3; //ゃ
chartable[0xE1] = 0xA4E5; //ゅ
chartable[0xE2] = 0xA4E7; //ょ
chartable[0xE3] = 0xA1BC; //ー
chartable[0xE4] = 0xA1A3; //゜ //needs special handling?
chartable[0xE5] = 0xA1A5; //゛ //needs special handling?
chartable[0xE6] = 0xA1A9; //?
chartable[0xE7] = 0xA1AA; //!
chartable[0xE8] = 0xA1A; //。 //some sort of ' punctuation, but appers in the bottom in stadium 1 jap
chartable[0xE9] = 0xA5A1; //ァ
chartable[0xEA] = 0xA5A5; //ゥ
chartable[0xEB] = 0xA5A7; //ェ
//chartable[0xEC] = 0xA5B7; //▷
//chartable[0xED] = 0xA5B6; //▶
//chartable[0xEE] = 0xA5BC; //▼
chartable[0xEF] = 0xA1E9; //♂
//chartable[0xF0] = 0xA5A5; //円 //Yen sign, conflicts with ゥ (0xEA in GB table) (need to check if it is a valid in-game text input)
//chartable[0xF1] = 0xA5D7; //× //Conflicts with プ (0x42 in GB table) (need to check if it is a valid in-game text input)
//chartable[0xF2] = 0xA52E; //.
//chartable[0xF3] = 0xA52F; //'/'
//chartable[0xF4] = 0xA5A9; //ォ
chartable[0xF5] = 0xA1EA; //♀
chartable[0xF6] = 0xA3B0; //0
chartable[0xF7] = 0xA3B1; //1
chartable[0xF8] = 0xA3B2; //2
chartable[0xF9] = 0xA3B3; //3
chartable[0xFA] = 0xA3B4; //4
chartable[0xFB] = 0xA3B5; //5
chartable[0xFC] = 0xA3B6; //6
chartable[0xFD] = 0xA3B7; //7
chartable[0xFE] = 0xA3B8; //8
chartable[0xFF] = 0xA3B9; //9
}
}
}