This commit is contained in:
tildearrow 2023-03-14 01:27:45 -05:00
parent 5a8a29f5f2
commit e5ab3413cb
3 changed files with 19 additions and 5 deletions

View file

@ -280,15 +280,15 @@ struct DivRegWrite {
* - 0xffffffff: reset * - 0xffffffff: reset
*/ */
unsigned int addr; unsigned int addr;
unsigned short val; unsigned int val;
DivRegWrite(unsigned int a, unsigned short v): DivRegWrite(unsigned int a, unsigned int v):
addr(a), val(v) {} addr(a), val(v) {}
}; };
struct DivDelayedWrite { struct DivDelayedWrite {
int time; int time;
DivRegWrite write; DivRegWrite write;
DivDelayedWrite(int t, unsigned int a, unsigned short v): DivDelayedWrite(int t, unsigned int a, unsigned int v):
time(t), time(t),
write(a,v) {} write(a,v) {}
}; };

View file

@ -583,8 +583,8 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
logD("writing stream command %x:%x with stream ID %d",write.addr,write.val,streamID); logD("writing stream command %x:%x with stream ID %d",write.addr,write.val,streamID);
switch (write.addr&0xff) { switch (write.addr&0xff) {
case 0: // play sample case 0: // play sample
if (write.val<song.sampleLen) { if (write.val<(unsigned int)song.sampleLen) {
if (playingSample[streamID]!=write.val) { if (playingSample[streamID]!=(int)write.val) {
pendingFreq[streamID]=write.val; pendingFreq[streamID]=write.val;
} else { } else {
DivSample* sample=song.sample[write.val]; DivSample* sample=song.sample[write.val];

View file

@ -3698,6 +3698,20 @@ bool FurnaceGUI::loop() {
ImGui::InputText("##AVDPath",&workingDirROMExport); ImGui::InputText("##AVDPath",&workingDirROMExport);
if (ImGui::Button("Bake Data")) { if (ImGui::Button("Bake Data")) {
std::vector<DivROMExportOutput> out=e->buildROM(DIV_ROM_AMIGA_VALIDATION); std::vector<DivROMExportOutput> out=e->buildROM(DIV_ROM_AMIGA_VALIDATION);
if (workingDirROMExport.size()>0) {
if (workingDirROMExport[workingDirROMExport.size()-1]!=DIR_SEPARATOR) workingDirROMExport+=DIR_SEPARATOR_STR;
}
for (DivROMExportOutput& i: out) {
String path=workingDirROMExport+i.name;
FILE* outFile=ps_fopen(path.c_str(),"wb");
if (outFile!=NULL) {
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
fclose(outFile);
}
i.data->finish();
delete i.data;
}
showError(fmt::sprintf("Done! Baked %d files.",(int)out.size()));
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::EndMenu(); ImGui::EndMenu();