void Initialize() { IronScheme.Compiler.BaseHelper.Initialize(this); //Runtime.Builtins.Exact(1); // something needed for .net core... ??? PAL.Initialize(); Runtime.Builtins.Load("~/ironscheme.boot.dll", false); }
public void FailRemoveMapByIndexWhenFPGIsEmpty() { var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_SPACE)); var fpg = new FPG(pal); Assert.ThrowsException <InvalidOperationException>(() => fpg.Remove(0)); }
public void FailRemoveMapByGraphIdWhenFPGIsEmpty() { const int GRAPH_ID = 333; var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_SPACE)); var fpg = new FPG(pal); Assert.ThrowsException <InvalidOperationException>(() => fpg.Remove(GRAPH_ID)); }
public void CreateDefaultInstance() { var palette = new PAL(); for (int i = 0; i < PAL.LENGTH; i++) { Assert.AreEqual(default(Color), palette[i]); } }
public void FailContainsMap() { var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_DIV)); var map = new MAP(this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_MAP)); var fpg = new FPG(pal); fpg.Add(map); // Force palette conversion. Assert.IsFalse(fpg.Contains(map)); }
public void Dump(string fileName) { PAL.Save(_myAssembly, fileName, _machine); #if PEVERIFY if (VerifyAssemblies) { PeVerifyThis(); } #endif }
public void ContainsMap() { var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_SPACE)); var map = new MAP(this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_MAP)); var fpg = new FPG(pal); fpg.Add(map); Assert.IsTrue(fpg.Contains(map)); }
protected override Slot CreateSlot(SymbolId name, Type type) { LocalBuilder b = _codeGen.DeclareLocal(type); if (_codeGen.EmitDebugInfo) { PAL.SetLocalSymInfo(b, SymbolTable.IdToString(Ast.Variable.UnGenSym(name))); } return(new LocalSlot(b, _codeGen)); }
public void Initialize() { this.InitializeResultFolder(RESULT_FOLDER_NAME); if (_isFirstRun) { this.CleanUp(); _isFirstRun = false; } this._palette = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_DIV)); }
public void FailRemoveMapByInstance() { var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_SPACE)); var fpg = new FPG(pal); var a = new MAP(this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_MAP)); var b = MAP.FromImage(this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_BMP)); fpg.Add(b); Assert.ThrowsException <ArgumentException>(() => fpg.Remove(a)); }
//Update eCoin Palette on window public void updatePalette() { Graphics palette = Graphics.FromImage(eCoinPALI); SolidBrush brush; for (int i = 0; i < 16; i++) { brush = new SolidBrush(eCoinPAL[i]); palette.FillRectangle(brush, (i - (i / 8 * 8)) * 24, (i / 8) * 24, 24, 24); } PAL.Image = eCoinPALI; PAL.Update(); }
/** * Converts image data in the form { name, width, height, pixels, pixel_type } to an image * using a data URL that can be displayed in browsers. * @param {QuakeImageData} image_data The image data to expand. * @param {PAL} palette A 256 color palette (not required if image_data.pixel_type is ImageUtil.PIXELTYPE_RGB). * @param {Number} mip_level A number between 1 and 4 that lets the caller choose which pixel array to use for mip mapped textures. * @param {Boolean} as_uint8_arr If this is set to a value, the return type will be a Uint8Array instead of an Image. * @return {Image} Returns an Image object, unless as_uint8_arr is set * @static */ public static byte[] expandImageData(ImageData image_data, PAL palette) { var pixels = image_data.pixels; var width = image_data.width; var height = image_data.height; var image_size = width * height; var data = new byte[image_size * 4]; // small hack for CONCHARS, which uses the wrong transparency index var trans_index = (image_data.name == "CONCHARS") ? 0 : 255; // mip textures have no transparency trans_index = (image_data.pixels2 != null) ? -1 : trans_index; if (image_data.pixel_type == ImageUtil.PIXELTYPE_PALETISED) { var colors = palette.colors; for (var i = 0; i < image_size; ++i) { var p = 4 * i; if (pixels[i] == trans_index) { data[p + 3] = 0; } else { var c = 3 * pixels[i]; data[p] = colors[c]; data[p + 1] = colors[c + 1]; data[p + 2] = colors[c + 2]; data[p + 3] = 255; } } } else { for (var i = 0; i < image_size; ++i) { var c = 3 * i; var p = 4 * i; data[p] = pixels[c]; data[p + 1] = pixels[c + 1]; data[p + 2] = pixels[c + 2]; data[p + 3] = 255; } } return(data); }
internal static bool IsTransient(Module m) { var mb = m as ModuleBuilder; if (mb == null) { if (m.GetType().Name == "InternalModuleBuilder") // nice one .NET 4... { return(true); } return(false); } return(PAL.IsTransient(mb)); }
public void AddMapWithTheSamePalette() { const string PLAYER_MAP_FILENAME_FIELD = "PLAYER.MAP"; var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_SPACE)); var map = new MAP(this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_MAP)); var fpg = new FPG(pal); fpg.Add(map, PLAYER_MAP_FILENAME_FIELD); Assert.AreEqual(pal, fpg.Palette); Assert.AreEqual(1, fpg.Count); Assert.AreEqual(map, fpg[0]); Assert.AreEqual(PLAYER_MAP_FILENAME_FIELD, fpg.GetFilename(0)); }
public static Paleta operator +(Paleta PAL, Tempera TEMP) { int indice = PAL.ObtenerIndice(TEMP); if (indice > -1) { PAL._colores[indice] += TEMP; } else { indice = PAL.ObtenerIndice(); if (indice > -1) { PAL._colores[indice] = TEMP; } } return(PAL); }
public void AddMapWithDifferentPalette() { const string PLAYER_MAP_FILENAME_FIELD = "PLAYER.MAP"; string playerMapPath = this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_MAP); var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_DIV)); var map = new MAP(playerMapPath); var fpg = new FPG(pal); fpg.Add(map, PLAYER_MAP_FILENAME_FIELD); Assert.AreEqual(pal, fpg.Palette); Assert.AreEqual(1, fpg.Count); Assert.AreEqual(PLAYER_MAP_FILENAME_FIELD, fpg.GetFilename(0)); map = MAP.FromImage(playerMapPath, pal); Assert.AreEqual(map, fpg[0]); }
public static Paleta operator -(Paleta PAL, Tempera TEMP) { int indice = PAL.ObtenerIndice(TEMP); if (indice > -1) { //sbyte aux = (sbyte)TEMP; //sbyte aux2 = (sbyte)PAL._colores[indice]; //if (aux2 - aux < 1) if ((sbyte)PAL._colores[indice] - (sbyte)TEMP < 1) { PAL._colores[indice] = null; } else { PAL._colores[indice] += (sbyte)((sbyte)TEMP * -1); } //PAL._colores[indice] += ((sbyte) (aux * -1)); } return(PAL); }
public void TestConstructors() { PAL palette = null; for (int i = 0; i < 3; i++) { switch (i) { case 0: palette = new PAL(this._colors.ToDAC()); break; case 1: palette = new PAL(new ColorPalette(this._colors.ToDAC())); break; case 2: palette = new PAL(new ColorPalette(this._colors.ToDAC()), new ColorRangeTable()); break; } for (int j = 0; j < PAL.LENGTH; j++) { Assert.AreEqual(this._colors[j].ToDAC(), palette[j]); } } }
public void Load(string LEVname) { _lev = Asset.LoadCached<LEV>(LEVname + ".LEV"); _pal = Asset.LoadCached<PAL>(_lev.Palette.ToUpper()); _cmp = Asset.LoadCached<CMP>(LEVname + ".CMP"); _game.SolidCMP.SetTexture("_PAL", _pal.Texture); _game.SolidCMP.SetTexture("_CMP", _cmp.Texture); BM.CreateArgs bmCreateArgs = new BM.CreateArgs(); bmCreateArgs.Pal = _pal; if (_game.EmulateCMPShading) { bmCreateArgs.TextureFormat = TextureFormat.Alpha8; bmCreateArgs.AnisoLevel = 0; bmCreateArgs.FilterMode = FilterMode.Point; bmCreateArgs.bMipmap = false; } else { bmCreateArgs.TextureFormat = TextureFormat.RGBA32; bmCreateArgs.AnisoLevel = 9; bmCreateArgs.FilterMode = FilterMode.Trilinear; bmCreateArgs.bMipmap = true; } foreach (var texName in _lev.Textures) { try { BM bm = Asset.LoadCached<BM>(texName.ToUpper(), bmCreateArgs); _textures.Add(bm); if (_defaultTexture == null) { _defaultTexture = bm; } } catch (System.IO.FileNotFoundException) { _textures.Add(null); } } GenerateSectors(); }
//=== the compiler entry point. public static void Main(String[] args) { if (args.Length != 1) { Console.WriteLine("Invalid usage: PAL <filename>"); return; } //--- Open the input source file. StreamReader infile = null; try { infile = new StreamReader(args[0]); } catch (IOException e) { ioError("opening", args[0], e); return; } //--- Do what you gotta do! PAL program = new PAL(infile); program.start(); try { infile.Close(); } catch (IOException e) { ioError("closing", args[0], e); return; } } // end Main method.
public override void EmitCreation(CodeGen cg) { if (cg.IsDynamicMethod) { throw new NotSupportedException("no can do"); } else { var tg = cg.TypeGen; var ag = tg.AssemblyGen; index = tg.ConstantCounter; var snippets = ScriptDomainManager.CurrentManager.Snippets; if (snippets.Assembly == ag || snippets.DebugAssembly == ag) { var sym = Runtime.Builtins.GenSym("$z$" + index); Runtime.Builtins.SetSymbolValueFast(sym, value); cg.EmitSymbolId((SymbolId)sym); cg.EmitCall(typeof(Runtime.Builtins), "SymbolValue"); } else { fs = tg.AddStaticField(typeof(object), FieldAttributes.Private, "$z$" + index) as StaticFieldSlot; tg.SerializedConstants.Add(this); var tcg = tg.TypeInitializer; if (index == 0) { arrloc = tcg.DeclareLocal(typeof(object[])); // first // setup deserializtion to array, then assign to fields tcg.EmitType(tg.TypeBuilder); tcg.EmitCall(typeof(Runtime.Helpers), "DeserializeAssemblyConstants"); tcg.Emit(OpCodes.Stloc, arrloc); tg.CreatingType += (sender, ea) => { var constants = new List <object>(); foreach (SerializedConstant sc in tg.SerializedConstants) { constants.Add(sc.value); } var constantsarray = constants.ToArray(); MemoryStream s = new MemoryStream(); bf.Serialize(s, constantsarray); s.Position = 0; var mb = tg.TypeBuilder.Module as ModuleBuilder; PAL.SerializeConstants(s, mb, compress); }; } tcg.Emit(OpCodes.Ldloc, ((SerializedConstant)tg.SerializedConstants[0]).arrloc); tcg.EmitInt(index); tcg.Emit(OpCodes.Ldelem_Ref); fs.EmitSet(tcg); fs.EmitGet(cg); } tg.ConstantCounter++; } }
public void Initialize() { this.InitializeResultFolder(RESULT_FOLDER_NAME); if (_isFirstRun) { this.CleanUp(); _isFirstRun = false; } this._palette = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_DIV)); this._testFPGRegisters = new List <Register>() // This is the content of the TEST.FPG asset. { new Register() { graphId = 24, width = 128, height = 128, description = "Asteroid #24", filename = "ASTER24.BMP", controlPoints = new ControlPoint[0] }, new Register() { graphId = 100, width = 256, height = 256, description = "TEST PLAYER", filename = "PLAYER.BMP", controlPoints = new ControlPoint[7] { new ControlPoint(128, 128), // Undefined control point (x:-1, y:-1). Must be received a default control point values (MAP center). new ControlPoint(127, 159), new ControlPoint(169, 164), new ControlPoint(19, 154), new ControlPoint(234, 154), new ControlPoint(96, 103), new ControlPoint(157, 103), } }, new Register() { graphId = 320, width = 256, height = 256, description = "Enemy sprite 13", filename = "Enemy.bmp", controlPoints = new ControlPoint[4] { new ControlPoint(157, 138), new ControlPoint(94, 116), new ControlPoint(64, 64), new ControlPoint(138, 57), } }, new Register() { graphId = 600, width = 800, height = 480, description = "ASTEROID FIELD", filename = "ASTEROID.PCX", controlPoints = new ControlPoint[0] }, new Register() { graphId = 601, width = 800, height = 480, description = "SPACE BACKGROUND", filename = "SPACE.PCX", controlPoints = new ControlPoint[0] } }; }
private void message(PAL index) { switch (index) { case PAL.exp: MessageBox.Show("经验值的有效范围为0-32000\n请输入正确的值!", "提示"); break; case PAL.rank: MessageBox.Show("修行的有效值范围为0-99\n请输入正确的值!", "提示"); break; case PAL.hp: MessageBox.Show("体力的有效值范围为0-999\n请输入正确的值!", "提示"); break; case PAL.maxHp: MessageBox.Show("体力上限的有效值范围为0-999\n请输入正确的值!", "提示"); break; case PAL.mp: MessageBox.Show("真气的有效值范围为0-999\n请输入正确的值!", "提示"); break; case PAL.maxMp: MessageBox.Show("真气上限的有效值范围为0-999\n请输入正确的值!", "提示"); break; case PAL.power: MessageBox.Show("武力的有效值范围为1-5000\n请输入正确的值!", "提示"); break; case PAL.wakan: MessageBox.Show("灵力的有效值范围为1-5000\n请输入正确的值!", "提示"); break; case PAL.defence: MessageBox.Show("防御的有效值范围为1-5000\n请输入正确的值!", "提示"); break; case PAL.speed: MessageBox.Show("身法的有效值范围为1-5000\n请输入正确的值!", "提示"); break; case PAL.luck: MessageBox.Show("吉运的有效值范围为1-5000\n请输入正确的值!", "提示"); break; case PAL.money: MessageBox.Show("金钱的有效值范围为0-9999999", "提示"); break; case PAL.saveTime: MessageBox.Show("存盘次数的有效值范围为0-9999", "提示"); break; case PAL.calabash: MessageBox.Show("灵葫值的有效值范围为0-99", "提示"); break; } }
internal static SixLabors.ImageSharp.Color[] ToImageSharpColors(this PAL instance) { return(ToImageSharpColors(instance.ToRGB())); }
internal void CreateSymWriter() { _symbolWriter = PAL.GetSymbolWriter(_myModule); }
void Initialize() { IronScheme.Compiler.BaseHelper.Initialize(this); PAL.Initialize(); Runtime.Builtins.Load("~/ironscheme.boot.dll", false); }
public void CreateFromImage(string file) { PAL palette = PAL.FromImage(this.GetAssetPath(file)); string saveFilename = $"{Path.GetExtension(file)[1..4]}.PAL";
// (clr-call type member obj arg1 ... ) public override Expression Generate(object args, CodeBlock cb) { Type t = null; string type = null; bool inferred = false; object rtype = Builtins.First(args); ExtractTypeInfo(rtype, out t, out type, out inferred); string member = null; var marg = Builtins.Second(args); object memobj = null; Type[] argtypes = null; Type[] gentypes = null; if (marg is SymbolId) { var mem = Builtins.SymbolValue(marg); if (mem is Cons) { ExtractMethodInfo(mem as Cons, out member, ref argtypes, ref gentypes); } else { ClrSyntaxError("clr-call", "type member not supported", mem); } } else { memobj = Builtins.Second(marg); member = memobj is SymbolId?SymbolTable.IdToString((SymbolId)memobj) : ""; if (memobj is string) { string mems = memobj as string; int bi = mems.IndexOf('('); if (bi < 0) { member = mems; } else { member = mems.Substring(0, bi); } } else if (memobj is Cons) { ExtractMethodInfo(memobj as Cons, out member, ref argtypes, ref gentypes); } } Expression instance = GetAst(Builtins.Third(args), cb); CallType ct = CallType.ImplicitInstance; if (instance is ConstantExpression && ((ConstantExpression)instance).Value == null) { ct = CallType.None; if (inferred) { ClrSyntaxError("clr-call", "type inference not possible on static member", member); } } else if (inferred) { if (instance is UnaryExpression && instance.Type == typeof(object)) { var ue = (UnaryExpression)instance; instance = ue.Operand; } t = instance.Type; } else { instance = ConvertToHelper(t, instance); } type = t.Name; Expression[] arguments = GetAstListNoCast(Cdddr(args) as Cons, cb); if (member == "get_Item") { if (Attribute.IsDefined(t, typeof(DefaultMemberAttribute))) { var dma = Attribute.GetCustomAttribute(t, typeof(DefaultMemberAttribute)) as DefaultMemberAttribute; member = "get_" + dma.MemberName; } else if (t.IsArray) { var index = arguments[0]; return(Ast.ArrayIndex(instance, Ast.ConvertHelper(index, typeof(int)))); } } else if (member == "set_Item") { if (Attribute.IsDefined(t, typeof(DefaultMemberAttribute))) { var dma = Attribute.GetCustomAttribute(t, typeof(DefaultMemberAttribute)) as DefaultMemberAttribute; member = "set_" + dma.MemberName; } else if (t.IsArray) { var index = arguments[0]; var v = arguments[1]; return(Ast.Comma(Ast.AssignArrayIndex(instance, Ast.ConvertHelper(index, typeof(int)), v), Ast.ReadField(null, Unspecified))); } } List <MethodBase> candidates = new List <MethodBase>(); BindingFlags bf = BindingFlags.Public | (ct == CallType.None ? BindingFlags.Static : BindingFlags.Instance) | BindingFlags.FlattenHierarchy; foreach (MethodInfo mi in t.GetMember(member, MemberTypes.Method, bf)) { if (PAL.ExcludeParamtypes(mi)) { continue; } if (mi.ContainsGenericParameters) { if (gentypes != null && mi.GetGenericArguments().Length == gentypes.Length) { candidates.Add(mi.MakeGenericMethod(gentypes)); continue; } } candidates.Add(mi); } Type[] types = new Type[arguments.Length]; for (int i = 0; i < types.Length; i++) { types[i] = arguments[i].Type; } if (memobj is string) { string mems = memobj as string; int bi = mems.IndexOf('('); if (bi < 0) { // do notthig } else { string[] typeargs = mems.Substring(bi + 1).TrimEnd(')').Split(','); for (int i = 0; i < types.Length; i++) { if (typeargs[i].Length > 0) { types[i] = ScanForType(typeargs[i]); } } } } else if (argtypes != null) { for (int i = 0; i < types.Length; i++) { types[i] = argtypes[i]; } } if (ct == CallType.ImplicitInstance) { types = ArrayUtils.Insert(t, types); } MethodBinder mb = MethodBinder.MakeBinder(Binder, member, candidates, BinderType.Normal); MethodCandidate mc = mb.MakeBindingTarget(ct, types); if (mc == null) { types = new Type[arguments.Length]; for (int i = 0; i < types.Length; i++) { types[i] = typeof(object); } if (ct == CallType.ImplicitInstance) { types = ArrayUtils.Insert(t, types); } mc = mb.MakeBindingTarget(ct, types); } if (mc != null) { MethodInfo meth = (MethodInfo)mc.Target.Method; // do implicit cast ParameterInfo[] pars = meth.GetParameters(); for (int i = 0; i < arguments.Length; i++) { Type tt = pars[i].ParameterType; arguments[i] = ConvertToHelper(tt, arguments[i]); } Expression r = null; // o god... if (ct == CallType.ImplicitInstance) { r = Ast.ComplexCallHelper(instance, (MethodInfo)mc.Target.Method, arguments); } else { r = Ast.ComplexCallHelper((MethodInfo)mc.Target.Method, arguments); } return(ConvertFromHelper(meth.ReturnType, r)); } ClrSyntaxError("clr-call", "member could not be resolved on type: " + type, args, member); return(null); }
public AssemblyGen(string moduleName, string outDir, string outFile, AssemblyGenAttributes generationAttributes, PortableExecutableKinds peKind, ImageFileMachine machine) { Contract.Requires(!String.IsNullOrEmpty(moduleName), "moduleName", "Module name cannot be a null reference or an empty string."); Contract.Requires(outFile != null || !SaveAndReloadAssemblies, "outFile", "SaveAssemblies mode requires non-null output file name."); _genAttrs = generationAttributes; AssemblyName asmname = new AssemblyName(); AppDomain domain = AppDomain.CurrentDomain; //System.Threading.Thread.GetDomain(); _machine = machine; _peKind = peKind; _outFileName = outFile; #if SILVERLIGHT // AssemblyBuilderAccess.RunAndSave, Environment.CurrentDirectory asmname.Name = moduleName; _myAssembly = domain.DefineDynamicAssembly(asmname, AssemblyBuilderAccess.Run); _myModule = _myAssembly.DefineDynamicModule(moduleName, EmitDebugInfo); #else try { outDir = Path.GetFullPath(String.IsNullOrEmpty(outDir) ? Environment.CurrentDirectory : outDir); } catch (Exception e) { throw new ArgumentException("Invalid output directory", e); } if (SaveAndReloadAssemblies #if PEVERIFY || VerifyAssemblies #endif ) { _outDir = outDir; } if (moduleName == "ironscheme.boot.new") { _outDir = outDir = Path.Combine(outDir, "build"); _outFileName = "ironscheme.boot.dll"; } // SymbolWriter fails on Mono for some reason if (SaveAndReloadAssemblies) { asmname.Name = moduleName == "ironscheme.boot.new" ? "ironscheme.boot" : moduleName; if (File.Exists("DEVELOPMENT.snk")) { asmname.KeyPair = new StrongNameKeyPair(File.ReadAllBytes("DEVELOPMENT.snk")); } asmname.Version = new Version("1.0.0.0"); var actualModuleName = moduleName == "ironscheme.boot.new" ? "ironscheme.boot.dll" : _outFileName; PAL.DefineAssembly(false, outDir, asmname, actualModuleName, _outFileName, EmitDebugInfo, ref _myAssembly, ref _myModule); } else { asmname.Name = moduleName; PAL.DefineAssembly(true, null, asmname, moduleName, null, EmitDebugInfo, ref _myAssembly, ref _myModule); } #endif if (EmitDebugInfo) { SetDebuggableAttributes(); } }
public static void Init(MapTheater tData) { var mixFiles = new List <String>() { String.Format("{0:s}.MIX", tData.mixName), String.Format("{0:s}MD.MIX", tData.mixName), String.Format("{0:s}.MIX", tData.isoName1), String.Format("{0:s}MD.MIX", tData.isoName2), String.Format("{0:s}.MIX", tData.Extension), }; if (CurrentTheater != tData) { if (CurrentTheater != null) { CurrentTheater.Mixes.ForEach(M => FileSystem.UnloadMIX(M)); CurrentTheater.Mixes.Clear(); } CurrentTheater = tData; IsoTileTypeClass.TheaterChanged(); foreach (var mixName in mixFiles) { var M = FileSystem.LoadMIX(mixName); if (M != null) { CurrentTheater.Mixes.Add(M); } } String PalName = String.Format("ISO{0}.PAL", CurrentTheater.Extension); var PalStream = FileSystem.LoadFile(PalName); if (PalStream != null) { isoPAL = new PAL(PalStream); } else { isoPAL = null; } PalName = String.Format("UNIT{0}.PAL", CurrentTheater.Extension); PalStream = FileSystem.LoadFile(PalName); if (PalStream != null) { unitPAL = new PAL(PalStream); } else { unitPAL = null; } PalName = "TEMPERAT.PAL"; PalStream = FileSystem.LoadFile(PalName); if (PalStream != null) { TemperatePAL = new PAL(PalStream); } else { TemperatePAL = null; } } }
private void LoadGameFiles() { FileSystem.LoadMIX("LANGMD.MIX"); FileSystem.LoadMIX("LANGUAGE.MIX"); for (var ix = 99; ix > 0; --ix) { var pattern = String.Format("EXPANDMD{0:d2}.MIX", ix); FileSystem.LoadMIX(pattern); } FileSystem.LoadMIX("RA2MD.MIX"); FileSystem.LoadMIX("RA2.MIX"); FileSystem.LoadMIX("CACHEMD.MIX"); FileSystem.LoadMIX("CACHE.MIX"); FileSystem.LoadMIX("LOCALMD.MIX"); FileSystem.LoadMIX("LOCAL.MIX"); FileSystem.LoadMIX("AUDIOMD.MIX"); foreach (var ecache in Directory.GetFiles(GameDir, "ECACHE*.MIX", SearchOption.TopDirectoryOnly)) { FileSystem.LoadMIX(ecache); } foreach (var elocal in Directory.GetFiles(GameDir, "ELOCAL*.MIX", SearchOption.TopDirectoryOnly)) { FileSystem.LoadMIX(elocal); } FileSystem.LoadMIX("CONQMD.MIX"); FileSystem.LoadMIX("GENERMD.MIX"); FileSystem.LoadMIX("GENERIC.MIX"); FileSystem.LoadMIX("ISOGENMD.MIX"); FileSystem.LoadMIX("ISOGEN.MIX"); FileSystem.LoadMIX("CONQUER.MIX"); FileSystem.LoadMIX("CAMEOMD.MIX"); FileSystem.LoadMIX("CAMEO.MIX"); FileSystem.LoadMIX("MAPSMD03.MIX"); FileSystem.LoadMIX("MULTIMD.MIX"); FileSystem.LoadMIX("THEMEMD.MIX"); FileSystem.LoadMIX("MOVMD03.MIX"); var str = FileSystem.LoadFile("RA2MD.CSF"); if (str != null) { new CSF(str); } var m = FileSystem.LoadFile("MOUSE.SHA"); if (m != null) { MouseTextures = new SHP(m); MouseFrame = 0; MouseFrameChanged = true; } else { throw new InvalidDataException(); } var mp = FileSystem.LoadFile("MOUSEPAL.PAL"); if (mp != null) { MousePalette = new PAL(mp); MouseTextures.Palette = MousePalette; } else { throw new InvalidDataException(); } var p = FileSystem.LoadFile("ANIM.PAL"); if (p != null) { AnimPalette = new PAL(p); } else { throw new InvalidDataException(); } var rules = FileSystem.LoadFile("RULESMD.INI"); if (rules != null) { INI.Rules_INI = new INI(rules); } else { throw new InvalidDataException(); } var art = FileSystem.LoadFile("ARTMD.INI"); if (art != null) { INI.Art_INI = new INI(art); } else { throw new InvalidDataException(); } }