Merge branch 'tildearrow:master' into spectrum

This commit is contained in:
Eknous 2025-09-05 18:19:12 +04:00 committed by GitHub
commit 2c5ca6026e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 160 additions and 36 deletions

View file

@ -525,6 +525,72 @@ void FurnaceGUI::drawCSPlayer() {
ImGui::PopFont();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(_("Data Access Visualizer"))) {
ImGui::Text("%d bytes",(int)cs->getDataLen());
ImGui::PushFont(patFont);
if (ImGui::BeginTable("CSHexPos",chans,ImGuiTableFlags_SizingStretchSame)) {
ImGui::TableNextRow();
for (int i=0; i<chans; i++) {
ImGui::TableNextColumn();
ImGui::Text("%d",i);
}
ImGui::TableNextRow();
for (int i=0; i<chans; i++) {
DivCSChannelState* state=cs->getChanState(i);
ImGui::TableNextColumn();
ImGui::Text("$%.4x",state->readPos);
}
ImGui::EndTable();
}
ImGui::PopFont();
if (csTex==NULL || !rend->isTextureValid(csTex)) {
logD("recreating command stream data texture.");
csTex=rend->createTexture(true,256,256,false,GUI_TEXFORMAT_ABGR32);
if (csTex==NULL) {
logE("error while creating command stream data texture! %s",SDL_GetError());
}
}
if (csTex!=NULL) {
unsigned int* dataT=NULL;
int pitch=0;
if (!rend->lockTexture(csTex,(void**)&dataT,&pitch)) {
logE("error while locking command stream data texture! %s",SDL_GetError());
} else {
unsigned short* accessTS=cs->getDataAccess();
unsigned int csTick=cs->getCurTick();
const float fadeTime=64.0f;
size_t bufSize=cs->getDataLen();
if (bufSize>65536) bufSize=65536;
for (size_t i=0; i<bufSize; i++) {
float cellAlpha=(float)(fadeTime-(((short)(csTick&0xffff))-(short)accessTS[i]))/fadeTime;
if (cellAlpha>0.0f) {
dataT[i]=ImGui::GetColorU32(ImGuiCol_HeaderActive,cellAlpha);
} else {
dataT[i]=0;
}
}
for (size_t i=bufSize; i<65536; i++) {
dataT[i]=0;
}
for (int i=0; i<e->getTotalChannelCount(); i++) {
unsigned int pos=cs->getChanState(i)->readPos;
if (pos<65536) {
ImVec4 col=ImVec4(1.0f,1.0f,1.0f,1.0f);
ImGui::ColorConvertHSVtoRGB((float)i/(float)e->getTotalChannelCount(),0.8f,1.0f,col.x,col.y,col.z);
dataT[pos]=ImGui::GetColorU32(col);
}
}
rend->unlockTexture(csTex);
}
ImGui::Image(rend->getTextureID(csTex),ImVec2(768.0*dpiScale,768.0*dpiScale));
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(_("Stream Info"))) {
ImGui::Text("%d bytes",(int)cs->getDataLen());
ImGui::Text("%u channels",cs->getFileChans());
@ -538,6 +604,11 @@ void FurnaceGUI::drawCSPlayer() {
ImGui::SameLine();
ImGui::Text("%d",cs->getFastCmds()[i]);
}
ImGui::Text("stack sizes:");
for (unsigned int i=0; i<cs->getFileChans(); i++) {
ImGui::SameLine();
ImGui::Text("%d",cs->getChanState(i)->callStackSize);
}
ImGui::Text("ticks: %u",cs->getCurTick());
ImGui::EndTabItem();
}

View file

@ -1668,6 +1668,8 @@ class FurnaceGUI {
int sampleTexW, sampleTexH;
bool updateSampleTex;
FurnaceGUITexture* csTex;
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName, nextFile, sysSearchQuery, newSongQuery, paletteQuery, sampleBankSearchQuery;
String workingDirSong, workingDirIns, workingDirWave, workingDirSample, workingDirAudioExport;
String workingDirVGMExport, workingDirROMExport;

View file

@ -2318,6 +2318,32 @@ void FurnaceGUI::drawSampleEdit() {
}
}
}
if (displayLoopHintsNDSA) {
if (sampleZoom<0.5) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&7)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsNDS8) {
if (sampleZoom<0.375) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&3)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsAmiga) {
if (sampleZoom<0.25) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {

View file

@ -1313,7 +1313,7 @@ void FurnaceCV::buildStage(int which) {
curStage=NULL;
}
if (which>19 || which==4 || which==7 || which==9 || which==11 || which==13 || which==16 || which==17) {
if (which>18 || which==4 || which==7 || which==9 || which==11 || which==13 || which==16 || which==17) {
stageWidth=80;
stageHeight=56;
} else {
@ -1346,26 +1346,7 @@ void FurnaceCV::buildStage(int which) {
memset(busy,0,28*40*sizeof(bool));
// special stages
if ((which%10)==9) {
// vortex
for (int i=0; i<20+(which>>2); i++) {
int tries=0;
while (tries<20) {
int x=rand()%(stageWidth>>1);
int y=rand()%(stageHeight>>1);
int finalX=x<<4;
int finalY=y<<4;
if (busy[y][x]) {
tries++;
continue;
}
createObject<FurnaceCVEnemyVortex>(finalX,finalY);
createObject<FurnaceCVFurBallMedium>(finalX-4,finalY-4);
busy[y][x]=true;
break;
}
}
} else if ((which%10)==19) {
if ((which%20)==19) {
for (int i=0; i<20+(which>>2); i++) {
int tries=0;
while (tries<20) {
@ -1387,6 +1368,25 @@ void FurnaceCV::buildStage(int which) {
break;
}
}
} else if ((which%10)==9) {
// vortex
for (int i=0; i<20+(which>>2); i++) {
int tries=0;
while (tries<20) {
int x=rand()%(stageWidth>>1);
int y=rand()%(stageHeight>>1);
int finalX=x<<4;
int finalY=y<<4;
if (busy[y][x]) {
tries++;
continue;
}
createObject<FurnaceCVEnemyVortex>(finalX,finalY);
createObject<FurnaceCVFurBallMedium>(finalX-4,finalY-4);
busy[y][x]=true;
break;
}
}
} else {
// large
if (which>=2) for (int i=0; i<(rand()%3)+which-2; i++) {
@ -1675,6 +1675,7 @@ void FurnaceCV::render(unsigned char joyIn) {
lives+=lifeBank;
respawnTime=1;
lifeBank=0;
score=0;
gameOver=false;
}