void fix16ToStr(fix16 value, char *str, s16 numdec) { u32 len; fix16 v; u32 frac; u8 strFrac[8]; len = 0; if (value < 0) { v = -value; str[len++] = '-'; } else v = value; len += uintToStr_(fix16ToInt(v), &str[len], 1, 16); str[len++] = '.'; // get fractional part frac = fix16Frac(v) * 1000; frac /= 1 << FIX16_FRAC_BITS; // get fractional string uintToStr(frac, strFrac, 3); if (numdec >= 3) strcpy(&str[len], strFrac); else strncpy(&str[len], strFrac, numdec); }
HRESULT WINAPI MyDirectDrawCreate(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter) { CLogger::addEntry("Calling MyDirectDrawCreate, GUID = "+(lpGUID?uintToStr(lpGUID->Data1):"NULL")); DirectDrawCreate_Type OldFn = (DirectDrawCreate_Type)D3DHook_DDRAW.Functions[D3DFN_DirectDrawCreate].OrigFn; HRESULT fnResult = OldFn(lpGUID,lplpDD,pUnkOuter); if (fnResult == S_OK && lplpDD) { IDirectDraw_setupHook((IDirectDraw*)*lplpDD); } return fnResult; }
static void vintEvent() { u16 i; u16 in, out; char strNum[8]; char str[40]; // set BUS protection for XGM driver if (driver->id == Z80_DRIVER_XGM) SND_set68KBUSProtection_XGM(TRUE); in = GET_VCOUNTER; if ((in >= 224) && (in <= 230)) { switch(dmaMethod) { case 1: VDP_doDMAEx(VDP_DMA_VRAM, 0, 0x8000, (6 * 1024) / 2, 2); break; case 2: for(i = 0; i < 4; i++) { VDP_doDMAEx(VDP_DMA_VRAM, 0, 0x8000, 1024 / 2, 2); waitSubTick(0); } break; case 3: for(i = 0; i < 8; i++) { VDP_doDMAEx(VDP_DMA_VRAM, 0, 0x8000, 256 / 2, 2); waitSubTick(0); } break; } } out = GET_VCOUNTER; if (driver->id == Z80_DRIVER_XGM) { u16 load; // remove BUS protection for XGM driver SND_set68KBUSProtection_XGM(FALSE); // get Z80 cpu estimated load load = SND_getCPULoad_XGM(); uintToStr(load, str, 3); strcat(str, " %"); VDP_clearText(16, 21, 10); VDP_drawText(str, 16, 21); // { // u8 debugValues[12]; // // getZ80Debug(debugValues); // // strcpy(str, "4 PCM mixing: "); // // uintToStr(debugValues[0], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[4], strNum, 3); // strcat(str, strNum); // // VDP_drawText(str, 1, 22); // // strcpy(str, "XGM prep & parse: "); // // uintToStr(debugValues[5], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[6], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[7], strNum, 3); // strcat(str, strNum); // // VDP_drawText(str, 1, 23); // // strcpy(str, "Ext com & sync: "); // // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[8], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[9], strNum, 3); // strcat(str, strNum); // // VDP_drawText(str, 1, 24); // } } else { VDP_clearTextLine(22); VDP_clearTextLine(23); VDP_clearTextLine(24); } if ((in >= 224) && (in <= 230)) { switch(dmaMethod) { case 0: VDP_drawText("NONE ", 13, 26); break; case 1: VDP_drawText("1 x 6KB ", 13, 26); break; case 2: VDP_drawText("4 x 1KB ", 13, 26); break; case 3: VDP_drawText("8 x 256B", 13, 26); break; } } else VDP_drawText("NOT DONE", 13, 26); if (dmaMethod) { strcpy(str, "DMA start at "); uintToStr(in, strNum, 3); strcat(str, strNum); strcat(str, " - end at "); uintToStr(out, strNum, 3); strcat(str, strNum); VDP_drawText(str, 1, 27); } else VDP_clearTextLine(27); }
static void drawStatusMsg(u8 joy, u8 line){ u8 channel = (joy>0) ? CHANNEL_DEF_JOY1 : CHANNEL_DEF_JOY0; char text[20]; char ntext[5]; u8 sus = sustainOn[channel]; u8 ki = keyIndex[joy]; switch(line){ case 0: strcpy(text, (tonicList[joy][ki]==C) ? "C" : (tonicList[joy][ki]==C_S) ? "C#/Db" : (tonicList[joy][ki]==D) ? "D" : (tonicList[joy][ki]==D_S) ? "D#/Eb" : (tonicList[joy][ki]==E) ? "E" : (tonicList[joy][ki]==F) ? "F" : (tonicList[joy][ki]==F_S) ? "F#/Gb" : (tonicList[joy][ki]==G) ? "G" : (tonicList[joy][ki]==G_S) ? "G#/Ab" : (tonicList[joy][ki]==A) ? "A" : (tonicList[joy][ki]==A_S) ? "A#/Bb" : (tonicList[joy][ki]==B) ? "B" : "N/A"); break; case 1: strcpy(text, (modeList[joy][ki]==MAJOR) ? "MAJOR" : (modeList[joy][ki]==DORIAN) ? "DORIAN" : (modeList[joy][ki]==PHRYGIAN) ? "PHRYG" : (modeList[joy][ki]==LYDIAN) ? "LYDIAN" : (modeList[joy][ki]==MIXOLYDIAN) ? "MXLYD" : (modeList[joy][ki]==MINOR) ? "MINOR" : (modeList[joy][ki]==LOCRIAN) ? "LOCRI" : (modeList[joy][ki]==MINOR_MEL) ? "M MEL" : (modeList[joy][ki]==MINOR_HARM) ? "M HARM" : "N/A"); break; case 2: uintToStr(octave[channel], text, 1); break; case 3: strcpy(text, (sus==SUS_STRUM) ? "STRUM" : (sus==SUS_HAMMER) ? "HAMMER" : "OFF"); break; case 4: uintToStr(pitchModDepth[channel], text, 1); break; case 5: strcpy(text, (vibratoOn[channel]) ? "ON" : "OFF"); break; case 7: if (!joy){ strcpy(text, (harmonyOn) ? "ON" : "OFF"); } else{ // strcpy(text, (noiseOn) ? "ON" : "OFF"); // if (noiseOn){ // uintToStr(noiseOn, text, 1); // } // else{ // strcpy(text, "OFF"); // } strcpy(text, (noiseOn==NOISE_MODE_CHAN3PERIOD) ? "PERIOD" : (noiseOn==NOISE_MODE_CHAN3WHITE) ? "WHITE" : (noiseOn==NOISE_MODE_CLOCKWHITE) ? "CLOCK" : "OFF"); } break; case 8: strcpy(text, (portamentoOn[channel]) ? "ON" : "OFF"); break; case 6: strcpy(text, (arpeggioOn[channel]) ? "ON" : "OFF"); break; default: strcpy(text, "???"); break; } if (line >= Y_STATUS_BLANK_LINE){ line++; } //draw in either 1p column or 2p column //the `- joy` means subtract 1 from x if on 2p column // u8 x = X_STATVAL + (joy * (WIDTH_TILES/2)) - (joy); u8 x = X_STATVAL + leftEdge(joy); drawText(text, x, Y_STATUS+line, 0, 6); }