AGS: Refactor VRAM accessors

This commit is contained in:
kichikuou
2025-01-17 15:13:32 +09:00
parent 1673a5eb3c
commit 11a366005f
2 changed files with 7 additions and 25 deletions
+1 -19
View File
@@ -80,14 +80,7 @@ AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id), dirty(
// DIBSection 8bpp * 3 (表, 裏, メニュー)
for(int i = 0; i < 3; i++) {
hBmpScreen[i] = SDL_CreateRGBSurfaceWithFormat(0, 640, 480, 8, SDL_PIXELFORMAT_INDEX8);
// TODO: clear surface
// memset(lpBmpScreen[i], 0, 640 * 480 * sizeof(DWORD));
// 仮想VRAMへのポインタ取得
for(int j = 0; j < 480; j++) {
vram[i][j] = (uint8_t*)hBmpScreen[i]->pixels + hBmpScreen[i]->pitch * j;
}
vram[i] = reinterpret_cast<uint8_t(*)[640]>(hBmpScreen[i]->pixels);
}
// All surfaces share the same palette.
@@ -97,7 +90,6 @@ AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id), dirty(
// DIBSection 24bpp * 1 (最終出力先)
display_surface = hBmpDest = SDL_CreateRGBSurface(0, 640, 480, 32, 0, 0, 0, 0);
// TODO: clear surface
// フォント
TTF_Init();
@@ -464,16 +456,6 @@ std::vector<uint32_t> AGS::get_screen_palette() const
return palette;
}
uint8 AGS::get_pixel(int dest, int x, int y)
{
return vram[dest][y][x];
}
void AGS::set_pixel(int dest, int x, int y, uint8 color)
{
vram[dest][y][x] = color;
}
void AGS::fade_out(int duration_ms, bool white)
{
if (fade_level)