Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 9 additions & 5 deletions CadEditor/settings_nes/castlevania/Settings_Castlevania-1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

public class Data
{
public OffsetRec getScreensOffset() { return new OffsetRec(0x1001A, 16 , 8*6, 6, 8); }
public bool getScreenVertical() { return true; }
public OffsetRec getScreensOffset() { return new OffsetRec(0x1001A, 16 , 8*6, 6, 8); } // screen 8x6 block 6x8
public bool getScreenVertical() { return true; }

public bool isBigBlockEditorEnabled() { return false; }
public bool isBlockEditorEnabled() { return true; }
public bool isEnemyEditorEnabled() { return false; }

public bool isBuildScreenFromSmallBlocks() { return true; }

public OffsetRec getBlocksOffset() { return new OffsetRec(0x1031b, 1 , 0x1000); }
public OffsetRec getBlocksOffset() { return new OffsetRec(0x1031b, 1 , 0x1000); } //TSA

public int getBlocksCount() { return 256; }
public int getBigBlocksCount() { return 256; }

Expand All @@ -33,12 +34,14 @@ public int getVideoAddress(int id)

public byte[] getVideoChunk(int videoPageId)
{
return Utils.readVideoBankFromFile("chr1.bin", 0);
return Utils.readVideoBankFromFile("chr1.bin", 0); //6018

}

public byte[] getPallete(int palId)
{
return Utils.readBinFile("pal1.bin");
return Utils.readBinFile("pal1.bin"); // 1ce3a

}

public static ObjRec[] getBlocks(int blockIndex)
Expand Down Expand Up @@ -78,4 +81,5 @@ public static void writeBlocksLinearTilesPal17(ObjRec[] objects, byte[] romdata,
romdata[palBytesAddr + i] = (byte)palByte;
}
}

}
91 changes: 91 additions & 0 deletions CadEditor/settings_nes/castlevania/Settings_Castlevania-2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using CadEditor;
using System;
using System.Drawing;

public class Data
{

public OffsetRec getScreensOffset() { return new OffsetRec(0x10865, 15 , 8*6, 6, 8); }

public bool getScreenVertical() { return true; }

public bool isBigBlockEditorEnabled() { return false; }
public bool isBlockEditorEnabled() { return true; }
public bool isEnemyEditorEnabled() { return false; }

public bool isBuildScreenFromSmallBlocks() { return true; }


public OffsetRec getBlocksOffset() { return new OffsetRec(0x10b36, 1 , 0x1000); }


public int getBlocksCount() { return 256; }
public int getBigBlocksCount() { return 256; }

public GetVideoPageAddrFunc getVideoPageAddrFunc() { return getVideoAddress; }
public GetVideoChunkFunc getVideoChunkFunc() { return getVideoChunk; }
public SetVideoChunkFunc setVideoChunkFunc() { return null; }

public GetBlocksFunc getBlocksFunc() { return getBlocks;}
public SetBlocksFunc setBlocksFunc() { return setBlocks;}
public GetPalFunc getPalFunc() { return getPallete;}
public SetPalFunc setPalFunc() { return null;}

public int getVideoAddress(int id)
{
return -1;
}

public byte[] getVideoChunk(int videoPageId)
{

return Utils.readVideoBankFromFile("chr2.bin", 0); //8898

}

public byte[] getPallete(int palId)
{

return Utils.readBinFile("pal2.bin"); // 1ce4d

}

public static ObjRec[] getBlocks(int blockIndex)
{
return readBlocksLinearTilesPal17(Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(blockIndex));
}

public static void setBlocks(int blockIndex, ObjRec[] blocksData)
{
writeBlocksLinearTilesPal17(blocksData, Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(blockIndex));
}

public static ObjRec[] readBlocksLinearTilesPal17(byte[] romdata, int addr, int count)
{
int BLOCK_W = 4;
int BLOCK_H = 4;
int BLOCK_S = BLOCK_H * BLOCK_H;
var objects = Utils.readBlocksLinear(romdata, addr, BLOCK_W, BLOCK_H, count, false, false, 1);
for (int i = 0; i < count; i++)
{
int palBytesAddr = addr - 1 + i * 17; //every 17th byte
int palByte = romdata[palBytesAddr];
var palBytes = new int[] { (palByte >> 0) & 3, (palByte >> 2) & 3, (palByte >> 4) & 3, (palByte >> 6) & 3 };
objects[i].palBytes = palBytes;
}
return objects;
}

public static void writeBlocksLinearTilesPal17(ObjRec[] objects, byte[] romdata, int addr, int count)
{
Utils.writeBlocksLinear(objects, romdata, addr, count, false, false, 1);
for (int i = 0; i < count; i++)
{
int palBytesAddr = addr - 1 + i * 17; //every 17th byte
var objPalBytes = objects[i].palBytes;
int palByte = objPalBytes[0] | objPalBytes[1] << 2 | objPalBytes[2] << 4 | objPalBytes[3] << 6;
romdata[palBytesAddr + i] = (byte)palByte;
}
}

}
90 changes: 90 additions & 0 deletions CadEditor/settings_nes/castlevania/Settings_Castlevania-3.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using CadEditor;
using System;
using System.Drawing;

