Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
splash.c
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2024 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
28
29#include <stdint.h>
30
31#include "common/hardware/gpu.h"
33
34#ifndef OPENBIOS_H2X00_MONITOR
35static const union Color s_colors[] = {{.r = 255, .g = 255, .b = 255}, {.r = 255, .g = 255, .b = 0},
36 {.r = 0, .g = 255, .b = 255}, {.r = 0, .g = 255, .b = 0},
37 {.r = 255, .g = 0, .b = 255}, {.r = 255, .g = 0, .b = 0},
38 {.r = 0, .g = 0, .b = 255}, {.r = 0, .g = 0, .b = 0}};
39#else
40static const union Color s_colors[] = {{.r = 0, .g = 0, .b = 0}, {.r = 0, .g = 0, .b = 255},
41 {.r = 255, .g = 0, .b = 0}, {.r = 255, .g = 0, .b = 255},
42 {.r = 0, .g = 255, .b = 0}, {.r = 0, .g = 255, .b = 255},
43 {.r = 255, .g = 255, .b = 0}, {.r = 255, .g = 255, .b = 255}};
44#endif
45
46// The original version of this function (as found in the 573 BIOS) invokes a
47// subroutine repeatedly in order to draw each color bar, rather than using an
48// array and a loop, and has several completely unnecessary checks. This is a
49// much simpler and more straightforward but functionally equivalent
50// implementation.
52#ifdef OPENBIOS_SHOW_SPLASH_SCREEN
53 struct DisplayModeConfig config = {.hResolution = HR_256,
54 .vResolution = VR_240,
55 .videoMode = VM_NTSC,
56 .colorDepth = CD_15BITS,
57 .videoInterlace = VI_OFF,
58 .hResolutionExtended = HRE_NORMAL};
59
60 GPU_STATUS = 0x00000000; // Reset
61 setDisplayArea(0, 0);
62 setHorizontalRange(0, 256 * 10);
63 setVerticalRange(16, 255);
64 setDisplayMode(&config);
65
66 const int barCount = sizeof(s_colors) / sizeof(union Color);
67 struct FastFill ff = {.c = 0, .x = 0, .y = 0, .w = 256 / barCount, .h = 240};
68
69 for (int i = 0; i < barCount; i++, ff.x += ff.w) {
70 ff.c.packed = s_colors[i].packed;
71 fastFill(&ff);
72 }
73
74 waitGPU();
75 enableDisplay();
76#endif
77}
@ VM_NTSC
Definition gpu.h:47
@ HRE_NORMAL
Definition gpu.h:62
@ VR_240
Definition gpu.h:42
@ HR_256
Definition gpu.h:35
@ VI_OFF
Definition gpu.h:57
@ CD_15BITS
Definition gpu.h:52
int i
Definition gte-regio.c:299
#define GPU_STATUS
Definition hwregs.h:53
void drawSplashScreen()
Definition splash.c:51
Definition gpu.h:66
enum HResolution hResolution
Definition gpu.h:67
Definition gpu.h:116
union Color c
Definition gpu.h:117
int16_t w
Definition gpu.h:118
int16_t x
Definition gpu.h:118
Definition gpu.h:109
uint32_t packed
Definition gpu.h:113
uint8_t r
Definition gpu.h:111