1 | /* Copied from 915 resolution created by steve tomljenovic␊ |
2 | *␊ |
3 | * This code is based on the techniques used in :␊ |
4 | *␊ |
5 | * - 855patch. Many thanks to Christian Zietz (czietz gmx net)␊ |
6 | * for demonstrating how to shadow the VBIOS into system RAM␊ |
7 | * and then modify it.␊ |
8 | *␊ |
9 | * - 1280patch by Andrew Tipton (andrewtipton null li).␊ |
10 | *␊ |
11 | * - 855resolution by Alain Poirier␊ |
12 | *␊ |
13 | * This source code is into the public domain.␊ |
14 | */␊ |
15 | ␊ |
16 | #ifndef __915_RESOLUTION_H␊ |
17 | #define __915_RESOLUTION_H␊ |
18 | ␊ |
19 | #include "libsa.h"␊ |
20 | #include "saio_internal.h"␊ |
21 | ␊ |
22 | ␊ |
23 | //#define AUTORES_DEBUG␊ |
24 | ␊ |
25 | #ifndef AUTORES_DEBUG␊ |
26 | #define PRINT(a, b...) verbose(a, ##b); // change to msglog ??␊ |
27 | #else␊ |
28 | #define PRINT(a, b...) printf(a, ##b);␊ |
29 | #endif␊ |
30 | ␊ |
31 | #define __packed __attribute__((packed))␊ |
32 | ␊ |
33 | #define NEW(a) ((a *)(malloc(sizeof(a))))␊ |
34 | #define FREE(a) (free(a))␊ |
35 | ␊ |
36 | #define VBIOS_START 0xc0000␊ |
37 | #define VBIOS_SIZE 0x10000␊ |
38 | ␊ |
39 | //#define false 0 //Azi: (Reviewing...)*****␊ |
40 | //#define true 1␊ |
41 | ␊ |
42 | bool gAutoResolution;␊ |
43 | UInt32 paramsAR[4];␊ |
44 | ␊ |
45 | typedef struct␊ |
46 | {␊ |
47 | ␉uint8_t width;␊ |
48 | ␉uint8_t height;␊ |
49 | } sAspect;␊ |
50 | ␊ |
51 | typedef enum␊ |
52 | {␊ |
53 | ␉CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
54 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
55 | ␉CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
56 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
57 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500␊ |
58 | } chipsetType;␊ |
59 | ␊ |
60 | typedef enum␊ |
61 | {␊ |
62 | ␉BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
63 | } biosType;␊ |
64 | ␊ |
65 | typedef struct␊ |
66 | {␊ |
67 | ␉uint32_t␉clock;␊ |
68 | ␉uint16_t␉x;␊ |
69 | ␉uint16_t␉hSyncStart;␊ |
70 | ␉uint16_t␉hSyncEnd;␊ |
71 | ␉uint16_t␉hTotal;␊ |
72 | ␉uint16_t␉y;␊ |
73 | ␉uint16_t␉vSyncStart;␊ |
74 | ␉uint16_t␉vSyncEnd;␊ |
75 | ␉uint16_t␉vTotal;␊ |
76 | } generic_modeline;␊ |
77 | ␊ |
78 | typedef struct sModeTable_␊ |
79 | {␊ |
80 | ␉uint8_t␉*␉pointer;␊ |
81 | ␉␊ |
82 | ␉uint8_t␉␉id;␊ |
83 | ␉uint32_t␉size;␊ |
84 | ␉uint32_t␉modeCount;␊ |
85 | ␉␊ |
86 | ␉uint8_t *␉backup;␊ |
87 | ␉␊ |
88 | ␉struct sModeTable_ *prev;␊ |
89 | ␉struct sModeTable_ *next;␊ |
90 | } sModeTable;␊ |
91 | ␊ |
92 | typedef struct␊ |
93 | {␊ |
94 | ␉uint32_t chipsetId;␊ |
95 | ␉chipsetType chipset;␊ |
96 | ␉biosType bios;␊ |
97 | ␉␊ |
98 | ␉uint8_t* biosBackupPtr;␊ |
99 | ␉uint8_t* biosPtr;␊ |
100 | ␉␊ |
101 | ␉sModeTable *modeTables;␊ |
102 | ␉␊ |
103 | ␉uint32_t currentX, currentY;␊ |
104 | ␉uint8_t b1, b2;␊ |
105 | ␉␊ |
106 | //␉bool hasSwitched; //Azi:autoresolution - testing␊ |
107 | ␉␊ |
108 | ␉bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);␊ |
109 | ␉␊ |
110 | ␉sAspect aspectRatio;␊ |
111 | ␉␊ |
112 | ␉uint8_t unlocked;␊ |
113 | } vBiosMap;␊ |
114 | ␊ |
115 | vBiosMap *map;␊ |
116 | ␊ |
117 | vBiosMap * openVbios(chipsetType type);␊ |
118 | void closeVbios (vBiosMap* map);␊ |
119 | ␊ |
120 | void unlockVbios(vBiosMap* map);␊ |
121 | void relockVbios(vBiosMap* map);␊ |
122 | ␊ |
123 | void saveVbios(vBiosMap* map);␊ |
124 | void restoreVbios(vBiosMap* map);␊ |
125 | ␊ |
126 | void saveTables(sModeTable * table);␊ |
127 | void restoreTables(vBiosMap * map, sModeTable * table);␊ |
128 | ␊ |
129 | void gtfTimings(uint32_t x, uint32_t y, uint32_t freq,␊ |
130 | ␉␉␉␉ uint32_t *clock,␊ |
131 | ␉␉␉␉ uint16_t *hSyncStart, uint16_t *hSyncEnd, uint16_t *hBlank,␊ |
132 | ␉␉␉␉ uint16_t *vSyncStart, uint16_t *vSyncEnd, uint16_t *vBlank);␊ |
133 | ␊ |
134 | sModeTable * intializeTables(vBiosMap * map, int tablesCount);␊ |
135 | ␊ |
136 | void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);␊ |
137 | ␊ |
138 | #endif␊ |
139 | |