bool Tpreset::saveFile(const char_t *flnm) { DeleteFile(flnm); TregOpFileWrite t(flnm,_l("presetSettings")); reg_op(t); return fileexists(flnm); //TODO: TregOpFileWrite should throw exception when writing fails }
void Tpreset::saveReg(void) { char_t presetRegStr[MAX_PATH]; tsnprintf_s(presetRegStr, countof(presetRegStr), _TRUNCATE, FFDSHOW_REG_PARENT _l("\\%s\\%s"), reg_child, presetName); TregOpRegWrite t(HKEY_CURRENT_USER,presetRegStr); reg_op(t); }
bool Tpreset::loadFile(const char_t *flnm) { if (!fileexists(flnm)) { return false; } char_t sections[4096]=_l(""); Tinifile ini(flnm); ini.getPrivateProfileSectionNames(sections,4095); if (sections[0]=='\0') { return false; } _splitpath_s(flnm,NULL,0,NULL,0,presetName,MAX_PATH,NULL,0); TregOpFileRead t(flnm,sections); reg_op(t); fixOrder(); return true; }
void TcoSettings::loadReg(void) { TregOpRegRead t(HKEY_CURRENT_USER, FFDSHOW_REG_PARENT _l("\\") FFDSHOWENC); reg_op(t); fillIncsps(); }
void TcoSettings::saveReg(void) { TregOpRegWrite t(HKEY_CURRENT_USER, FFDSHOW_REG_PARENT _l("\\") FFDSHOWENC); reg_op(t); }
void disasm_mips_instruction(u32 opcode, char *buffer, u32 pc) { int opcode_type = opcode >> 26; if(opcode == 0) { sprintf(buffer, "nop"); return; } switch(mips_opcode_types[opcode_type]) { case MIPS_OPCODE_ALU_IMMS: { u32 rs = op_bits(reg_rs, 0x1F); if((opcode_type == 0x9) && (rs == 0)) { sprintf(buffer, "li %s, %d", reg_op(reg_rt), imms()); } else { sprintf(buffer, "%s %s, %s, %d", mips_opcode_names[opcode_type], reg_op(reg_rt), mips_reg_names[rs], imms()); } break; } case MIPS_OPCODE_ALU_IMMU: { sprintf(buffer, "%s %s, %s, 0x%x", mips_opcode_names[opcode_type], reg_op(reg_rt), reg_op(reg_rs), immu()); break; } case MIPS_OPCODE_ALU2_IMMU: { sprintf(buffer, "%s %s, 0x%x", mips_opcode_names[opcode_type], reg_op(reg_rt), immu()); break; } case MIPS_OPCODE_REGIMM: { u32 function = op_bits(16, 0x1F); sprintf(buffer, "%s %s, %08x", mips_function_regimm_names[function], reg_op(reg_rs), pc_offset()); break; } case MIPS_OPCODE_SPECIAL: { mips_function_special_type function = (mips_function_special_type)op_bits(0, 0x3F); switch(mips_function_special_types[function]) { case MIPS_SPECIAL_FUNCTION_ALU: { sprintf(buffer, "%s %s, %s, %s", mips_function_special_names[function], reg_op(reg_rd), reg_op(reg_rs), reg_op(reg_rt)); break; } case MIPS_SPECIAL_FUNCTION_MUL_DIV: { sprintf(buffer, "%s %s, %s", mips_function_special_names[function], reg_op(reg_rs), reg_op(reg_rt)); break; } case MIPS_SPECIAL_FUNCTION_JALR: { u32 rd = op_bits(reg_rd, 0x1F); if(rd == 31) { sprintf(buffer, "%s %s", mips_function_special_names[function], reg_op(reg_rs)); } else { sprintf(buffer, "%s %s, %s", mips_function_special_names[function], mips_reg_names[rd], reg_op(reg_rs)); } break; } case MIPS_SPECIAL_FUNCTION_JR: { sprintf(buffer, "%s %s", mips_function_special_names[function], reg_op(reg_rs)); break; } case MIPS_SPECIAL_FUNCTION_HI_LO: { sprintf(buffer, "%s %s", mips_function_special_names[function], reg_op(reg_rd)); break; } case MIPS_SPECIAL_FUNCTION_SHIFT: { sprintf(buffer, "%s %s, %s, %d", mips_function_special_names[function], reg_op(reg_rd), reg_op(reg_rt), op_bits(6, 0x1F)); break; } default: { sprintf(buffer, "unknown"); break; } } break; } case MIPS_OPCODE_BRANCH: { u32 offset = op_bits(0, 0x3FFFFFF); offset = (offset << 2) | ((pc + 4) & 0xFC000000); sprintf(buffer, "%s %08x", mips_opcode_names[opcode_type], offset); break; } case MIPS_OPCODE_BRANCHC: { sprintf(buffer, "%s %s, %08x", mips_opcode_names[opcode_type], reg_op(reg_rs), pc_offset()); break; } case MIPS_OPCODE_BRANCHC2: { sprintf(buffer, "%s %s, %s, %08x", mips_opcode_names[opcode_type], reg_op(reg_rs), reg_op(reg_rt), pc_offset()); break; } case MIPS_OPCODE_MEM: { s32 offset = signed_offset(); if(offset < 0) { sprintf(buffer, "%s %s, [%s - %d]", mips_opcode_names[opcode_type], reg_op(reg_rt), reg_op(reg_rs), -offset); } else { sprintf(buffer, "%s %s, [%s + %d]", mips_opcode_names[opcode_type], reg_op(reg_rt), reg_op(reg_rs), offset); } break; } default: { sprintf(buffer, "unknown"); break; } } }