Amiga Emulator versteht Bildmodus Umschaltung nicht

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Amiga Emulator versteht Bildmodus Umschaltung nicht

    Hallo
    Ich fummel gerade an einem Amiga Emulator rum.

    Das Problem das ich genau habe ist folgendes:
    Der Emuator zeigt, wenn ein HAM Bild oder der HAM Modus aktiviert wird das Bild perfekt an.
    Jedoch kehrt er nicht nach dem Anzeigen nicht wieder in den alten Bildschirmmodus zurück, was zu Farbfehlern führt da die passende Farbpalette nicht stimmt.
    In Zeile 10 wird ja entschieden, wenn der HAM Modus erkannt wird diesen anzuzeigen, was ja auch funktioniert.
    In Zeile 14 ist die Situation so das wenn kein HAM Modus erkannt wird der standart ECS Modus wieder laufen soll.
    Dieser ECS Modus funktioniert solange 1a bis irgendetwas mit dem HAM Modus geladen wird. In diesem Augenblick bleibt er in diesem Modus.
    Auch ein Reset hilft nicht.

    Jetzt mein anliegen. Wie kann oder könnte man den ECS Modus wiederherstellen oder sogar nach dem HAM Modus erzwingen?
    Als Beispiel füge ich noch ein paar Screenshots bei.
    Da ich nicht so der erfahrene Typ was Coding betrifft wende ich mich an euch.
    Beachtet bitte auch das es sich hier um einen Fremdcode handelt.

    Gruß Markus

    C-Quellcode

    1. static __inline__ int LNAME (int spix, int dpix, int stoppos)
    2. {
    3. /* CASO DUAL
    4. unsigned short *buf = ((unsigned short *)xlinebuffer);
    5. /* HAM CASE
    6. if (dp_for_drawing->ham_seen) {
    7. while (dpix < stoppos) {
    8. buf[dpix++]= (xcolors[ham_linebuf[spix]]);
    9. spix += SRC_INC;
    10. UNROLL_PFIELD;
    11. }
    12. } else if (bpldualpfpri) {
    13. // OCS/ECS Dual playfield
    14. int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1;
    15. #if defined(DREAMCAST)
    16. register int resto=(((unsigned)&buf[dpix])&0x1f);
    17. if (resto)
    18. resto=0x20-resto;
    19. if (resto>(stoppos-dpix))
    20. resto=(stoppos-dpix);
    21. while (resto>0) {
    22. register unsigned short d = colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    23. buf[dpix++]= d;
    24. spix += SRC_INC;
    25. resto-=2;
    26. }
    27. if (dpix >= stoppos)
    28. return spix;
    29. unsigned int *d = (unsigned int *)(void *)
    30. (0xe0000000 | (((unsigned long)&buf[dpix]) & 0x03ffffe0));
    31. unsigned short *s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    32. unsigned n=((stoppos-dpix)>>4);
    33. {
    34. register unsigned tmp=n<<4;
    35. resto=(stoppos-dpix)-tmp;
    36. dpix+=tmp;
    37. }
    38. QACR0 = ((((unsigned int)&buf[dpix])>>26)<<2)&0x1c;
    39. QACR1 = ((((unsigned int)&buf[dpix])>>26)<<2)&0x1c;
    40. while(n--) {
    41. // asm("pref @%0" : : "r" (s + 8));
    42. register unsigned dato;
    43. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    44. d[0] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    45. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    46. d[1] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    47. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    48. d[2] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    49. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    50. d[3] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    51. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    52. d[4] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    53. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    54. d[5] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    55. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    56. d[6] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    57. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]]; dato|=(((unsigned)*s)<<16);
    58. d[7] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    59. asm("pref @%0" : : "r" (d));
    60. d+=8;
    61. }
    62. d = (unsigned int *)0xe0000000;
    63. d[0] = d[8] = 0;
    64. while (resto>0) {
    65. register unsigned short d = colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    66. buf[dpix++]= d;
    67. spix += SRC_INC;
    68. resto--;
    69. }
    70. #else
    71. while (dpix < stoppos) {
    72. register unsigned short d = colors_for_drawing.acolors[lookup[pixdata.apixels[spix]]];
    73. buf[dpix++] = d;
    74. spix += SRC_INC;
    75. }
    76. #endif
    77. //HIGH BRIGHT CASE
    78. } else if (bplehb) {
    79. #if defined(DREAMCAST)
    80. #error NOT IMPLEMENTED YET
    81. #else
    82. while (dpix < stoppos) {
    83. uae_u32 spix_val = pixdata.apixels[spix];
    84. register unsigned short d = pixdata.apixels[spix];
    85. if (d <= 31)
    86. buf[dpix++] = colors_for_drawing.acolors[d];
    87. else
    88. buf[dpix++] = xcolors[(colors_for_drawing.color_uae_regs_ecs[d - 32] >> 1) & 0x777];
    89. spix += SRC_INC;
    90. }
    91. #endif
    92. } else {
    93. // CASO NORMAL
    94. #if defined(DREAMCAST)
    95. register int resto=(((unsigned)&buf[dpix])&0x1f);
    96. if (resto)
    97. resto=0x20-resto;
    98. if (resto>(stoppos-dpix))
    99. resto=(stoppos-dpix);
    100. while (resto>0) {
    101. buf[dpix++]= (colors_for_drawing.acolors[pixdata.apixels[spix]]);
    102. spix += SRC_INC;
    103. resto-=2;
    104. }
    105. if (dpix >= stoppos)
    106. return spix;
    107. unsigned int *d = (unsigned int *)(void *)
    108. (0xe0000000 | (((unsigned long)&buf[dpix]) & 0x03ffffe0));
    109. unsigned short *s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    110. unsigned n=((stoppos-dpix)>>4);
    111. {
    112. register unsigned tmp=n<<4;
    113. resto=(stoppos-dpix)-tmp;
    114. dpix+=tmp;
    115. }
    116. QACR0 = ((((unsigned int)&buf[dpix])>>26)<<2)&0x1c;
    117. QACR1 = ((((unsigned int)&buf[dpix])>>26)<<2)&0x1c;
    118. while(n--) {
    119. // asm("pref @%0" : : "r" (s + 8));
    120. register unsigned dato;
    121. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    122. d[0] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    123. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    124. d[1] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    125. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    126. d[2] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    127. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    128. d[3] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    129. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    130. d[4] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    131. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    132. d[5] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    133. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    134. d[6] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    135. dato=*s; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]]; dato|=(((unsigned)*s)<<16);
    136. d[7] = dato; spix += SRC_INC; s = (unsigned short *)&colors_for_drawing.acolors[pixdata.apixels[spix]];
    137. asm("pref @%0" : : "r" (d));
    138. d+=8;
    139. }
    140. d = (unsigned int *)0xe0000000;
    141. d[0] = d[8] = 0;
    142. while (resto>0) {
    143. buf[dpix++]= (colors_for_drawing.acolors[pixdata.apixels[spix]]);
    144. spix += SRC_INC;
    145. resto--;
    146. }
    147. #else
    148. while (dpix < stoppos) {
    149. buf[dpix++]= (colors_for_drawing.acolors[pixdata.apixels[spix]]);
    150. spix += SRC_INC;
    151. }
    152. #endif
    153. }
    154. return spix;
    155. }
    156. #undef LNAME
    157. #undef HDOUBLE
    158. #undef SRC_INC
    Alles anzeigen
    ECS Modus funktioniert perfekt
    Simulator Screen Shot 09.07.2016, 06.19.46.png

    HAM Bild wird perfekt mit richtigen Farben angezeigt
    Simulator Screen Shot 09.07.2016, 06.20.04.png

    Danach ein Reset und der Emulator bleibt im HAM Modus was er nicht tun sollte.
    Entsprechend passen die Farben nicht mehr.
    Simulator Screen Shot 09.07.2016, 06.20.14.png
  • Ohne die Struktur von dp_for_drawing zu kennen würde ich sagen, dass das Bit ham_seen einmal gesetzt wird, sobald ein HAM Bild gefunden wurde.

    Insofern würde ich zunächst einmal analysieren ob ham_seen im gegenteiligen Fall überhaupt zurückgesetzt wird und dann versuchen herauszufinden warum nicht.
    «Applejack» "Don't you use your fancy mathematics to muddle the issue!"

    Iä-86! Iä-64! Awavauatsh fthagn!

    kmr schrieb:

    Ach, Du bist auch so ein leichtgläubiger Zeitgenosse, der alles glaubt, was irgendwelche Typen vor sich hin brabbeln. :-P