├── .gitignore ├── Actors ├── Player.c └── Player.h ├── Assets ├── collision.bmp ├── map.bmp ├── sprites.bmp └── tiles.bmp ├── Emulated ├── Drive │ ├── EFI │ │ ├── Boot │ │ │ └── Shell.efi │ │ └── Game │ │ │ ├── Game.efi │ │ │ ├── collision.bmp │ │ │ ├── map.bmp │ │ │ ├── sprites.bmp │ │ │ └── tiles.bmp │ ├── NvVars │ └── startup.nsh └── bios.bin ├── Game.c ├── Game.inf ├── GamePkg.dec ├── GamePkg.dsc ├── Globals ├── GameState.h ├── Graphics.c └── Graphics.h ├── LICENSE.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | *.log -------------------------------------------------------------------------------- /Actors/Player.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "B:/UefiGame/Actors/Player.h" 14 | #include "B:/UefiGame/Globals/GameState.h" 15 | #include "B:/UefiGame/Globals/Graphics.h" 16 | //Coord->Pixel 17 | #define TO_PIXEL(A) ((A) / (INTN)(LOCATION_PRECISION)) 18 | //Coord->Tile 19 | #define TO_TILE(A) ((A) / (INTN)(LOCATION_PRECISION * SpriteLength)) 20 | //Tile->Coord 21 | #define FROM_TILE(A) ((A) * LOCATION_PRECISION * SpriteLength) 22 | //Pixel->Coord 23 | #define FROM_PIXEL(A) ((A) * LOCATION_PRECISION) 24 | //Pixel->Tile 25 | #define PIXEL_TO_TILE(A) ((A) / SpriteLength) 26 | //Tile->Pixel 27 | #define TILE_TO_PIXEL(A) ((A) * SpriteLength) 28 | 29 | EFI_INPUT_KEY last; 30 | 31 | VOID Clear ( 32 | IN Controller *this 33 | ) { 34 | UINTN i; 35 | for (i = 0; i < MAX_BUTTONS; i++) { 36 | this->buttons[i].state = FALSE; 37 | } 38 | 39 | this->shiftState = 0; 40 | } 41 | 42 | VOID Collide ( 43 | Player *this 44 | ) { 45 | 46 | UINTN newX = this->x + this->velX; 47 | UINTN newY = this->y + this->velY; 48 | /* Sonic like detection (arrows are each ray) 49 | http://info.sonicretro.org/SPG:Solid_Tiles#Sensors 50 | 51 | .^....^. 52 | .^....^. 53 | .^....^. 54 | .^....^. 55 | <<<<>>>> 56 | .v....v. 57 | .v....v. 58 | .v....v. 59 | */ 60 | 61 | const UINTN halfLength = SpriteLength / 2; 62 | const UINTN halfScaled = halfLength / SCALE; 63 | const INTN midX = TO_PIXEL(newX) + halfLength; 64 | const INTN midY = TO_PIXEL(newY) + halfLength; 65 | const INTN leftX = TO_PIXEL(newX) + (1 * SpriteLength / 8); 66 | const INTN rightX = TO_PIXEL(newX) + (7 * SpriteLength / 8); 67 | 68 | UINTN left, right, upLeft, upRight, downLeft, downRight; 69 | left = right = upLeft = upRight = downLeft = downRight = halfScaled + 1; 70 | 71 | for (UINTN i = 0; i <= halfLength / SCALE + 1; i++) { 72 | if ( //Midpoint to left 73 | this->velX < 0 && 74 | LevelBuffer[PIXEL_TO_TILE((midX - i * SCALE)) + 75 | PIXEL_TO_TILE(midY) * LevelWidth 76 | ] == 0 77 | ) { 78 | left = i; 79 | } 80 | else if ( //Midpoint to right 81 | this->velX > 0 && 82 | LevelBuffer[PIXEL_TO_TILE(midX + (i - 1) * SCALE) + 83 | PIXEL_TO_TILE(midY) * LevelWidth 84 | ] == 0 85 | ) { 86 | right = i; 87 | } 88 | 89 | if (this->velY < 0) { 90 | if ( //Left midpoint to up 91 | LevelBuffer[ 92 | PIXEL_TO_TILE(leftX) + 93 | PIXEL_TO_TILE(midY - i * SCALE) * LevelWidth 94 | ] == 0 95 | ) { 96 | upLeft = i; 97 | } 98 | if ( //Right midpoint to up 99 | LevelBuffer[ 100 | PIXEL_TO_TILE(rightX) + 101 | PIXEL_TO_TILE(midY - i * SCALE) * LevelWidth 102 | ] == 0 103 | ) { 104 | upRight = i; 105 | } 106 | } 107 | else if (this->velY >= 0) { //Need to check for ledges (<=) 108 | if ( //Left midpoint to down 109 | LevelBuffer[ 110 | PIXEL_TO_TILE(leftX) + 111 | PIXEL_TO_TILE(midY + (i - 1) * SCALE) * LevelWidth 112 | ] == 0 113 | ) { 114 | downLeft = i; 115 | } 116 | if ( //Right midpoint to down 117 | LevelBuffer[ 118 | PIXEL_TO_TILE(rightX) + 119 | PIXEL_TO_TILE(midY + (i - 1) * SCALE) * LevelWidth 120 | ] == 0 121 | ) { 122 | downRight = i; 123 | } 124 | } 125 | 126 | } 127 | //DEBUG///////////// 128 | gST->ConOut->SetCursorPosition(gST->ConOut, 65, 0); 129 | Print(L"%d, %d \t", upLeft, upRight); 130 | gST->ConOut->SetCursorPosition(gST->ConOut, 65, 1); 131 | Print(L"%d, %d \t", left, right); 132 | gST->ConOut->SetCursorPosition(gST->ConOut, 65, 2); 133 | Print(L"%d, %d \t", downLeft, downRight); 134 | gST->ConOut->SetCursorPosition(gST->ConOut, 65, 3); 135 | Print(L"%d, %d \t", this->velX != 0, this->velY != 0); 136 | 137 | if (left <= halfScaled) { 138 | newX += FROM_PIXEL(halfLength - left * SCALE); 139 | this->velX = 0; 140 | } 141 | else if (right <= halfScaled) { 142 | newX -= FROM_PIXEL(halfLength - right * SCALE); 143 | this->velX = 0; 144 | } 145 | 146 | if (downLeft <= halfScaled || downRight <= halfScaled) { 147 | if (downLeft > downRight) { 148 | newY -= FROM_PIXEL(halfLength - downLeft * SCALE); 149 | } 150 | else { 151 | newY -= FROM_PIXEL(halfLength - downRight * SCALE); 152 | } 153 | this->velY = 0; 154 | this->flags.midair = 0; 155 | } 156 | else { 157 | this->flags.midair = 1; 158 | } 159 | 160 | if (upLeft <= halfScaled || upRight <= halfScaled) { 161 | if (upLeft > upRight) { 162 | newY += FROM_PIXEL(halfLength - upLeft * SCALE); 163 | } 164 | else { 165 | newY += FROM_PIXEL(halfLength - upRight * SCALE); 166 | } 167 | this->velY = 0; 168 | } 169 | 170 | this->x=newX; 171 | this->y=newY; 172 | //Change velocity 173 | //Check collisions 174 | //Set flags 175 | return; 176 | } 177 | 178 | VOID Refresh ( 179 | IN Controller *this 180 | ) { 181 | UINTN i; 182 | EFI_KEY_DATA KeyData; 183 | EFI_STATUS Status = Input->ReadKeyStrokeEx(Input, &KeyData); 184 | while (Status != EFI_NOT_READY && !EFI_ERROR(Status)) { 185 | this->shiftState = KeyData.KeyState.KeyShiftState; 186 | 187 | //Was shift pressed 188 | if (KeyData.Key.UnicodeChar >= u'A' && KeyData.Key.UnicodeChar <= u'Z') { 189 | //Make lowercase 190 | KeyData.Key.UnicodeChar += 0x20; //'a'(0x61) - 'A'(0x41) = 0x20 191 | this->shiftState = this->shiftState || EFI_LEFT_SHIFT_PRESSED; 192 | } 193 | 194 | for (i = 0; i < MAX_BUTTONS; i++) { 195 | //if scancode matches and != 0, or if unicode matches 196 | if ((this->buttons[i].scanCode == KeyData.Key.ScanCode && KeyData.Key.ScanCode != 0) 197 | ||this->buttons[i].unicode == KeyData.Key.UnicodeChar 198 | ) { 199 | this->buttons[i].state = TRUE; 200 | } 201 | } 202 | Status = Input->ReadKeyStrokeEx(Input, &KeyData); 203 | } 204 | } 205 | 206 | VOID Tick ( 207 | IN Player *this 208 | ) { 209 | this->controller->refresh(this->controller); 210 | 211 | //INTN acc = 0; 212 | this->accX = this->accY = 0; 213 | if (this->controller->buttons[UP].state && !this->flags.midair) { 214 | this->accY -= FROM_PIXEL(10); 215 | } 216 | else if (this->controller->buttons[DOWN].state) { 217 | this->accY += FROM_PIXEL(2); 218 | } 219 | else if (this->controller->buttons[LEFT].state) { 220 | this->flags.facingRight = 0; 221 | this->accX -= FROM_PIXEL(2); 222 | //acc -= FROM_PIXEL(2); 223 | } 224 | else if (this->controller->buttons[RIGHT].state) { 225 | this->flags.facingRight = 1; 226 | this->accX += FROM_PIXEL(2); 227 | //acc += FROM_PIXEL(2); 228 | } 229 | else if (this->controller->buttons[QUIT].state) { 230 | IsRunning = FALSE; 231 | } 232 | 233 | this->controller->clear(this->controller); 234 | 235 | this->velX += this->accX ;//+ acc; 236 | this->velY += this->accY; 237 | 238 | 239 | //Gravity 240 | //this->accY += FROM_PIXEL(1); 241 | //Max speed 242 | //if (this->velX > 32) { 243 | // this->velX = 32; 244 | //} 245 | //else if (this->velX < -32) { 246 | // this->velX = -32; 247 | //} 248 | 249 | //Get new sprite and location if moving 250 | if (this->velX/LOCATION_PRECISION != 0 || this->velY/LOCATION_PRECISION != 0) { 251 | this->collide(this); 252 | //Get sprite 253 | ExtractBuffer(SpriteSheet, 254 | SpriteSheetWidth, 255 | SpriteSheetHeight, 256 | this->flags.midair ? JUMP_FRAME * SpriteLength //Get jump/midair sprite 257 | : ((this->x / (LOCATION_PRECISION * 8)) % JUMP_FRAME) * SpriteLength, 258 | (!this->flags.facingRight) * SpriteLength, //Go down one tile (in the sprite sheet) if facing left 259 | &this->sprite, 260 | SpriteLength, 261 | SpriteLength 262 | ); 263 | } 264 | 265 | //Add to level buffer 266 | AddToBuffer(&DrawBuffer, 267 | LevelWidth * SpriteLength, 268 | LevelHeight * SpriteLength, 269 | this->sprite, 270 | TO_PIXEL(this->x), 271 | TO_PIXEL(this->y), 272 | SpriteLength, 273 | SpriteLength, 274 | TRUE 275 | ); 276 | } 277 | 278 | VOID InitializePlayer ( 279 | IN Player *this 280 | ) { 281 | this->tick = &Tick; 282 | this->collide = &Collide; 283 | 284 | last.ScanCode = SCAN_NULL; 285 | last.UnicodeChar = u' '; 286 | 287 | Controller *con; 288 | con = AllocatePool(sizeof(Controller)); 289 | 290 | con->clear = &Clear; 291 | con->refresh = &Refresh; 292 | 293 | con->buttons[UP].scanCode = SCAN_NULL; 294 | con->buttons[UP].unicode = u'w'; 295 | con->buttons[DOWN].scanCode = SCAN_NULL; 296 | con->buttons[DOWN].unicode = u's'; 297 | con->buttons[LEFT].scanCode = SCAN_NULL; 298 | con->buttons[LEFT].unicode = u'a'; 299 | con->buttons[RIGHT].scanCode = SCAN_NULL; 300 | con->buttons[RIGHT].unicode = u'd'; 301 | con->buttons[QUIT].scanCode = SCAN_ESC; 302 | con->buttons[QUIT].unicode = 0; 303 | con->clear(con); 304 | 305 | Camera *cam; 306 | cam = AllocatePool(sizeof(Camera)); 307 | cam->x = 0; 308 | cam->y = 0; 309 | cam->screen; 310 | GetScreen(&cam->screen); 311 | 312 | this->x = FROM_TILE(1); 313 | this->y = FROM_TILE(1); 314 | this->velX = 0; 315 | this->velY = 0; 316 | //this->flags - Will be set prior to displaying 317 | this->controller = con; 318 | this->camera = cam; 319 | ExtractBuffer(SpriteSheet, 320 | SpriteSheetWidth, 321 | SpriteSheetHeight, 322 | 0, //Frame 1 323 | 0, //Facing right 324 | &this->sprite, 325 | SpriteLength, 326 | SpriteLength 327 | ); 328 | } 329 | -------------------------------------------------------------------------------- /Actors/Player.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | enum {UP, DOWN, LEFT, RIGHT, QUIT, MAX_BUTTONS}; 10 | 11 | typedef struct { 12 | BOOLEAN state; 13 | CHAR16 unicode; 14 | UINT16 scanCode; 15 | } Button; 16 | 17 | /// 18 | /// Controls with scancodes 19 | /// 20 | typedef struct Controller { 21 | Button buttons[MAX_BUTTONS]; 22 | UINT32 shiftState; 23 | 24 | VOID (*clear)(); 25 | VOID (*refresh)(); 26 | } Controller; 27 | 28 | /// 29 | /// Camera information 30 | /// 31 | typedef struct Camera { 32 | UINTN x; 33 | UINTN y; 34 | EFI_GRAPHICS_OUTPUT_PROTOCOL *screen; 35 | } Camera; 36 | 37 | /// 38 | /// Player flags 39 | /// 40 | typedef struct PlayerFlags { 41 | BOOLEAN midair : 1; 42 | BOOLEAN facingRight : 1; 43 | } PlayerFlags; 44 | 45 | /// 46 | /// Player information 47 | /// 48 | typedef struct Player { 49 | /// 50 | /// X coord 51 | /// 52 | UINTN x; 53 | /// 54 | /// Y coord 55 | /// 56 | UINTN y; 57 | /// 58 | /// X velocity 59 | /// 60 | INTN velX; 61 | /// 62 | /// Y velocity 63 | /// 64 | INTN velY; 65 | /// 66 | /// X acceleration 67 | /// 68 | INTN accX; 69 | /// 70 | /// Y acceleration 71 | /// 72 | INTN accY; 73 | /// 74 | /// Midair, Facing Right 75 | /// 76 | PlayerFlags flags; 77 | /// 78 | /// Controller 79 | /// 80 | Controller *controller; 81 | /// 82 | /// Camera 83 | /// 84 | Camera *camera; 85 | /// 86 | /// Current sprite 87 | /// 88 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *sprite; 89 | 90 | VOID (*collide)(); 91 | VOID (*tick)(); 92 | } Player; 93 | 94 | VOID InitializePlayer ( 95 | IN Player *this 96 | ); -------------------------------------------------------------------------------- /Assets/collision.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Assets/collision.bmp -------------------------------------------------------------------------------- /Assets/map.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Assets/map.bmp -------------------------------------------------------------------------------- /Assets/sprites.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Assets/sprites.bmp -------------------------------------------------------------------------------- /Assets/tiles.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Assets/tiles.bmp -------------------------------------------------------------------------------- /Emulated/Drive/EFI/Boot/Shell.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/EFI/Boot/Shell.efi -------------------------------------------------------------------------------- /Emulated/Drive/EFI/Game/Game.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/EFI/Game/Game.efi -------------------------------------------------------------------------------- /Emulated/Drive/EFI/Game/collision.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/EFI/Game/collision.bmp -------------------------------------------------------------------------------- /Emulated/Drive/EFI/Game/map.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/EFI/Game/map.bmp -------------------------------------------------------------------------------- /Emulated/Drive/EFI/Game/sprites.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/EFI/Game/sprites.bmp -------------------------------------------------------------------------------- /Emulated/Drive/EFI/Game/tiles.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/EFI/Game/tiles.bmp -------------------------------------------------------------------------------- /Emulated/Drive/NvVars: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/NvVars -------------------------------------------------------------------------------- /Emulated/Drive/startup.nsh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/Drive/startup.nsh -------------------------------------------------------------------------------- /Emulated/bios.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IyadHamid/UefiGame/e74c778e1b5e9735b074545dd724d072652b3a7d/Emulated/bios.bin -------------------------------------------------------------------------------- /Game.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | #include "Actors/Player.h" 19 | #include "Globals/GameState.h" 20 | #include "Globals/Graphics.h" 21 | 22 | #define T Print(L"%d", zxc); zxc++; 23 | 24 | BOOLEAN IsRunning; 25 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL ZeroPixel; 26 | EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *Input; 27 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackgroundBuffer; 28 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *DrawBuffer; 29 | UINT8 *LevelBuffer; 30 | UINTN LevelWidth; 31 | UINTN LevelHeight; 32 | 33 | /** 34 | Entry point for the game. 35 | 36 | @param[in] ImageHandle The firmware allocated handle for the EFI image. 37 | @param[in] SystemTable A pointer to the EFI System Table. 38 | 39 | @retval EFI_SUCCESS The entry point is executed successfully. 40 | @retval other Some error occurs when executing this entry point. 41 | 42 | **/ 43 | EFI_STATUS 44 | EFIAPI 45 | UefiMain ( 46 | IN EFI_HANDLE ImageHandle, 47 | IN EFI_SYSTEM_TABLE *SystemTable 48 | ) 49 | { 50 | EFI_STATUS Status = EFI_SUCCESS; 51 | 52 | gST->ConOut->ClearScreen(gST->ConOut); 53 | gST->ConOut->EnableCursor(gST->ConOut, FALSE); 54 | Print(L"Hello World!\n"); 55 | ZeroMem(&ZeroPixel, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); 56 | 57 | //Get input 58 | Input = (void *)1; 59 | Status = gBS->HandleProtocol(gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **)&Input); 60 | if (EFI_ERROR(Status)) { 61 | ErrorPrint(L"Unable to get gEfiSimpleTextInputExProtocol\n"); 62 | goto Cleanup; 63 | } 64 | 65 | //Get sprites 66 | Status = LoadBMP(L"EFI\\Game\\sprites.bmp", &SpriteSheet, &SpriteSheetHeight, &SpriteSheetWidth, &SpriteSheetSize); 67 | if (EFI_ERROR(Status)) { 68 | ErrorPrint(L"Unable to find sprites.bmp\n"); 69 | goto Cleanup; 70 | } 71 | Status = LoadBMP(L"EFI\\Game\\tiles.bmp", &TileSheet, &TileSheetHeight, &TileSheetWidth, &TileSheetSize); 72 | if (EFI_ERROR(Status)) { 73 | ErrorPrint(L"Unable to find tiles.bmp\n"); 74 | goto Cleanup; 75 | } 76 | 77 | SpriteLength = BMP_TILE_LENGTH; 78 | 79 | //Scale sprites up 80 | ScaleBuffer(&SpriteSheet, &SpriteSheetWidth, &SpriteSheetHeight, SCALE); 81 | ScaleBuffer(&TileSheet, &TileSheetWidth, &TileSheetHeight, SCALE); 82 | SpriteLength *= SCALE; 83 | 84 | InitBackground(); 85 | //Initialize Player 86 | Player *player; 87 | player = AllocatePool(sizeof(player)); 88 | InitializePlayer(player); 89 | 90 | //Setup tick loop 91 | EFI_EVENT TickEvent; 92 | UINTN eventId; 93 | gBS->CreateEvent(EVT_TIMER, 0, NULL, NULL, &TickEvent); 94 | gBS->SetTimer(TickEvent, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS(5)); 95 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *temp; 96 | Print(L"Test"); 97 | IsRunning = TRUE; 98 | while (IsRunning) { 99 | 100 | //Copy Background to DrawBuffer 101 | DrawBuffer = AllocateCopyPool(LevelWidth * SpriteLength * LevelHeight * SpriteLength, BackgroundBuffer); 102 | //Wait for tick 103 | gBS->WaitForEvent(1, &TickEvent, &eventId); 104 | player->tick(player); 105 | ExtractBuffer(DrawBuffer, LevelWidth * SpriteLength, LevelHeight * SpriteLength, 0, 0, &temp, 512, 512); 106 | 107 | player->camera->screen->Blt(player->camera->screen, temp, EfiBltBufferToVideo, 0, 0, 0, 0, 512, 512, 0); 108 | //Free screen and temporary 109 | FreePool(temp); 110 | FreePool(DrawBuffer); 111 | } 112 | Cleanup: 113 | gBS->CloseEvent(TickEvent); 114 | gST->ConOut->EnableCursor(gST->ConOut, TRUE); 115 | if (!EFI_ERROR(Status)) { 116 | gST->ConOut->ClearScreen(gST->ConOut); 117 | } 118 | return Status; 119 | } -------------------------------------------------------------------------------- /Game.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Brief Description of UEFI Game 3 | # 4 | # Detailed Description of UEFI MyWizardDriver 5 | # 6 | # Copyright for UEFI Game 7 | # 8 | # License for UEFI Game 9 | # 10 | ## 11 | 12 | [Defines] 13 | INF_VERSION = 1.25 14 | BASE_NAME = Game 15 | FILE_GUID = e28af586-c434-4005-988b-08a8745cb076 #Copy and paste the GUID from http://www.guidgen.com/ here 16 | MODULE_TYPE = UEFI_APPLICATION 17 | VERSION_STRING = 1.0 18 | ENTRY_POINT = UefiMain 19 | # 20 | # The following information is for reference only and not required by the build tools. 21 | # 22 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC Etc... 23 | # 24 | 25 | [Sources] 26 | Game.c 27 | Actors/Player.c 28 | Globals/Graphics.c 29 | 30 | 31 | [Packages] 32 | MdePkg/MdePkg.dec 33 | MdeModulePkg/MdeModulePkg.dec 34 | ShellPkg/ShellPkg.dec 35 | 36 | [LibraryClasses] 37 | UefiApplicationEntryPoint 38 | UefiLib 39 | FileHandleLib 40 | UefiHiiServicesLib 41 | ShellLib 42 | BmpSupportLib 43 | SafeIntLib 44 | DebugLib 45 | 46 | [Guids] 47 | 48 | [Ppis] 49 | 50 | [Protocols] 51 | gEfiSimpleTextInputExProtocolGuid 52 | 53 | [FeaturePcd] 54 | 55 | [Pcd] -------------------------------------------------------------------------------- /GamePkg.dec: -------------------------------------------------------------------------------- 1 | ## @file ShellPkg.dec 2 | # This Package provides all definitions for EFI and UEFI Shell 3 | # 4 | # (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
5 | # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
6 | # Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
7 | # 8 | # SPDX-License-Identifier: BSD-2-Clause-Patent 9 | # 10 | ## 11 | 12 | [Defines] 13 | DEC_SPECIFICATION = 0x00010005 14 | PACKAGE_NAME = GamePkg 15 | PACKAGE_GUID = 211504a6-dc2d-467c-924a-6ef4a189509f 16 | PACKAGE_VERSION = 1.02 17 | 18 | [Includes] 19 | Include 20 | 21 | [LibraryClasses] 22 | 23 | [Guids] 24 | gHandleParsingHiiGuid = {0xb8969637, 0x81de, 0x43af, {0xbc, 0x9a, 0x24, 0xd9, 0x89, 0x13, 0xf2, 0xf6}} -------------------------------------------------------------------------------- /GamePkg.dsc: -------------------------------------------------------------------------------- 1 | ## @file 2 | # GamePkg 3 | # 4 | # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | PLATFORM_NAME = GamePkg 10 | PLATFORM_GUID = 300cccb9-6467-4d87-bcdc-00e181ae344c 11 | PLATFORM_VERSION = 0.01 12 | DSC_SPECIFICATION = 0x00010006 13 | OUTPUT_DIRECTORY = Build/GamePkg 14 | SUPPORTED_ARCHITECTURES = IA32|X64|ARM|AARCH64 15 | BUILD_TARGETS = DEBUG|RELEASE|NOOPT 16 | SKUID_IDENTIFIER = DEFAULT 17 | 18 | # 19 | # Debug output control 20 | # 21 | DEFINE DEBUG_ENABLE_OUTPUT = FALSE # Set to TRUE to enable debug output 22 | DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x80000040 # Flags to control amount of debug output 23 | DEFINE DEBUG_PROPERTY_MASK = 0 24 | 25 | [PcdsFeatureFlag] 26 | 27 | [PcdsFixedAtBuild] 28 | gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|$(DEBUG_PROPERTY_MASK) 29 | gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL) 30 | 31 | [LibraryClasses] 32 | # 33 | # Entry Point Libraries 34 | # 35 | UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf 36 | ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf 37 | UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf 38 | # 39 | # Common Libraries 40 | # 41 | BaseLib|MdePkg/Library/BaseLib/BaseLib.inf 42 | BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf 43 | UefiLib|MdePkg/Library/UefiLib/UefiLib.inf 44 | PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf 45 | PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf 46 | MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf 47 | UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf 48 | UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf 49 | !if $(DEBUG_ENABLE_OUTPUT) 50 | DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf 51 | DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 52 | !else ## DEBUG_ENABLE_OUTPUT 53 | DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf 54 | !endif ## DEBUG_ENABLE_OUTPUT 55 | 56 | DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf 57 | PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf 58 | IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf 59 | PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf 60 | PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf 61 | SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf 62 | UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf 63 | HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf 64 | UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf 65 | PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf 66 | HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf 67 | FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf 68 | SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf 69 | 70 | ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf 71 | ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf 72 | 73 | CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf 74 | 75 | BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf 76 | SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf 77 | 78 | ################################################################################################### 79 | # 80 | # Components Section - list of the modules and components that will be processed by compilation 81 | # tools and the EDK II tools to generate PE32/PE32+/Coff image files. 82 | # 83 | # Note: The EDK II DSC file is not used to specify how compiled binary images get placed 84 | # into firmware volume images. This section is just a list of modules to compile from 85 | # source into UEFI-compliant binaries. 86 | # It is the FDF file that contains information on combining binary files into firmware 87 | # volume images, whose concept is beyond UEFI and is described in PI specification. 88 | # Binary modules do not need to be listed in this section, as they should be 89 | # specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi), 90 | # Logo (Logo.bmp), and etc. 91 | # There may also be modules listed in this section that are not required in the FDF file, 92 | # When a module listed here is excluded from FDF file, then UEFI-compliant binary will be 93 | # generated for it, but the binary will not be put into any firmware volume. 94 | # 95 | ################################################################################################### 96 | 97 | [Components] 98 | Game.inf -------------------------------------------------------------------------------- /Globals/GameState.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #pragma once 4 | 5 | #define LOCATION_PRECISION 8 6 | #define BMP_TILE_LENGTH 16 7 | #define JUMP_FRAME 3 8 | #define SCALE 2 9 | 10 | extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *Input; 11 | 12 | extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackgroundBuffer; 13 | /// 14 | /// Buffer for each frame 15 | /// 16 | extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL *DrawBuffer; 17 | /// 18 | /// Level represented in tiles 19 | /// 20 | extern UINT8 *LevelBuffer; 21 | extern UINTN LevelWidth; 22 | extern UINTN LevelHeight; 23 | 24 | extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL *SpriteSheet; 25 | extern UINTN SpriteSheetSize; 26 | extern UINTN SpriteSheetHeight; 27 | extern UINTN SpriteSheetWidth; 28 | 29 | extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL *TileSheet; 30 | extern UINTN TileSheetSize; 31 | extern UINTN TileSheetHeight; 32 | extern UINTN TileSheetWidth; 33 | 34 | extern UINTN SpriteLength; 35 | 36 | extern BOOLEAN IsRunning; -------------------------------------------------------------------------------- /Globals/Graphics.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "Globals/GameState.h" 14 | #include "Globals/Graphics.h" 15 | 16 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *SpriteSheet; 17 | UINTN SpriteSheetSize; 18 | UINTN SpriteSheetHeight; 19 | UINTN SpriteSheetWidth; 20 | 21 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *TileSheet; 22 | UINTN TileSheetSize; 23 | UINTN TileSheetHeight; 24 | UINTN TileSheetWidth; 25 | 26 | UINTN SpriteLength; 27 | 28 | EFI_STATUS 29 | GetScreen ( 30 | IN OUT EFI_GRAPHICS_OUTPUT_PROTOCOL **Screen 31 | ) 32 | { //TBA Screen select 33 | EFI_GRAPHICS_OUTPUT_PROTOCOL *Out; 34 | UINTN HandleCount; 35 | EFI_HANDLE* HandleBuffer = NULL; 36 | UINTN i; 37 | EFI_STATUS Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiGraphicsOutputProtocolGuid, NULL, &HandleCount, &HandleBuffer); 38 | if (EFI_ERROR(Status)) { 39 | return EFI_SUCCESS; 40 | } 41 | i = 0; 42 | //for (i = 0; i < HandleCount; i++) { 43 | // Handle protocol 44 | gBS->HandleProtocol(HandleBuffer[i], &gEfiGraphicsOutputProtocolGuid, (VOID **)&Out); 45 | *Screen = Out; 46 | return EFI_SUCCESS; 47 | // } 48 | //return EFI_SUCCESS; 49 | } 50 | 51 | EFI_STATUS 52 | ScaleBuffer( 53 | IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Buffer, 54 | IN OUT UINTN *Width, 55 | IN OUT UINTN *Height, 56 | IN UINTN Scale 57 | ) 58 | { 59 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Out; 60 | UINTN OutWidth; 61 | UINTN OutHeight; 62 | UINTN x; 63 | UINTN y; 64 | 65 | //Allocate more space/get new sizes 66 | OutWidth = *Width * Scale; 67 | OutHeight = *Height * Scale; 68 | Out = AllocatePool (sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * OutWidth * OutHeight); 69 | if (Out == NULL) { 70 | return EFI_OUT_OF_RESOURCES; 71 | } 72 | 73 | for (y = 0; y < OutHeight; y++) { 74 | for (x = 0; x < OutWidth; x++) { 75 | Out[x + y * OutWidth] = (*Buffer)[(x / Scale) + (y / Scale) * *Width]; 76 | } 77 | } 78 | 79 | FreePool(*Buffer); 80 | *Buffer = Out; 81 | *Width = OutWidth; 82 | *Height = OutHeight; 83 | return EFI_SUCCESS; 84 | } 85 | 86 | EFI_STATUS 87 | ExtractBuffer( 88 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Buffer, 89 | IN UINTN SourceWidth, 90 | IN UINTN SourceHeight, 91 | IN UINTN SourceX, 92 | IN UINTN SourceY, 93 | IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **NewBuffer, 94 | IN UINTN Width, 95 | IN UINTN Height 96 | ) 97 | { 98 | UINTN x; 99 | UINTN y; 100 | //Allocate resources 101 | *NewBuffer = AllocatePool(sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * Width * Height); 102 | if (*NewBuffer == NULL) { 103 | return EFI_OUT_OF_RESOURCES; 104 | } 105 | 106 | for (y = 0; y < Height; y++) { 107 | for (x = 0; x < Width; x++) { 108 | (*NewBuffer)[x + y * Width] = Buffer[(x + SourceX) + (y + SourceY) * SourceWidth]; 109 | } 110 | } 111 | return EFI_SUCCESS; 112 | } 113 | 114 | EFI_STATUS 115 | AddToBuffer ( 116 | IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Buffer, 117 | IN UINTN SourceWidth, 118 | IN UINTN SourceHeight, 119 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Addend, 120 | IN UINTN DestinationX, 121 | IN UINTN DestinationY, 122 | IN UINTN Width, 123 | IN UINTN Height, 124 | IN BOOLEAN Transparent 125 | ) 126 | { 127 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL Src; 128 | UINTN x; 129 | UINTN y; 130 | 131 | for (y = 0; y < Height && y + DestinationY < SourceHeight; y++) { 132 | for (x = 0; x < Width && y + DestinationX < SourceHeight; x++) { 133 | Src = Addend[x + y * Width]; 134 | //If (not in transparent mode) and (not a zero pixel), add 135 | if (!(Transparent && CompareMem(&Src, &ZeroPixel, 3) == 0)) { 136 | (*Buffer)[(x + DestinationX) + (y + DestinationY) * SourceWidth] = Src; 137 | } 138 | } 139 | } 140 | return EFI_SUCCESS; 141 | } 142 | 143 | EFI_STATUS 144 | LoadBMP ( 145 | IN CHAR16 *FileName, 146 | OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Buffer, 147 | OUT UINTN *Height, 148 | OUT UINTN *Width, 149 | OUT UINTN *Size 150 | ) 151 | { 152 | EFI_STATUS Status = EFI_SUCCESS; 153 | SHELL_FILE_HANDLE FileHandle; 154 | CHAR16 *FullFileName; 155 | 156 | if (FileName == NULL) { 157 | return EFI_UNSUPPORTED; 158 | } 159 | 160 | FullFileName = ShellFindFilePath(FileName); 161 | if (FullFileName == NULL) { 162 | Status = EFI_NOT_FOUND; 163 | goto Cleanup; 164 | } 165 | Status = ShellOpenFileByName(FullFileName, &FileHandle, EFI_FILE_MODE_READ, 0); 166 | if (EFI_ERROR(Status)) { 167 | goto Cleanup; 168 | } 169 | 170 | ShellSetFilePosition(FileHandle, 0); 171 | EFI_FILE_INFO *FileInfo = ShellGetFileInfo(FileHandle); 172 | 173 | void *File = (void *) 1; //To make BmpSupportLib happy 174 | //UINTN Size = FileInfo->FileSize; 175 | 176 | ShellReadFile(FileHandle, &FileInfo->FileSize, File); 177 | if (EFI_ERROR(Status)) { 178 | goto Cleanup; 179 | } 180 | 181 | *Buffer = 0; 182 | *Height = 0; 183 | *Width = 0; 184 | 185 | Status = TranslateBmpToGopBlt(File, FileInfo->FileSize, Buffer, Size, Height, Width); 186 | if (EFI_ERROR(Status)) { 187 | goto Cleanup; 188 | } 189 | Cleanup: 190 | ShellCloseFile(&FileHandle); 191 | if (FullFileName != NULL) { 192 | FreePool(FullFileName); 193 | } 194 | 195 | return Status; 196 | } 197 | 198 | EFI_STATUS 199 | InitBackground ( 200 | ) 201 | { 202 | EFI_STATUS Status; 203 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *PixelMap; 204 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Tile; 205 | UINTN MapSize; 206 | 207 | Status = LoadBMP(L"EFI\\Game\\map.bmp", &PixelMap, &LevelHeight, &LevelWidth, &MapSize); 208 | if (EFI_ERROR(Status)) { 209 | goto Cleanup; 210 | } 211 | 212 | BackgroundBuffer = AllocatePool(LevelWidth * SpriteLength * LevelHeight * SpriteLength * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); 213 | LevelBuffer = AllocatePool(LevelWidth * LevelHeight * sizeof(UINT8)); 214 | 215 | Tile = AllocatePool(SpriteLength * SpriteLength * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); 216 | for (UINTN i = 0; i < LevelWidth * LevelHeight; i++) { 217 | LevelBuffer[i] = PixelMap[i].Red; 218 | if (PixelMap[i].Red != 0) { 219 | if (PixelMap[i].Red != PixelMap[i - 1].Red) { 220 | if (Tile != NULL) { 221 | FreePool(Tile); 222 | } 223 | ExtractBuffer(TileSheet, 224 | TileSheetWidth, 225 | TileSheetHeight, 226 | (PixelMap[i].Red) * SpriteLength, 227 | 0, 228 | &Tile, 229 | SpriteLength, 230 | SpriteLength 231 | ); 232 | } 233 | AddToBuffer(&BackgroundBuffer, 234 | LevelWidth * SpriteLength, 235 | LevelHeight * SpriteLength, 236 | Tile, 237 | (i % LevelWidth) * SpriteLength, 238 | (i / LevelWidth) * SpriteLength, 239 | SpriteLength, 240 | SpriteLength, 241 | FALSE 242 | ); 243 | } 244 | } 245 | if (Tile != NULL) { 246 | FreePool(Tile); 247 | } 248 | FreePool(PixelMap); 249 | Cleanup: 250 | return Status; 251 | } -------------------------------------------------------------------------------- /Globals/Graphics.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #pragma once 4 | 5 | extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL ZeroPixel; 6 | 7 | EFI_STATUS 8 | GetScreen( 9 | IN OUT EFI_GRAPHICS_OUTPUT_PROTOCOL **Screen 10 | ); 11 | 12 | EFI_STATUS 13 | ScaleBuffer( 14 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Buffer, 15 | IN UINTN *Width, 16 | IN UINTN *Height, 17 | IN UINTN Scale 18 | ); 19 | 20 | EFI_STATUS 21 | AddToBuffer( 22 | IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Buffer, 23 | IN UINTN SourceWidth, 24 | IN UINTN SourceHeight, 25 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Addend, 26 | IN UINTN DestinationX, 27 | IN UINTN DestinationY, 28 | IN UINTN Width, 29 | IN UINTN Height, 30 | IN BOOLEAN Transparent 31 | ); 32 | 33 | EFI_STATUS 34 | ExtractBuffer( 35 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Buffer, 36 | IN UINTN SourceWidth, 37 | IN UINTN SourceHeight, 38 | IN UINTN SourceX, 39 | IN UINTN SourceY, 40 | IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **NewBuffer, 41 | IN UINTN Width, 42 | IN UINTN Height 43 | ); 44 | 45 | 46 | EFI_STATUS 47 | LoadBMP ( 48 | IN CHAR16 *FileName, 49 | OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Buffer, 50 | OUT UINTN *Height, 51 | OUT UINTN *Width, 52 | OUT UINTN *Size 53 | ); 54 | 55 | EFI_STATUS 56 | InitBackground ( 57 | ); -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Iyad Hamid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UefiGame 2 | Bare metal game using EDK2 by [Iyad H](https://github.com/IyadHamid). 3 | To build, clone [edk2](https://github.com/tianocore/edk2.git) and follow build instructions and change the target to GamePkg.dsc. Run using the path [Drive](./Emulated/Drive/EFI) and run it in QEMU or copy it into a USB (FAT32) and run Game.efi through [UEFI Shell](./Emulated/Drive/EFI/Boot/Shell.efi). 4 | 5 | The game loads a a sprite sheet that can easily be changed however the tile size is defined to be 8x8 in the [gamestate](.\Globals\gamestate.h) 6 | 7 | ![sprites.bmp](.\Assets\sprites.bmp "Sprites") 8 | ![tiles.bmp](.\Assets\tiles.bmp "Tiles") 9 | 10 | ## Issues/Goals 11 | |Features|Status| 12 | |:-----------------------|-------| 13 | |Overall|half-functional| 14 | |Collisions|Not tested| 15 | |Level creation|Minimal, undocumented| 16 | |Slopes|not implemented| 17 | |Camera Changes|None| 18 | 19 | ## Changelog (Latest first) 20 | ### v0.1.0 21 | - Used more optimized sensors similar to retro-Sonic 22 | - Made player more similar to a class 23 | - Made 16-bit images 24 | ### v0.0.0 25 | - Added Collisions w/ Gravity 26 | - Changed controller to be less "console-y" 27 | - Modularized LoadBMP 28 | - Found and squashed memory leak 29 | - Made BmpSupportLib happy and no changes in that are necessary --------------------------------------------------------------------------------