示例#1
0
        /// <summary>
        /// Write the D-Pad configuration structure to ROM.
        /// </summary>
        /// <param name="config">D-Pad config</param>
        public void WriteDPadConfig(DPadConfig config)
        {
            // If there's a DPAD_STATE symbol, use the legacy function instead.
            if (this.Has("DPAD_STATE"))
            {
                WriteDPadConfigLegacy(config);
                return;
            }

            WriteAsmConfig("DPAD_CONFIG", config);
        }
示例#2
0
        /// <summary>
        /// Write a <see cref="DPadConfig"/> to the ROM.
        /// </summary>
        /// <remarks>Assumes <see cref="Patcher"/> file has been inserted.</remarks>
        /// <param name="config">D-Pad config</param>
        void WriteDPadConfigLegacy(DPadConfig config)
        {
            // Write DPad config bytes.
            var addr = this["DPAD_CONFIG"];

            ReadWriteUtils.WriteToROM((int)addr, config.Pad.Bytes);

            // Write DPad state byte.
            addr = this["DPAD_STATE"];
            ReadWriteUtils.WriteToROM((int)addr, (byte)config.State);
        }
示例#3
0
 /// <summary>
 /// Try and write a <see cref="DPadConfig"/> to the ROM.
 /// </summary>
 /// <param name="config">D-Pad config</param>
 /// <returns>True if successful, false if the <see cref="DPadConfig"/> symbol was not found.</returns>
 public bool TryWriteDPadConfig(DPadConfig config)
 {
     try
     {
         WriteDPadConfig(config);
         return(true);
     }
     catch (KeyNotFoundException)
     {
         return(false);
     }
 }