PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
osd.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Licenced under Academic Free License version 2.0
7# Review ps2sdk README & LICENSE files for further details.
8*/
9
10#include <tamtypes.h>
11#include <osd_config.h>
12
13#include "osd.h"
14
15extern SystemConfiguration_t SystemConfiguration;
16
17void InitSystemConfig(SystemConfiguration_t *SysConf, int SysConfLen)
18{
19 unsigned int SysConfRegAddr;
20 vu8 *ptr;
21
22 if ((SysConfRegAddr = *(vu32 *)0xbc0003c0) != 0) {
23 unsigned int i;
24 ptr = (vu8 *)(0xbc000000 + SysConfRegAddr + 0xF);
25
26 for (i = 0; i < SysConfLen; i++)
27 SysConf->data[i] = ptr[i];
28 }
29
30 if ((SysConf->EEGS >> 6 & 7) == 0) {
31 SysConf->EEGS &= 0xFFFF02FFFFFFFFFF;
32 }
33}
34
35static ConfigParam OSDConfig;
36
37void SetOsdConfigParam(ConfigParam *config)
38{
39 OSDConfig.spdifMode = config->spdifMode;
40 OSDConfig.screenType = config->screenType;
41 OSDConfig.videoOutput = config->videoOutput;
42 OSDConfig.japLanguage = config->japLanguage;
43 OSDConfig.ps1drvConfig = config->ps1drvConfig;
44 OSDConfig.version = config->version;
45 OSDConfig.language = config->language;
46 OSDConfig.timezoneOffset = config->timezoneOffset;
47}
48
49void GetOsdConfigParam(ConfigParam *config)
50{
51 config->spdifMode = OSDConfig.spdifMode;
52 config->screenType = OSDConfig.screenType;
53 config->videoOutput = OSDConfig.videoOutput;
54 config->japLanguage = OSDConfig.japLanguage;
55 config->ps1drvConfig = OSDConfig.ps1drvConfig;
56 config->version = OSDConfig.version;
57 config->language = OSDConfig.language;
58 config->timezoneOffset = OSDConfig.timezoneOffset;
59}
60
61static u8 OSDConfig2[128];
62
63void SetOsdConfigParam2(void *config, int size, int offset)
64{
65 unsigned int WriteEnd, i;
66 u8 *ptr;
67
68 ptr = config;
69 if ((WriteEnd = offset + size) >= 0x81) {
70 unsigned int AmountToWrite;
71 if (offset < 0x80) {
72 AmountToWrite = 0x80 - offset;
73 } else {
74 offset = 0x80;
75 AmountToWrite = 0;
76 }
77
78 WriteEnd = AmountToWrite + offset;
79 }
80
81 for (i = 0; offset < WriteEnd; i++, offset++) {
82 OSDConfig2[offset] = ptr[i];
83 }
84}
85
86int GetOsdConfigParam2(void *config, int size, int offset)
87{
88 unsigned int AmountToRead, ReadEnd, i;
89 u8 *ptr;
90
91 ptr = config;
92 if ((ReadEnd = offset + size) >= 0x81) {
93 if (offset < 0x80) {
94 AmountToRead = 0x80 - offset;
95 } else {
96 offset = 0x80;
97 AmountToRead = 0;
98 }
99 } else
100 AmountToRead = size;
101
102 ReadEnd = AmountToRead + offset;
103 for (i = 0; offset < ReadEnd; i++, offset++) {
104 ptr[i] = OSDConfig2[offset];
105 }
106
107 return (((SystemConfiguration.EEGS >> 6 & 7) != 0) ? (SystemConfiguration.EEGS >> 44 & 0xF) : 0);
108}
u32 ps1drvConfig
Definition osd_config.h:93
u32 timezoneOffset
Definition osd_config.h:99
u32 videoOutput
Definition osd_config.h:89
u32 japLanguage
Definition osd_config.h:91