private void DeCompressFireButton_Click(object sender, EventArgs e) { if (DeCompressSRCFilename.Text == "" || DeCompressDESTFilename.Text == "") { return; } uint address = U.toOffset((uint)DeCompressAddress.Value); byte[] data; if (DeCompressSRCFilename.Text == THIS_ROM) { if (Program.ROM.Data.Length < (uint)address) { return; } data = LZ77.decompress(Program.ROM.Data, address); } else { byte[] src = File.ReadAllBytes(DeCompressSRCFilename.Text); if (src.Length < (uint)address) { return; } data = LZ77.decompress(src, address); } U.WriteAllBytes(DeCompressDESTFilename.Text, data); //エクスプローラで選択しよう U.SelectFileByExplorer(DeCompressDESTFilename.Text); }
void LoadBattleScreen() { uint tsapos = Program.ROM.p32(this.TSAPointer); if (this.IsLZ77TSA) { byte[] tsadata = LZ77.decompress(Program.ROM.Data, tsapos); if (tsadata.Length <= 0) {//解凍できない this.Map = new ushort[] {}; return; } if (this.IsHeaderTSA) { this.Map = ImageUtil.ByteToHeaderTSA(tsadata, 0, (int)this.Width8 * 8, (int)this.Height8 * 8); } else { this.Map = ImageUtil.ByteToTSA(tsadata, 0, (int)this.Width8 * 8, (int)this.Height8 * 8); } } else { if (this.IsHeaderTSA) { this.Map = ImageUtil.ByteToHeaderTSA(Program.ROM.Data, (int)tsapos, (int)this.Width8 * 8, (int)this.Height8 * 8); } else { this.Map = ImageUtil.ByteToTSA(Program.ROM.Data, (int)tsapos, (int)this.Width8 * 8, (int)this.Height8 * 8); } } }
bool WriteMapConfig(Undo.UndoData undodata) { if (this.MapStyle.SelectedIndex < 0) { return(false); } uint config_plist = this.MapEditConf[this.MapStyle.SelectedIndex].config_plist; uint chipset_address = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.CONFIG, config_plist); byte[] chipsetConfigZ = LZ77.compress(this.ConfigUZ); uint newaddr = InputFormRef.WriteBinaryData(this, (uint)ChipsetConfigAddress.Value, chipsetConfigZ, InputFormRef.get_data_pos_callback_lz77, undodata); if (newaddr == U.NOT_FOUND) { Program.Undo.Rollback(undodata); return(false); } ChipsetConfigAddress.Value = newaddr; //拡張領域に書き込んでいる可能性もあるので plstを更新する. bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.CONFIG, config_plist, newaddr, undodata); if (!r) { Program.Undo.Rollback(undodata); return(false); } //書き込んだ通知. InputFormRef.ShowWriteNotifyAnimation(this, newaddr); InputFormRef.WriteButtonToYellow(this.Config_WriteButton, false); //マップエディタが開いていれば更新する MapEditorForm.UpdateMapStyleIfOpen(); return(true); }
static public void AddLZ77Address(List <Address> list, uint addr, uint pointer, string info, bool isPointerOnly, DataTypeEnum type) { addr = U.toOffset(addr); if (!U.isSafetyOffset(addr)) { return; } if (pointer != U.NOT_FOUND) { pointer = U.toOffset(pointer); if (!U.isSafetyOffset(pointer)) { return; } } uint length; if (isPointerOnly) { length = 0; } else { length = LZ77.getCompressedSize(Program.ROM.Data, addr); } list.Add(new Address(addr, length, pointer, info, type)); }
//ワールドマップを描画する public static Bitmap DrawWorldMap( uint image , uint palette //通常パレット , uint palettemap //パレットマップ ) { image = U.toOffset(image); palette = U.toOffset(palette); palettemap = U.toOffset(palettemap); if (!U.isSafetyOffset(image)) { return(ImageUtil.BlankDummy()); } if (!U.isSafetyOffset(palette)) { return(ImageUtil.BlankDummy()); } if (!U.isSafetyOffset(palettemap)) { return(ImageUtil.BlankDummy()); } byte[] palettemapUZ = LZ77.decompress(Program.ROM.Data, palettemap); return(ImageUtil.ByteToImage16TilePaletteMap(480, 320 , Program.ROM.Data, (int)image , Program.ROM.Data, (int)palette , palettemapUZ, 0 )); }
//イベント用のワールドマップを描画する public static Bitmap DrawWorldMapEvent( uint image , uint palette //通常パレット , uint tsa //TSA ) { image = U.toOffset(image); palette = U.toOffset(palette); tsa = U.toOffset(tsa); if (!U.isSafetyOffset(image)) { return(ImageUtil.BlankDummy()); } if (!U.isSafetyOffset(palette)) { return(ImageUtil.BlankDummy()); } if (!U.isSafetyOffset(tsa)) { return(ImageUtil.BlankDummy()); } byte[] imageUZ = LZ77.decompress(Program.ROM.Data, image); byte[] tsaUZ = LZ77.decompress(Program.ROM.Data, tsa); return(ImageUtil.ByteToImage16TileHeaderTSA(256, 160 , imageUZ, 0 , Program.ROM.Data, (int)palette , tsaUZ, 0 )); }
//全データの取得 public static void MakeAllDataLength(List <Address> list, bool isPointerOnly) { string name = "OPClassFont"; { InputFormRef InputFormRef = Init(null); FEBuilderGBA.Address.AddAddress(list, InputFormRef, name, new uint[] { 0 }); uint p = InputFormRef.BaseAddress; for (int i = 0; i < InputFormRef.DataCount; i++, p += InputFormRef.BlockSize) { name = "OPClassFont " + U.To0xHexString(i); uint a = Program.ROM.p32(p); if (a <= 0) { continue; } uint length = LZ77.getCompressedSize(Program.ROM.Data, a); FEBuilderGBA.Address.AddLZ77Pointer(list , p , name , isPointerOnly , FEBuilderGBA.Address.DataTypeEnum.LZ77IMG); } } }
void SetupTSAOption() { Size size = new Size(0, 0); if (TSAOption.SelectedIndex == 2) {//圧縮ヘッダ付きTSAを利用する byte[] tsa = LZ77.decompress(Program.ROM.Data, U.toOffset(TSA.Value)); size = ImageUtil.CalcSizeForHeaderTSAData(tsa, 0); } else if (TSAOption.SelectedIndex == 3) { size = ImageUtil.CalcSizeForHeaderTSAData(Program.ROM.Data, (int)U.toOffset(TSA.Value)); } if (size.Width > 0 && size.Height > 0) { //幅高さ自動計算 if (size.Width >= 30) { size.Width = 32; } if (size.Height >= 32) { size.Height = 32; } this.PicWidth.Value = size.Width; this.PicHeight.Value = size.Height; } }
public static void CheckLZ77(uint lz77addr, List <ErrorSt> errors, Type cond, uint addr, uint tag = U.NOT_FOUND) { CheckAlien4(lz77addr, errors, cond, addr, tag); if (!LZ77.iscompress(Program.ROM.Data, lz77addr)) { errors.Add(new FELint.ErrorSt(cond, U.toOffset(addr) , R._("アドレス({0})はlz77で圧縮されていません。\r\nデータが壊れています。", U.To0xHexString(lz77addr)), tag)); } }
public static void DEBUG_LZ77CHECK(byte[] original_data, byte[] lz77data) { byte[] uncomp = LZ77.decompress(lz77data, 0); Debug.Assert(original_data.Length == uncomp.Length); for (int i = 0; i < uncomp.Length; i++) { Debug.Assert(original_data[i] == uncomp[i]); } }
//圧縮されているデータをそのまま取得する public static byte[] GetCompressDataLow(byte[] input, uint offset) { uint image_size = LZ77.getCompressedSize(input, offset); if (image_size <= 0) { return(new byte[0]); } return(U.getBinaryData(input, offset, image_size)); }
static Bitmap GetChipImage(List <int> notUseList, List <int> heightList) { uint[] image_pos = new uint[] { Program.ROM.RomInfo.battle_screen_image1_pointer() , Program.ROM.RomInfo.battle_screen_image2_pointer() , Program.ROM.RomInfo.battle_screen_image3_pointer() , Program.ROM.RomInfo.battle_screen_image4_pointer() , Program.ROM.RomInfo.battle_screen_image5_pointer() }; List <byte[]> unlz77_images = new List <byte[]>(); int total_height = 0; for (int i = 0; i < image_pos.Length; i++) { uint image = Program.ROM.p32(image_pos[i]); byte[] imageUZ = LZ77.decompress(Program.ROM.Data, image); int width = 8; int height = ImageUtil.CalcHeight(width, imageUZ.Length); unlz77_images.Add(imageUZ); total_height += height; heightList.Add(total_height); } uint palette = Program.ROM.p32(Program.ROM.RomInfo.battle_screen_palette_pointer()); Bitmap bitmap = ImageUtil.Blank(8, total_height, Program.ROM.Data, (int)palette); int copy_height = 0; for (int i = 0; i < image_pos.Length; i++) { byte[] imageUZ = unlz77_images[i]; int width = 8; int height = ImageUtil.CalcHeight(width, imageUZ.Length); if (height <= 0) { continue; } Bitmap src = ImageUtil.ByteToImage16Tile(width, height, imageUZ, 0, Program.ROM.Data, (int)palette); ImageUtil.BitBlt(bitmap, 0, copy_height, 8, height, src, 0, 0); copy_height += height; src.Dispose(); if (i >= 1) { notUseList.Add(copy_height - 8 - 8); notUseList.Add(copy_height - 8); } } return(bitmap); }
public static void MakeLZ77DataList(List <Address> list) { string name = R._("圧縮データ"); uint length = (uint)Program.ROM.Data.Length - 4; for (uint addr = 0x100; addr < length; addr += 4) { uint a = (uint)Program.ROM.Data[addr + 3]; if (a != 0x08 && a != 0x09) {//ポインタ以外無視する. continue; } a = Program.ROM.p32(addr); if (!U.isSafetyOffset(a)) {//危険なポインタは無視 continue; } if (a < Program.ROM.RomInfo.compress_image_borderline_address()) { continue; } //ポインタ先は圧縮されているか? uint imageDataSize = LZ77.getUncompressSize(Program.ROM.Data, a); if (IsBadImageSize(imageDataSize)) { continue; } //ポインタは連続してあらわれるのでそのチェックをする. if (!IsContinuousPointer(addr, length)) { continue; } //解凍して中身を見てみる. byte[] image = LZ77.decompress(Program.ROM.Data, a); if (image.Length != imageDataSize) {//解凍したらデータ容量が違う continue; } uint getcompsize = LZ77.getCompressedSize(Program.ROM.Data, a); if (getcompsize == 0) { continue; } //たぶん画像だと判断する. FEBuilderGBA.Address.AddAddress(list, a, getcompsize, addr, name + U.To0xHexString(a), Address.DataTypeEnum.LZ77IMG); if (InputFormRef.DoEvents(null, "MakeLZ77DataList " + U.ToHexString(addr))) { return; } } }
public static Bitmap DrawWorldMapFE6(uint image256Z, uint paletteZ) { byte[] image256UZ = LZ77.decompress(Program.ROM.Data, image256Z); byte[] paletteUZ = LZ77.decompress(Program.ROM.Data, paletteZ); if (image256UZ.Length <= 0 || paletteUZ.Length <= 0) { return(ImageUtil.BlankDummy()); } return(ImageUtil.ByteToImage256Liner(240, 160, image256UZ, 0, paletteUZ, 0)); }
//マップ領域のベース領域の強制割り当て public static uint PreciseMapDataArea(uint mapid) { MapPointerNewPLISTPopupForm f = (MapPointerNewPLISTPopupForm)InputFormRef.JumpFormLow <MapPointerNewPLISTPopupForm>(); f.Init(MapPointerForm.PLIST_TYPE.MAP); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return(0); } uint plist = f.GetSelectPLIST(); Undo.UndoData undodata = Program.Undo.NewUndoData("Precise MapDataArea", mapid.ToString("X")); //マップ領域を新規に割り当てる byte[] data = new byte[2 + (15 * 10)]; data[0] = 15; data[1] = 10; data = LZ77.compress(data); MapSettingForm.PLists plists = MapSettingForm.GetMapPListsWhereMapID(mapid); uint map_addr = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.MAP, plists.mappointer_plist); if (U.isSafetyOffset(map_addr)) {//既存マップがあればコピーする. uint length = LZ77.getCompressedSize(Program.ROM.Data, map_addr); data = Program.ROM.getBinaryData(map_addr, length); } uint write_addr = InputFormRef.AppendBinaryData(data, undodata); if (write_addr == U.NOT_FOUND) { Program.Undo.Rollback(undodata); return(0); } bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.MAP, plist, write_addr, undodata); if (!r) { Program.Undo.Rollback(undodata); return(0); } Program.Undo.Push(undodata); return(plist); }
private void X_N_JumpEditor_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } uint battleanime_baseaddress = InputFormRef.SelectToAddr(N_AddressList); if (battleanime_baseaddress == U.NOT_FOUND) { return; } uint sectionData = (uint)N_P12.Value; uint frameData = (uint)N_P16.Value; uint rightToLeftOAM = (uint)N_P20.Value; uint leftToRightOAM = (uint)N_P24.Value; uint palettes = (uint)N_P28.Value; uint ID = (uint)N_AddressList.SelectedIndex + 1; string filehint = GetBattleAnimeHint(ID); if (filehint == "") {//不明な場合、 FE7にある個別バトルにも問い合わせる filehint = UnitCustomBattleAnimeForm.GetBattleAnimeHint((uint)N_AddressList.SelectedIndex + 1); } filehint = N_AddressList.Text + " " + filehint; int palette_count = ImageUtilOAM.CalcMaxPaletteCount(sectionData, frameData, rightToLeftOAM, palettes); //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) //テンポラリディレクトリを利用する using (U.MakeTempDirectory tempdir = new U.MakeTempDirectory()) { string filename = Path.Combine(tempdir.Dir, "anime.txt"); ImageUtilOAM.ExportBattleAnime("", false, filename , sectionData, frameData, rightToLeftOAM, palettes, palette_count); if (!File.Exists(filename)) { R.ShowStopError("アニメーションエディタを表示するために、アニメーションをエクスポートしようとしましたが、アニメをファイルにエクスポートできませんでした。\r\n\r\nファイル:{0}", filename); return; } byte[] paletteBIN = LZ77.decompress(Program.ROM.Data, U.toOffset(palettes)); ToolAnimationCreatorForm f = (ToolAnimationCreatorForm)InputFormRef.JumpFormLow <ToolAnimationCreatorForm>(); f.Init(ToolAnimationCreatorUserControl.AnimationTypeEnum.BattleAnime , ID, filehint, filename, paletteBIN); f.Show(); f.Focus(); } }
public static Bitmap GetPathImage() { uint palette = Program.ROM.p32(Program.ROM.RomInfo.worldmap_icon_palette_pointer()); uint image = Program.ROM.p32(Program.ROM.RomInfo.worldmap_road_tile_pointer()); byte[] imageUZ = LZ77.decompress(Program.ROM.Data, image); int width = 8; int height = ImageUtil.CalcHeight(width, imageUZ.Length); Bitmap bitmap = ImageUtil.ByteToImage16Tile(width, height, imageUZ, 0, Program.ROM.Data, (int)palette, 1); return(bitmap); }
//OBJECTの割り当て public static uint PreciseObjectArea(uint mapid) { MapPointerNewPLISTPopupForm f = (MapPointerNewPLISTPopupForm)InputFormRef.JumpFormLow <MapPointerNewPLISTPopupForm>(); f.Init(MapPointerForm.PLIST_TYPE.OBJECT); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return(0); } uint plist = f.GetSelectPLIST(); Undo.UndoData undodata = Program.Undo.NewUndoData("Precise ObjectArea", mapid.ToString("X")); //OBJECT領域を新規に割り当てる. MapSettingForm.PLists plists = MapSettingForm.GetMapPListsWhereMapID(mapid); Bitmap bmp; if (plists.obj_plist >= 0x100) {//2つのplistが必要だからコピーできない bmp = ImageUtil.Blank(32 * 8, 32 * 8); } else { bmp = DrawMapChipOnly(plists.obj_plist, plists.palette_plist, null); } byte[] data = ImageUtil.ImageToByte16Tile(bmp, bmp.Width, bmp.Height); data = LZ77.compress(data); uint write_addr = InputFormRef.AppendBinaryData(data, undodata); if (write_addr == U.NOT_FOUND) { Program.Undo.Rollback(undodata); return(0); } bool r = MapPointerForm.Write_Plsit(MapPointerForm.PLIST_TYPE.OBJECT, plist, write_addr, undodata); if (!r) { Program.Undo.Rollback(undodata); return(0); } Program.Undo.Push(undodata); return(plist); }
static uint All_ToolAutoGenLeftToRightAllAnimation(InputFormRef.AutoPleaseWait pleaseWait, Undo.UndoData undodata) { uint totalSize = 0; //テーブル拡張などで同じOAMが複数個所にある場合の対処 Dictionary <uint, uint> convertHistory = new Dictionary <uint, uint>(); InputFormRef N_InputFormRef = N_Init(null); uint addr = N_InputFormRef.BaseAddress; for (uint i = 0; i < N_InputFormRef.DataCount; i++, addr += N_InputFormRef.BlockSize) { uint rightToLeftOAMAddress = Program.ROM.p32(addr + 20); uint leftToRightOAMAddress = Program.ROM.p32(addr + 24); if (rightToLeftOAMAddress == leftToRightOAMAddress) {//処理済み continue; } //実はさっき処理していますか? //D拡張などで同じデータが複数個ある場合への配慮. uint convertAddress; if (convertHistory.TryGetValue(leftToRightOAMAddress, out convertAddress)) { Program.ROM.write_p32(addr + 24, convertAddress, undodata); continue; } byte[] rightToLeftOAMBin = LZ77.decompress(Program.ROM.Data, rightToLeftOAMAddress); byte[] leftToRightOAMBin = LZ77.decompress(Program.ROM.Data, leftToRightOAMAddress); List <byte> rightToLeftOAMArray = new List <byte>(rightToLeftOAMBin); List <byte> leftToRightOAMArray = new List <byte>(leftToRightOAMBin); if (!ImageUtilOAM.IsMatchOAM(rightToLeftOAMArray, leftToRightOAMArray)) {//鏡写しではないので、自動生成できません。 continue; } pleaseWait.DoEvents(R._("{0} 削減サイズ:{1}", U.To0xHexString(i), totalSize)); //データを自動生成できるので、ポインタを共有します Program.ROM.write_p32(addr + 24, rightToLeftOAMAddress, undodata); //不要なデータを消去します uint leftToRightOAMSize = LZ77.getCompressedSize(Program.ROM.Data, leftToRightOAMAddress); Program.ROM.write_fill(leftToRightOAMAddress, leftToRightOAMSize, 0, undodata); convertHistory[leftToRightOAMAddress] = rightToLeftOAMAddress; totalSize += leftToRightOAMSize; } return(totalSize); }
//音楽系の下絵 public static Bitmap BaseMusicImage() { if (SystemMusicCache != null) { return(SystemMusicCache); } uint palette = Program.ROM.p32(Program.ROM.RomInfo.system_music_icon_palette_pointer()); uint image = Program.ROM.p32(Program.ROM.RomInfo.system_music_icon_pointer()); byte[] imageUZ = LZ77.decompress(Program.ROM.Data, image); SystemMusicCache = ImageUtil.ByteToImage16Tile(32 * 8, 4 * 8, imageUZ, 0, Program.ROM.Data, (int)palette); return(SystemMusicCache); }
public static Bitmap LoadMoveUnitIcon(uint pic_address, int palette_type) { uint palette; if (palette_type == 1) {//友軍 palette = Program.ROM.RomInfo.unit_icon_npc_palette_address(); } else if (palette_type == 2) {//敵軍 palette = Program.ROM.RomInfo.unit_icon_enemey_palette_address(); } else if (palette_type == 3) {//グレー palette = Program.ROM.RomInfo.unit_icon_gray_palette_address(); } else if (palette_type == 4) {//4軍 palette = Program.ROM.RomInfo.unit_icon_four_palette_address(); } else {//自軍 palette = Program.ROM.RomInfo.unit_icon_palette_address(); } uint pic_address_offset = U.toOffset(pic_address); if (!U.isSafetyOffset(palette)) { return(ImageUtil.Blank(4 * 8, 4 * 8)); } if (!U.isSafetyOffset(pic_address_offset)) { return(ImageUtil.Blank(4 * 8, 4 * 8)); } byte[] imageUZ = LZ77.decompress(Program.ROM.Data, pic_address_offset); if (imageUZ.Length <= 0) { return(ImageUtil.Blank(4 * 8, 4 * 8)); } int width = 4 * 8; int height = ImageUtil.CalcHeight(width, imageUZ.Length); return(ImageUtil.ByteToImage16Tile(width, height , imageUZ, 0 , Program.ROM.Data, (int)palette , 0 )); }
Bitmap DrawBorderBitmap(uint img) { byte[] bin = LZ77.decompress(Program.ROM.Data, U.toOffset(img)); uint pal = Program.ROM.p32(Program.ROM.RomInfo.worldmap_county_border_palette_pointer()); int height = ImageUtil.CalcHeight(32 * 8, bin.Length); if (height <= 0) { return(ImageUtil.Blank(32 * 8, 4 * 8)); } return(ImageUtil.ByteToImage16Tile(32 * 8, height , bin, 0 , Program.ROM.Data, (int)pal)); }
private void CompressFireButton_Click(object sender, EventArgs e) { if (CompressSRCFilename.Text == "" || CompressDESTFilename.Text == "") { return; } byte[] src = File.ReadAllBytes(CompressSRCFilename.Text); byte[] data = LZ77.compress(src); U.WriteAllBytes(CompressDESTFilename.Text, data); //エクスプローラで選択しよう U.SelectFileByExplorer(CompressDESTFilename.Text); }
int GetThisImageHeight() { uint tsa = (uint)P8.Value; if (!U.isPointer(tsa)) { return(20 * 8); } byte[] tsaUZ = LZ77.decompress(Program.ROM.Data, U.toOffset(tsa)); int height = ImageUtil.CalcHeightbyTSA(32 * 8, tsaUZ.Length); Debug.Assert(height >= 20 * 8); return(height); }
public static Bitmap DrawFont(uint image) { if (!U.isPointer(image)) { return(ImageUtil.BlankDummy(32)); } uint palette = Program.ROM.p32(Program.ROM.RomInfo.op_class_font_palette_pointer()); byte[] imageUZ = LZ77.decompress(Program.ROM.Data, U.toOffset(image)); return(ImageUtil.ByteToImage16Tile(4 * 8, 4 * 8 , imageUZ, 0 , Program.ROM.Data, (int)U.toOffset(palette) )); }
//チップセットの読込(マップチップの画像をどう解釈するか定義するデータ) public static byte[] UnLZ77ChipsetData(uint config_plist) { uint config_offset = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.CONFIG, config_plist); if (!U.isSafetyOffset(config_offset)) { return(null); } byte[] configUZ = LZ77.decompress(Program.ROM.Data, config_offset); if (configUZ.Length <= 0)//TSA { return(null); } return(configUZ); }
static Bitmap DrawTSAAnime2Header(uint image, uint palette) { if (!U.isPointer(image)) { return(ImageUtil.BlankDummy()); } if (!U.isPointer(palette)) { return(ImageUtil.BlankDummy()); } byte[] imageUZ = LZ77.decompress(Program.ROM.Data, U.toOffset(image)); int height = (int)ImageUtil.CalcHeight(30 * 8, imageUZ.Length); return(ImageUtil.ByteToImage16Tile(30 * 8, height, imageUZ, 0, Program.ROM.Data, (int)U.toOffset(palette))); }
//マップの配置データの読込 public static byte[] UnLZ77MapData(uint mappointer_plist) { uint mappointer_offset = MapPointerForm.PlistToOffsetAddr(MapPointerForm.PLIST_TYPE.MAP, mappointer_plist); if (!U.isSafetyOffset(mappointer_offset)) { return(null); } byte[] mappointerUZ = LZ77.decompress(Program.ROM.Data, mappointer_offset); //tsa if (mappointerUZ.Length <= 0) { return(null); } return(mappointerUZ); }
//下絵の取得 public static Bitmap BaseImage() { if (SystemIconCache != null) { return(SystemIconCache); } uint palette = Program.ROM.p32(Program.ROM.RomInfo.system_icon_palette_pointer()); uint image = Program.ROM.p32(Program.ROM.RomInfo.system_icon_pointer()); byte[] imageUZ = LZ77.decompress(Program.ROM.Data, image); Size system_icon_size = GetSystemIconImageSize(); SystemIconCache = ImageUtil.ByteToImage16Tile(system_icon_size.Width, system_icon_size.Height, imageUZ, 0, Program.ROM.Data, (int)palette); return(SystemIconCache); }
public static Bitmap DrawImage(uint image, uint tsa) { if (!U.isPointer(image)) { return(ImageUtil.BlankDummy()); } if (!U.isPointer(tsa)) { return(ImageUtil.BlankDummy()); } uint palette = Program.ROM.p32(Program.ROM.RomInfo.op_prologue_palette_color_pointer); byte[] imageUZ = LZ77.decompress(Program.ROM.Data, U.toOffset(image)); byte[] tsaUZ = LZ77.decompress(Program.ROM.Data, U.toOffset(tsa)); return(ImageUtil.ByteToImage16TileHeaderTSA(32 * 8, 20 * 8, imageUZ, 0, Program.ROM.Data, (int)U.toOffset(palette), tsaUZ, 0)); }