Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/trunkAutoResolution/i386/libsaio/autoresolution.h

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
42bool gAutoResolution;
43UInt32 paramsAR[4];
44
45typedef struct
46{
47uint8_t width;
48uint8_t height;
49} sAspect;
50
51typedef enum
52{
53CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G,
54CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ,
55CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X,
56CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,
57CT_GM45, CT_G41, CT_G31, CT_G45, CT_500
58} chipsetType;
59
60typedef enum
61{
62BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA
63} biosType;
64
65typedef struct
66{
67uint32_tclock;
68uint16_tx;
69uint16_thSyncStart;
70uint16_thSyncEnd;
71uint16_thTotal;
72uint16_ty;
73uint16_tvSyncStart;
74uint16_tvSyncEnd;
75uint16_tvTotal;
76} generic_modeline;
77
78typedef struct sModeTable_
79{
80uint8_t*pointer;
81
82uint8_tid;
83uint32_tsize;
84uint32_tmodeCount;
85
86uint8_t *backup;
87
88struct sModeTable_ *prev;
89struct sModeTable_ *next;
90} sModeTable;
91
92typedef struct
93{
94uint32_t chipsetId;
95chipsetType chipset;
96biosType bios;
97
98uint8_t* biosBackupPtr;
99uint8_t* biosPtr;
100
101sModeTable *modeTables;
102
103uint32_t currentX, currentY;
104uint8_t b1, b2;
105
106//bool hasSwitched; //Azi:autoresolution - testing
107
108bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);
109
110sAspect aspectRatio;
111
112uint8_t unlocked;
113} vBiosMap;
114
115vBiosMap *map;
116
117vBiosMap * openVbios(chipsetType type);
118void closeVbios (vBiosMap* map);
119
120void unlockVbios(vBiosMap* map);
121void relockVbios(vBiosMap* map);
122
123void saveVbios(vBiosMap* map);
124void restoreVbios(vBiosMap* map);
125
126void saveTables(sModeTable * table);
127void restoreTables(vBiosMap * map, sModeTable * table);
128
129void 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
134sModeTable * intializeTables(vBiosMap * map, int tablesCount);
135
136void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);
137
138#endif
139

Archive Download this file

Revision: 946