public class Data
{

public OffsetRec getScreensOffset() { return new OffsetRec(0x10dd6, 19 , 8*6, 6, 8); }

public bool getScreenVertical() { return true; }

public bool isBigBlockEditorEnabled() { return false; }
public bool isBlockEditorEnabled() { return true; }
public bool isEnemyEditorEnabled() { return false; }

public bool isBuildScreenFromSmallBlocks() { return true; }

public OffsetRec getBlocksOffset() { return new OffsetRec(0x11167, 1 , 0x1000); }


public int getBlocksCount() { return 256; }
public int getBigBlocksCount() { return 256; }

public GetVideoPageAddrFunc getVideoPageAddrFunc() { return getVideoAddress; }
public GetVideoChunkFunc getVideoChunkFunc() { return getVideoChunk; }
public SetVideoChunkFunc setVideoChunkFunc() { return null; }

public GetBlocksFunc getBlocksFunc() { return getBlocks;}
public SetBlocksFunc setBlocksFunc() { return setBlocks;}
public GetPalFunc getPalFunc() { return getPallete;}
public SetPalFunc setPalFunc() { return null;}

public int getVideoAddress(int id)
{
return -1;
}

public byte[] getVideoChunk(int videoPageId)
{

return Utils.readVideoBankFromFile("chr3.bin", 0); //9a18

}

public byte[] getPallete(int palId)
{

return Utils.readBinFile("pal3.bin"); // 1ce60

}

public static ObjRec[] getBlocks(int blockIndex)
{
return readBlocksLinearTilesPal17(Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(blockIndex));
}

public static void setBlocks(int blockIndex, ObjRec[] blocksData)
{
writeBlocksLinearTilesPal17(blocksData, Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(blockIndex));
}

public static ObjRec[] readBlocksLinearTilesPal17(byte[] romdata, int addr, int count)
{
int BLOCK_W = 4;
int BLOCK_H = 4;
int BLOCK_S = BLOCK_H * BLOCK_H;
var objects = Utils.readBlocksLinear(romdata, addr, BLOCK_W, BLOCK_H, count, false, false, 1);
for (int i = 0; i < count; i++)
{
int palBytesAddr = addr - 1 + i * 17; //every 17th byte
int palByte = romdata[palBytesAddr];
var palBytes = new int[] { (palByte >> 0) & 3, (palByte >> 2) & 3, (palByte >> 4) & 3, (palByte >> 6) & 3 };
objects[i].palBytes = palBytes;
}
return objects;
}

public static void writeBlocksLinearTilesPal17(ObjRec[] objects, byte[] romdata, int addr, int count)
{
Utils.writeBlocksLinear(objects, romdata, addr, count, false, false, 1);
for (int i = 0; i < count; i++)
{
int palBytesAddr = addr - 1 + i * 17; //every 17th byte
var objPalBytes = objects[i].palBytes;
int palByte = objPalBytes[0] | objPalBytes[1] << 2 | objPalBytes[2] << 4 | objPalBytes[3] << 6;
romdata[palBytesAddr + i] = (byte)palByte;
}
}

}
91 changes: 91 additions & 0 deletions CadEditor/settings_nes/castlevania/Settings_Castlevania-4.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using CadEditor;
using System;
using System.Drawing;

public class Data
{

public OffsetRec getScreensOffset() { return new OffsetRec(0x1146b, 16 , 8*6, 6, 8); }

public bool getScreenVertical() { return true; }

public bool isBigBlockEditorEnabled() { return false; }
public bool isBlockEditorEnabled() { return true; }
public bool isEnemyEditorEnabled() { return false; }

public bool isBuildScreenFromSmallBlocks() { return true; }


public OffsetRec getBlocksOffset() { return new OffsetRec(0x1176c, 1 , 0x1000); }


public int getBlocksCount() { return 256; }
public int getBigBlocksCount() { return 256; }

public GetVideoPageAddrFunc getVideoPageAddrFunc() { return getVideoAddress; }
public GetVideoChunkFunc getVideoChunkFunc() { return getVideoChunk; }
public SetVideoChunkFunc setVideoChunkFunc() { return null; }

public GetBlocksFunc getBlocksFunc() { return getBlocks;}
public SetBlocksFunc setBlocksFunc() { return setBlocks;}
public GetPalFunc getPalFunc() { return getPallete;}
public SetPalFunc setPalFunc() { return null;}

public int getVideoAddress(int id)
{
return -1;
}

public byte[] getVideoChunk(int videoPageId)
{

return Utils.readVideoBankFromFile("chr4.bin", 0); //abb8

}

public byte[] getPallete(int palId)
{

return Utils.readBinFile("pal4.bin"); // 1ce73

}

public static ObjRec[] getBlocks(int blockIndex)
{
return readBlocksLinearTilesPal17(Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(blockIndex));
}

public static void setBlocks(int blockIndex, ObjRec[] blocksData)
{
writeBlocksLinearTilesPal17(blocksData, Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(blockIndex));
}

public static ObjRec[] readBlocksLinearTilesPal17(byte[] romdata, int addr, int count)
{
int BLOCK_W = 4;
int BLOCK_H = 4;
int BLOCK_S = BLOCK_H * BLOCK_H;
var objects = Utils.readBlocksLinear(romdata, addr, BLOCK_W, BLOCK_H, count, false, false, 1);
for (int i = 0; i < count; i++)
{
int palBytesAddr = addr - 1 + i * 17; //every 17th byte
int palByte = romdata[palBytesAddr];
var palBytes = new int[] { (palByte >> 0) & 3, (palByte >> 2) & 3, (palByte >> 4) & 3, (palByte >> 6) & 3 };
objects[i].palBytes = palBytes;
}
return objects;
}

public static void writeBlocksLinearTilesPal17(ObjRec[] objects, byte[] romdata, int addr, int count)
{
Utils.writeBlocksLinear(objects, romdata, addr, count, false, false, 1);
for (int i = 0; i < count; i++)
{
int palBytesAddr = addr - 1 + i * 17; //every 17th byte
var objPalBytes = objects[i].palBytes;
int palByte = objPalBytes[0] | objPalBytes[1] << 2 | objPalBytes[2] << 4 | objPalBytes[3] << 6;
romdata[palBytesAddr + i] = (byte)palByte;
}
}

}
Loading