private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (Code.adps.Count > 0) { adpFunc curADP = Code.adps[listBox1.SelectedIndex]; if (curADP.ADPfuncName != "Unknown Function" && curADP.ADPfuncName != comboBox2.Text) { try { bool chek = false; if (comboBox2.Text == "Handheld 30FPS Limit" || comboBox2.Text == "Docked 30FPS Limit") { chek = checkBox1.Checked; } Code.funcDetectNoList(curADP, comboBox2.Text, chek); curADP.ADPfuncName = comboBox2.Text; int selIndex = listBox1.SelectedIndex; refreshList(); listBox1.SelectedIndex = selIndex; } catch (Exception) { } } } }
// These do a lot of code but they affect Form elements private void listBox1_SelectedIndexChanged(object sender, EventArgs e) //get the values from the selected function in the listbox and change the labels to match { if (Code.adps.Count > 0) { adpFunc curADP = Code.adps[listBox1.SelectedIndex]; try { string adptime = curADP.frameTime.ToString(); TimeValue.Text = adptime; float calcTime = float.Parse(TimeValue.Text) / 60; Realtime1.Text = calcTime.ToString("0.00"); string adpval = curADP.ADPfuncVal.ToString(); AdpValue.Text = adpval; AdpValue.Enabled = true; if (curADP.ADPfuncName != "Unknown Function") { comboBox2.Enabled = true; checkBox1.Enabled = false; comboBox2.SelectedItem = curADP.ADPfuncName; if (curADP.ADPfuncName == "Handheld 30FPS Limit" || curADP.ADPfuncName == "Docked 30FPS Limit") { checkBox1.Enabled = true; AdpValue.Enabled = false; if (curADP.ADPfuncVal == 0.8750001f || curADP.ADPfuncVal == 0.6750001f) { checkBox1.Checked = true; curADP.is30fps = true; } else { checkBox1.Checked = false; curADP.is30fps = false; } } else { checkBox1.Enabled = false; } } else { checkBox1.Enabled = false; comboBox2.Enabled = false; } } catch (Exception) { } } }
private void AdpValue_TextChanged(object sender, EventArgs e) { if (Code.adps.Count > 0) { adpFunc curADP = Code.adps[listBox1.SelectedIndex]; string adpval = AdpValue.Text; try { curADP.ADPfuncVal = float.Parse(adpval, CultureInfo.InvariantCulture.NumberFormat); } catch (Exception) { adpval = "0"; } } }
public static void readADP(string x) { adps.Clear(); //clear list of adp functions when opening a new file headerlist.Clear(); //dipshit forgot to also clear header list too filePathString = x; BinaryReader br = new BinaryReader(File.OpenRead(x)); try { using (br) //read for a var with the adpfunc values to use for funcDetect { { var headerStorage = new adpHeader() { count = br.ReadInt32(), unk0 = br.ReadInt32(), dataLength = br.ReadInt32(), unk1 = br.ReadInt32(), offset = br.ReadInt32(), }; headerlist.Add(headerStorage); } br.BaseStream.Position = 0x34; //skip past the adp header var count = br.BaseStream.Length / sizeof(int); for (var i = 0; i < count; i++) { var FinalFunc = new adpFunc() //make a new adp function and store it in the FinalFunc var so it can be used in funcDetect { TimeID = br.ReadUInt32(), timeSecondsMarker = br.ReadSingle(), unk = br.ReadInt32(), frameTime = br.ReadInt32(), padding = br.ReadDouble(), ADPfuncID = br.ReadUInt32(), ADPfuncVal = br.ReadSingle(), ADPfuncName = null, }; FuncDetect(FinalFunc); //push FinalFunc into funcDetect } } br.Close(); //close the binary reader to avoid dumbshit } catch (Exception) //catch errors and change the little notice box :) { } }
private void simpleResolutionToolStripMenuItem_Click(object sender, EventArgs e) { bool foundH = false; bool foundD = false; foreach (adpFunc x in Code.adps) { if (x.frameTime == int.Parse(frameToolStripMenuItem.Text)) { if (x.ADPfuncID == 77) { x.ADPfuncVal = 0.75f; foundH = true; } if (x.ADPfuncID == 78) { x.ADPfuncVal = 0.875f; foundD = true; } } } if (!foundH) { adpFunc x = new adpFunc(); x.ADPfuncID = 77; x.ADPfuncName = "Handheld Resolution"; x.ADPfuncVal = 0.75f; x.frameTime = int.Parse(frameToolStripMenuItem.Text); Code.adps.Insert(Code.adps.Count, x); } if (!foundD) { adpFunc x = new adpFunc(); x.ADPfuncID = 78; x.ADPfuncName = "Docked Resolution"; x.ADPfuncVal = 0.875f; x.frameTime = int.Parse(frameToolStripMenuItem.Text); Code.adps.Insert(Code.adps.Count, x); } refreshList(); }
private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (Code.adps.Count > 0) { adpFunc curADP = Code.adps[listBox1.SelectedIndex]; try { if (checkBox1.Checked) { curADP.is30fps = true; curADP.ADPfuncVal = 0.8750001f; } else { curADP.ADPfuncVal = 0.875f; curADP.is30fps = false; } } catch (Exception) { } } }
private void TimeValue_TextChanged(object sender, EventArgs e) { if (Code.adps.Count > 0) { adpFunc curADP = Code.adps[listBox1.SelectedIndex]; try { string adptime = TimeValue.Text; curADP.frameTime = int.Parse(adptime, CultureInfo.InvariantCulture.NumberFormat); } catch (Exception) { } } try { float calcTime = float.Parse(TimeValue.Text) / 60; Realtime1.Text = calcTime.ToString("0.00"); } catch (Exception) { Realtime1.Text = "0.00"; } }
private adpFunc createFunc() { float funcValRead; int frameTimeRead; try { if (textBox1.Text != null && textBox2.Text != null) { frameTimeRead = int.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat); funcValRead = float.Parse(textBox2.Text, CultureInfo.InvariantCulture.NumberFormat); } else { frameTimeRead = 0; funcValRead = 0f; } var newFunc = new adpFunc() //make a new adp function and store it in the FinalFunc var so it can be used in funcDetect { TimeID = 0, unk = 0, frameTime = frameTimeRead, timeSecondsMarker = 0, padding = 0, ADPfuncID = 0, ADPfuncVal = funcValRead, ADPfuncName = null, }; newFunc = Code.funcDetectNoList(newFunc, comboBox1.Text, checkBox2.Checked); Console.WriteLine(newFunc.ADPfuncName); return(newFunc); } catch (Exception) { return(null); } }
public static adpFunc funcDetectNoList(adpFunc newadp, string curText, bool enable) { //Give the newadp variable ADPfuncName and ADPfuncID based on what the current selection is in either comboBox switch (curText) { case "Brightness": newadp.ADPfuncName = "Brightness"; newadp.ADPfuncID = 1; break; case "Character Light (RED)": newadp.ADPfuncName = "Character Light (RED)"; newadp.ADPfuncID = 2; break; case "Character Light (GREEN)": newadp.ADPfuncName = "Character Light (GREEN)"; newadp.ADPfuncID = 3; break; case "Character Light (BLUE)": newadp.ADPfuncName = "Character Light (BLUE)"; newadp.ADPfuncID = 4; break; case "Red Light": newadp.ADPfuncName = "Red Light"; newadp.ADPfuncID = 6; break; case "Green Light": newadp.ADPfuncName = "Green Light"; newadp.ADPfuncID = 7; break; case "Blue Light": newadp.ADPfuncName = "Blue Light"; newadp.ADPfuncID = 8; break; case "Spec. Map Transparency": newadp.ADPfuncName = "Spec. Map Transparency"; newadp.ADPfuncID = 14; break; case "Character Lighting": newadp.ADPfuncName = "Character Lighting"; newadp.ADPfuncID = 15; break; case "Generic Lighting": newadp.ADPfuncName = "Generic Lighting"; newadp.ADPfuncID = 17; break; case "Outline Transparency": newadp.ADPfuncName = "Outline Transparency"; newadp.ADPfuncID = 21; break; case "Skin Shine": newadp.ADPfuncName = "Skin Shine"; newadp.ADPfuncID = 18; break; case "Eye Lighting": newadp.ADPfuncName = "Eye Lighting"; newadp.ADPfuncID = 39; break; case "Skin Lighting": newadp.ADPfuncName = "Skin Toon Intensity"; newadp.ADPfuncID = 40; break; case "BLINN Lighting": newadp.ADPfuncName = "BLINN Lighting"; newadp.ADPfuncID = 41; break; case "Cloth Lighting": newadp.ADPfuncName = "Cloth Lighting"; newadp.ADPfuncID = 42; break; case "Item Lighting": newadp.ADPfuncName = "Item Lighting"; newadp.ADPfuncID = 43; break; case "Hair Lighting": newadp.ADPfuncName = "Hair Lighting"; newadp.ADPfuncID = 44; break; case "Stage Lighting": newadp.ADPfuncName = "Stage Lighting"; newadp.ADPfuncID = 46; break; case "Hair Shine": newadp.ADPfuncName = "Hair Shine"; newadp.ADPfuncID = 57; break; case "Dimness": newadp.ADPfuncName = "Dimness"; newadp.ADPfuncID = 59; break; case "Character Lightness": newadp.ADPfuncName = "Character Lightness"; newadp.ADPfuncID = 60; break; case "Eye Colour Saturation": newadp.ADPfuncName = "Eye Colour Saturation"; newadp.ADPfuncID = 72; break; case "Handheld 30FPS Limit": newadp.ADPfuncName = "Handheld 30FPS Limit"; newadp.ADPfuncID = 75; if (enable) { newadp.ADPfuncVal = 0.8750001f; } break; case "Docked 30FPS Limit": newadp.ADPfuncName = "Docked 30FPS Limit"; newadp.ADPfuncID = 76; if (enable) { newadp.ADPfuncVal = 0.8750001f; } break; case "Handheld Resolution": newadp.ADPfuncName = "Handheld Resolution"; newadp.ADPfuncID = 77; break; case "Docked Resolution": newadp.ADPfuncName = "Docked Resolution"; newadp.ADPfuncID = 78; break; default: newadp.ADPfuncName = "Unknown Function"; newadp.ADPfuncID = 49; break; } return(newadp); }
public static void FuncDetect(adpFunc x) { var adp = x; //Detect ADP Function using the ID it gives us switch (adp.ADPfuncID) { case 1: adp.ADPfuncName = "Brightness"; break; case 2: adp.ADPfuncName = "Character Light (RED)"; break; case 3: adp.ADPfuncName = "Character Light (GREEN)"; break; case 4: adp.ADPfuncName = "Character Light (BLUE)"; break; case 6: adp.ADPfuncName = "Red Light"; break; case 7: adp.ADPfuncName = "Green Light"; break; case 8: adp.ADPfuncName = "Blue Light"; break; case 14: adp.ADPfuncName = "Spec. Map Transparency"; break; case 15: adp.ADPfuncName = "Character Lighting"; break; case 17: adp.ADPfuncName = "Generic Lighting"; break; case 18: adp.ADPfuncName = "Skin Shine"; break; case 21: adp.ADPfuncName = "Outline Transparency"; break; case 39: adp.ADPfuncName = "Eye Lighting"; break; case 40: adp.ADPfuncName = "Skin Toon Intensity"; break; case 41: adp.ADPfuncName = "BLINN Lighting"; break; case 42: adp.ADPfuncName = "Cloth Lighting"; break; case 43: adp.ADPfuncName = "Item Lighting"; break; case 44: adp.ADPfuncName = "Hair Lighting"; break; case 46: adp.ADPfuncName = "Stage Lighting"; break; case 57: adp.ADPfuncName = "Hair Shine"; break; case 59: adp.ADPfuncName = "Dimness"; break; case 60: adp.ADPfuncName = "Character Lightness"; break; case 72: adp.ADPfuncName = "Eye Colour Saturation"; break; case 75: adp.ADPfuncName = "Handheld 30FPS Limit"; break; case 76: adp.ADPfuncName = "Docked 30FPS Limit"; break; case 77: adp.ADPfuncName = "Handheld Resolution"; break; case 78: adp.ADPfuncName = "Docked Resolution"; break; default: adp.ADPfuncName = "Unknown Function"; break; } adps.Add(adp); }