Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging #2

Merged
merged 41 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4e6ee8a
Write out initial structure for the randomizer
Jun 11, 2019
a7a5b1f
Allow item randomization, take steps toward adding logic
Jun 12, 2019
571ba70
Allow randomization of items with a buggy shuffle that's likely to fail
Jun 13, 2019
579ec6d
Improve filler, logic; enumerate all valid items
Jun 14, 2019
d6d9f11
Update logic; still fails to generate seed
Jun 14, 2019
7fbe2e3
Fix helper bug, add Jabber Nut and new chests to logic
Jun 16, 2019
7b22194
Add logic for Mount Crenel locations
Jun 18, 2019
e5a0315
Add capability to apply UPS patches
Jun 19, 2019
95f1498
Add default UPS patch to open the world, update logic
Jun 21, 2019
8baf5b0
Update randoPatch.ups
LeonarthCG Jun 21, 2019
eb6872f
Add Deku Scrubs back to item pool, add beginning of dungeon items
Jun 25, 2019
2de30c5
Update randoPatch.ups
LeonarthCG Jul 1, 2019
6ffeafb
Add dungeon items to logic; somewhat buggy :(
Jul 1, 2019
c030975
Update readme, add Cave of Flames to logic
Jul 1, 2019
299635c
Fix shuffling, logic bugs, remove messy debug prints
Jul 2, 2019
2047c80
fixed graveyard
LeonarthCG Jul 3, 2019
0d4ad68
Fix shuffler - seed generation should have a much higher success rate
Jul 3, 2019
53ca467
small fixes
LeonarthCG Jul 3, 2019
adb93fe
fixed wonky melari/dampe and limited splits in some rooms
LeonarthCG Jul 4, 2019
a957515
Add most Castor Wilds locations
Jul 6, 2019
97120c9
Add Fortress of Winds to logic
Jul 7, 2019
404b1a5
Add Lake Hylia and Temple of Droplets to logic
Jul 9, 2019
b988f8a
Add palace of winds to logic, fix caching
Jul 14, 2019
98c230a
Make randomization testable
Jul 14, 2019
c4ab5a1
Add ToD to shuffle, fix locations for better accuracy
Jul 22, 2019
515c294
Fix logic bugs, fix logic parser
Jul 28, 2019
fdfd21f
Fix nested logic parsing, print subtype
Jul 29, 2019
f32fe90
Make Kinstone spoilers more clear
Jul 29, 2019
a666fa1
fix some duplicate chest id's
wjg999 Jul 29, 2019
26d5656
change lang version
mikeskydev Jul 31, 2019
9cf8169
add colorzcore
mikeskydev Jul 31, 2019
6145baa
include colourzcore setup
mikeskydev Jul 31, 2019
23f6ac2
include patch files for opening up game
mikeskydev Jul 31, 2019
98009e1
Rearrange and comment code, improve build steps, add ColorzCore to so…
Aug 2, 2019
8e4d45c
Build with EA instead of a UPS patch
Aug 3, 2019
998f2f5
Copy language raws to build
Aug 3, 2019
b3bafd9
fix build issues
mikeskydev Aug 4, 2019
07f5008
prevent ocarina induced softlocking
mikeskydev Aug 4, 2019
063d89c
add completion popup, disable patch button for now
mikeskydev Aug 4, 2019
f4cefdf
Update README.md
mikeskydev Aug 4, 2019
1d3f24b
Update README.md
mikeskydev Aug 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Vendor/ColorzCore"]
path = Vendor/ColorzCore
url = https://github.com/minishmaker/ColorzCore.git
6 changes: 6 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
226 changes: 226 additions & 0 deletions Core/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
using System;
using System.IO;
using System.Reflection;

namespace MinishRandomizer.Core
{
public enum RegionVersion
{
EU,
JP,
US,
None
}

public struct HeaderData
{
public int MapHeaderBase;
// Name on this is gonna have to change sometime
public int AreaMetadataBase;

//added for now, change names to whatever you want
public int tileOffset;
public int paletteSetTableLoc;
public int chunk0TableLoc;
public int area1Chunk0TableLoc;
public int chunk1TableLoc;
public int chunk2TableLoc;
public int swapBase;
public int paletteChangeBase;
public int area1SwapBase;
public int globalTileSetTableLoc;
public int gfxSourceBase;
public int globalMetaTileSetTableLoc;
public int globalTileDataTableLoc;

public HeaderData( int map, int area, int tileOffset, int paletteSetTableLoc, int c0TableLoc, int a1C0TableLoc, int c1TableLoc, int c2TableLoc, int swapBase, int paletteChangeBase, int area1SwapBase, int globalTileSetTableLoc, int gfxSourceBase, int globalMetaTileSetTableLoc, int globalTileDataTableLoc )
{
this.MapHeaderBase = map;
this.AreaMetadataBase = area;
this.tileOffset = tileOffset;
this.paletteSetTableLoc = paletteSetTableLoc;
this.chunk0TableLoc = c0TableLoc; //looks like each next chunkTable is a 0x16 further (eu and us), not adding because of possible jp
this.area1Chunk0TableLoc = a1C0TableLoc;
this.chunk1TableLoc = c1TableLoc; //c0+ 0x16
this.chunk2TableLoc = c2TableLoc; //c0+ 0x32
this.swapBase = swapBase;
this.paletteChangeBase = paletteChangeBase;
this.area1SwapBase = area1SwapBase; //above -0x140?
this.globalTileSetTableLoc = globalTileSetTableLoc;
this.gfxSourceBase = gfxSourceBase;
this.globalMetaTileSetTableLoc = globalMetaTileSetTableLoc;
this.globalTileDataTableLoc = globalTileDataTableLoc;
}
}

public enum TileEntityType
{
None = 0x00,
TestA = 0x01,
Chest = 0x02,
BigChest = 0x03,
TestB = 0x04,
TestC = 0x05,
}

public enum KinstoneType
{
UnTyped,

YellowTornadoProng = 0x65,
YellowTornadoSpike = 0x66,
YellowTornadoChaotic = 0x67,
//68 and 69 are repeats of above

YellowTotemProng = 0x6A,
YellowTotemWave = 0x6B,
YellowTotemZigZag = 0x6C,

YellowCrown = 0x6D,

RedSpike = 0x6E,
RedCrack = 0x6F,
RedProng = 0x70,

BlueL = 0x71,
BlueS = 0x72,

GreenSpike = 0x73,
GreenSquare = 0x74,
GreenSplit = 0x75,
}

public enum ItemType
{
Untyped,
SmithSword = 0x01,
GreenSword = 0x02,
RedSword = 0x03,
BlueSword = 0x04,
// UnusedSword = 0x05,
FourSword = 0x06,
Bombs = 0x07,
RemoteBombs = 0x08,
Bow = 0x09,
LightArrow = 0x0A,
Boomerang = 0x0B,
MagicBoomerang = 0x0C,
Shield = 0x0D,
MirrorShield = 0x0E,
LanternOff = 0x0F,

GustJar = 0x11,
PacciCane = 0x12,
MoleMitts = 0x13,
RocsCape = 0x14,
PegasusBoots = 0x15,
FireRod = 0x16,
Ocarina = 0x17,
Bottle1 = 0x1C,
Bottle2 = 0x1D,
Bottle3 = 0x1E,
Bottle4 = 0x1F,
BottleEmpty = 0x20,
BottleButter = 0x21,
BottleMilk = 0x22,
BottleHalfMilk = 0x23,
BottleRedPotion = 0x24,
BottleBluePotion = 0x25,
BottleWater = 0x26,
BottleMineralWater = 0x27,
BottleFairy = 0x28,
BottlePicolyteRed = 0x29,
BottlePicolyteOrange = 0x2A,
BottlePicolyteYellow = 0x2B,
BottlePiclolyteGreen = 0x2C,
BottlePicolyteBlue = 0x2D,
BottlePicolyteWhite = 0x2E,
BottleCharmNayru = 0x2F,
BottleCharmFarore = 0x30,
BottleCharmDin = 0x31,


SmithSwordQuest = 0x34,
BrokenPicoriBlade = 0x35,
DogFoodBottle = 0x36,
LonLonKey = 0x37,
WakeUpMushroom = 0x38,
HyruleanBestiary = 0x39,
PicoriLegend = 0x3A,
MaskHistory = 0x3B,
GraveyardKey = 0x3C,
TingleTrophy = 0x3D,
CarlovMedal = 0x3E,
ShellsX = 0x3F,
EarthElement = 0x40,
FireElement = 0x41,
WaterElement = 0x42,
WindElement = 0x43,
GripRing = 0x44,
PowerBracelets = 0x45,
Flippers = 0x46,
HyruleMap = 0x47,
SpinAttack = 0x48,
RollAttack = 0x49,
DashAttack = 0x4A,
RockBreaker = 0x4B,
SwordBeam = 0x4C,
GreatSpin = 0x4D,
DownThrust = 0x4E,
PerilBeam = 0x4F,
DungeonMap = 0x50,
Compass = 0x51,
BigKey = 0x52,
SmallKey = 0x53,
Rupee1 = 0x54,
Rupee5 = 0x55,
Rupee20 = 0x56,
Rupee50 = 0x57,
Rupee100 = 0x58,
Rupee200 = 0x59,

JabberNut = 0x5B,
KinstoneX = 0x5C,
Bombs5 = 0x5D,
Arrows5 = 0x5E,
SmallHeart = 0x5F,
Fairy = 0x60,
Shells30 = 0x61,
HeartContainer = 0x62,
PieceOfHeart = 0x63,
Wallet = 0x64,
BombBag = 0x65,
LargeQuiver = 0x66,
KinstoneBag = 0x67,
Brioche = 0x68,
Croissant = 0x69,
PieSlice = 0x6A,
CakeSlice = 0x6B,
Bombs10 = 0x6C,
Bombs30 = 0x6D,
Arrows10 = 0x6E,
Arrows30 = 0x6F,
ArrowButterfly = 0x70,
DigButterfly = 0x71,
SwimButterfly = 0x72,
FastSpin = 0x73,
FastSplit = 0x74,
LongSpin = 0x75
}

public class Header
{
// Will fill out when relevant, only need EU for now
private readonly HeaderData[] headerTable = new HeaderData[]
{ // MAP , ENTITY?, TILEOFFSET PALETTESET CHUNK0 CHUNK0AREA1 CHUNK1 CHUNK2 SWAP PALETTECHANGE AREA1SWAP TILESET GFXSOURCE METATILE TILEDATA
new HeaderData(0x11D95C, 0x0D4828, 0x5A23D0, 0xFED88, 0x107AEC, 0x1077AC, 0x107B02, 0x107B18, 0x107B5C, 0x107940, 0x107800, 0x101BC8, 0x323FEC, 0x1027F8, 0x1070E4),
new HeaderData(0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0),
new HeaderData(0x11E214, 0x0D50FC, 0x5A2E80, 0xFF850, 0x108398, 0x108050, 0x1083AE, 0x1083C4, 0x108408, 0x1081E4, 0x1080A4, 0x10246C, 0x324AE4, 0x10309C, 0x107988)
};

public HeaderData GetHeaderAddresses( RegionVersion region )
{
return headerTable[(int)region];
}
}
}
70 changes: 70 additions & 0 deletions Core/ROM.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Diagnostics;
using MinishRandomizer.Utilities;
using System.IO;

namespace MinishRandomizer.Core
{
public class ROM
{
public static ROM Instance { get; private set; }
public readonly string path;

public readonly byte[] romData;
public readonly Reader reader;

public RegionVersion version { get; private set; } = RegionVersion.None;
public HeaderData headers { get; private set; }


public ROM(string filePath)
{
Instance = this;
path = filePath;
byte[] smallData = File.ReadAllBytes(filePath);
if (smallData.Length >= 0x02000000)
{
romData = smallData;
}
else
{
romData = new byte[0x2000000];
smallData.CopyTo(romData, 0);
}

Stream stream = Stream.Synchronized(new MemoryStream(romData));
reader = new Reader(stream);
Debug.WriteLine("Read " + stream.Length + " bytes.");

SetupRom();
}

private void SetupRom()
{
// Determine game region and if valid ROM
byte[] regionBytes = reader.ReadBytes(4, 0xAC);
string region = System.Text.Encoding.UTF8.GetString(regionBytes);
Debug.WriteLine("Region detected: "+region);

if (region == "BZMP")
{
version = RegionVersion.EU;
}

if (region == "BZMJ")
{
version = RegionVersion.JP;
}

if (region == "BZME")
{
version = RegionVersion.US;
}

if (version != RegionVersion.None)
{
headers = new Header().GetHeaderAddresses(version);
}
}
}
}
Loading