Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add steamdeck build #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Software/GameEngine/common.make
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ else
CFLAGS += -DDC801_DESKTOP -fno-short-enums -D_DEFAULT_SOURCE
endif

ifdef STEAMDECK
CFLAGS += -DDC801_STEAMDECK
endif

CXXFLAGS += -Wno-register

# Assembler flags common to all targets
Expand Down
110 changes: 63 additions & 47 deletions Software/GameEngine/src/engine/EngineWindowFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ void EngineWindowFrameInit()
ENGINE_PANIC("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
}

#ifdef DC801_STEAMDECK
frameSurface = IMG_Load(FRAME_ASSETS_PATH "/window_frame_steamdeck.png");
#else
frameSurface = IMG_Load(FRAME_ASSETS_PATH "/window_frame.png");
#endif

if (!frameSurface)
{
Expand Down Expand Up @@ -56,6 +60,13 @@ void EngineWindowFrameInit()
&renderer
);

#ifdef DC801_STEAMDECK
SDL_SetWindowFullscreen(
window,
SDL_WINDOW_FULLSCREEN
);
#endif

SDL_SetWindowTitle(
window,
"DC801 MAGE GAME"
Expand All @@ -82,9 +93,14 @@ void EngineWindowFrameInit()
HEIGHT
);
}
#ifdef DC801_STEAMDECK
const int drawOffset = 48;
#else
const int drawOffset = 0;
#endif

const SDL_Rect gameViewportSrcRect = {0, 0, WIDTH, HEIGHT};
const SDL_Rect gameViewportDstRect = {112, 56, WIDTH, HEIGHT};
const SDL_Rect gameViewportDstRect = {drawOffset + 112, 56, WIDTH, HEIGHT};
const SDL_Rect buttonOffSrcRect = {0, 0, 32, 32};
const SDL_Rect buttonOnSrcRect = {0, 32, 32, 32};
const SDL_Rect LEDOffSrcRect = {0, 0, 16, 8};
Expand All @@ -95,33 +111,33 @@ const SDL_Point buttonHalf = {16, 16};
const SDL_Point LEDHalf = {8, 4};

const SDL_Point buttonDestPoints[] = {
{506, 98},
{506, 98 + 42},
{506, 98 + 42 + 42},
{506, 98 + 42 + 42 + 42},
{126, 364},
{126 + 42, 364},
{126 + 42 + 42, 364},
{126 + 42 + 42 + 42, 364},
{126 + 42 + 42 + 42 + 42, 364},
{126 + 42 + 42 + 42 + 42 + 42, 364},
{126 + 42 + 42 + 42 + 42 + 42 + 42, 364},
{126 + 42 + 42 + 42 + 42 + 42 + 42 + 42, 364},
{38, 98},
{38, 98 + 42},
{38, 98 + 42 + 42},
{38, 98 + 42 + 42 + 42},
{54, 344},
{54 - 32, 344},
{54, 344 + 32},
{54, 344 - 32},
{54 + 32, 344},
{490, 344},
{490 - 32, 344},
{490, 344 + 32},
{490, 344 - 32},
{490 + 32, 344},
{38, 98 - 42},
{drawOffset + 506, 98},
{drawOffset + 506, 98 + 42},
{drawOffset + 506, 98 + 42 + 42},
{drawOffset + 506, 98 + 42 + 42 + 42},
{drawOffset + 126, 364},
{drawOffset + 126 + 42, 364},
{drawOffset + 126 + 42 + 42, 364},
{drawOffset + 126 + 42 + 42 + 42, 364},
{drawOffset + 126 + 42 + 42 + 42 + 42, 364},
{drawOffset + 126 + 42 + 42 + 42 + 42 + 42, 364},
{drawOffset + 126 + 42 + 42 + 42 + 42 + 42 + 42, 364},
{drawOffset + 126 + 42 + 42 + 42 + 42 + 42 + 42 + 42, 364},
{drawOffset + 38, 98},
{drawOffset + 38, 98 + 42},
{drawOffset + 38, 98 + 42 + 42},
{drawOffset + 38, 98 + 42 + 42 + 42},
{drawOffset + 54, 344},
{drawOffset + 54 - 32, 344},
{drawOffset + 54, 344 + 32},
{drawOffset + 54, 344 - 32},
{drawOffset + 54 + 32, 344},
{drawOffset + 490, 344},
{drawOffset + 490 - 32, 344},
{drawOffset + 490, 344 + 32},
{drawOffset + 490, 344 - 32},
{drawOffset + 490 + 32, 344},
{drawOffset + 38, 98 - 42},
};

void drawButtonStates ()
Expand All @@ -144,25 +160,25 @@ void drawButtonStates ()
}

const SDL_Point LEDDestPoints[LED_COUNT] = {
{76, 112}, //LED_XOR
{76, 112 + 42}, //LED_ADD
{76, 112 + 42 + 42}, //LED_SUB
{76, 112 + 42 + 42 + 42}, //LED_PAGE
{126, 328}, //LED_BIT128
{126 + 42, 328}, //LED_BIT64
{126 + 42 + 42, 328}, //LED_BIT32
{126 + 42 + 42 + 42, 328}, //LED_BIT16
{126 + 42 + 42 + 42 + 42, 328}, //LED_BIT8
{126 + 42 + 42 + 42 + 42 + 42, 328}, //LED_BIT4
{126 + 42 + 42 + 42 + 42 + 42 + 42, 328}, //LED_BIT2
{126 + 42 + 42 + 42 + 42 + 42 + 42 + 42, 328}, //LED_BIT1
{468, 112 + 42 + 42 + 42}, //LED_MEM3
{468, 112 + 42 + 42}, //LED_MEM2
{468, 112 + 42}, //LED_MEM1
{468, 112}, //LED_MEM0
{468, 112 - 42 - 21}, //LED_USB
{76, 112 - 42}, //LED_HAX
{468, 112 - 42}, //LED_SD
{drawOffset + 76, 112}, //LED_XOR
{drawOffset + 76, 112 + 42}, //LED_ADD
{drawOffset + 76, 112 + 42 + 42}, //LED_SUB
{drawOffset + 76, 112 + 42 + 42 + 42}, //LED_PAGE
{drawOffset + 126, 328}, //LED_BIT128
{drawOffset + 126 + 42, 328}, //LED_BIT64
{drawOffset + 126 + 42 + 42, 328}, //LED_BIT32
{drawOffset + 126 + 42 + 42 + 42, 328}, //LED_BIT16
{drawOffset + 126 + 42 + 42 + 42 + 42, 328}, //LED_BIT8
{drawOffset + 126 + 42 + 42 + 42 + 42 + 42, 328}, //LED_BIT4
{drawOffset + 126 + 42 + 42 + 42 + 42 + 42 + 42, 328}, //LED_BIT2
{drawOffset + 126 + 42 + 42 + 42 + 42 + 42 + 42 + 42, 328}, //LED_BIT1
{drawOffset + 468, 112 + 42 + 42 + 42}, //LED_MEM3
{drawOffset + 468, 112 + 42 + 42}, //LED_MEM2
{drawOffset + 468, 112 + 42}, //LED_MEM1
{drawOffset + 468, 112}, //LED_MEM0
{drawOffset + 468, 112 - 42 - 21}, //LED_USB
{drawOffset + 76, 112 - 42}, //LED_HAX
{drawOffset + 468, 112 - 42}, //LED_SD
};

void drawLEDStates ()
Expand Down