Chameleon

Chameleon Commit Details

Date:2011-06-23 16:12:42 (12 years 9 months ago)
Author:Evan Lojewski
Commit:1034
Parents: 1033
Message:Reintroduce getc -> getchar change. Integrate text mode + gui mode interface again. Issue 83 shoudl be fixed with the changes. Blargh... mb:ea1a6e27-86d1-4e62-a26e-e3707a3697d4
Changes:
M/trunk/i386/libsaio/console.c
M/trunk/i386/boot2/resume.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsa/libsa.h
M/trunk/i386/boot2/modules.c
M/trunk/i386/boot2/boot.h
M/trunk/i386/modules/HelloWorld/HelloWorld.cpp
M/trunk/i386/libsa/string.c
M/trunk/i386/libsaio/load.c
M/trunk/i386/libsaio/biosfn.c
M/trunk/i386/libsaio/acpi_patcher.c
M/trunk/i386/util/fdisk/misc.c
M/trunk/i386/boot2/gui.c
M/trunk/i386/libsaio/disk.c
M/trunk/i386/libsaio/saio_internal.h
M/trunk/i386/boot2/gui.h
M/trunk/i386/boot2/ramdisk.c
M/trunk/i386/boot2/options.c
M/trunk/i386/boot2/Makefile
M/trunk/i386/libsaio/xml.c
M/trunk/i386/libsaio/hpet.c

File differences

trunk/i386/libsaio/xml.c
355355
356356
357357
358
358
359359
360360
361361
......
380380
381381
382382
383
383
384384
385385
386386
......
423423
424424
425425
426
426
427427
428428
429429
......
448448
449449
450450
451
451
452452
453453
454454
......
669669
670670
671671
672
672
673673
674674
675675
......
710710
711711
712712
713
713
714714
715715
716716
......
731731
732732
733733
734
734
735735
736736
737737
......
771771
772772
773773
774
774
775775
776776
777777
......
803803
804804
805805
806
806
807807
808808
809809
else
{
printf("ParseStringID error (0x%x)\n", *val);
getc(); //Azi: getchar();
getchar();
return -1;
}
}
else
{
printf("ParseStringIDREF error (0x%x)\n", *val);
getc(); //Azi: getchar();
getchar();
return -1;
}
}
else
{
printf("ParseIntegerID error (0x%x)\n", *val);
getc(); //Azi: getchar();
getchar();
return -1;
}
}
else
{
printf("ParseStringIDREF error (0x%x)\n", *val);
getc(); //Azi: getchar();
getchar();
return -1;
}
}
if(buffer[0] == '<')
{
printf("Warning integer is non existant\n");
getc(); //Azi: getchar();
getchar();
tmpTag = NewTag();
tmpTag->type = kTagTypeInteger;
tmpTag->string = 0;
else
{
printf("ParseTagInteger hex error (0x%x) in buffer %s\n", *val, buffer);
getc(); //Azi: getchar();
getchar();
return -1;
}
}
if (*val < '0' || *val > '9')
{
printf("ParseTagInteger decimal error (0x%x) in buffer %s\n", *val, buffer);
getc(); //Azi: getchar();
getchar();
return -1;
}
//printf("ParseTagData unimplimented\n");
//printf("Data: %s\n", buffer);
//getc(); //Azi: getchar();
//getchar();
// TODO: base64 decode
if (tmpTag == 0) return -1;
printf("ParseTagDate unimplimented\n");
getc(); //Azi: getchar();
getchar();
tmpTag->type = kTagTypeDate;
tmpTag->string = 0;
trunk/i386/libsaio/console.c
158158
159159
160160
161
161
162162
163163
164164
165
165
166166
167
167
168168
169169
170170
......
263263
264264
265265
266
267
266
267
268268
// Read and echo a character from console. This doesn't echo backspace
// since that screws up higher level handling
int getchar() //Azi: study!!!
int getchar()
{
register int c = getc();
if ( c == '\r' ) c = '\n'; //Azi: CR/LF ??
//if ( c == '\r' ) c = '\n';
if ( c >= ' ' && c < 0x7f) putchar(c); //Azi: check gui.h - kReturnKey, etc...
//if ( c >= ' ' && c < 0x7f) putchar(c);
return (c);
}
void pause()
{
printf("Press a key to continue...\n");
getc(); //getchar(); //Azi: getc works here because the function is up above.
// replace get/getchar by pause() ??
getchar(); //getc(); //Azi: getc works here because the function is up above; changed for now.
// replace getchar() by pause() ??
}
trunk/i386/libsaio/acpi_patcher.c
10581058
10591059
10601060
1061
1061
10621062
10631063
10641064
}
#if DEBUG_ACPI
printf("Press a key to continue... (DEBUG_ACPI)\n");
getc(); //Azi: getchar();
getchar();
#endif
return 1;
}
trunk/i386/libsaio/load.c
135135
136136
137137
138
138
139139
140140
141141
......
219219
220220
221221
222
222
223223
224224
225225
......
239239
240240
241241
242
242
243243
244244
245245
......
317317
318318
319319
320
320
321321
322322
323323
printf("ncmds: %x\n", (unsigned)mH->ncmds);
printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds);
printf("flags: %x\n", (unsigned)mH->flags);
getc(); //Azi: getchar();;
getchar();
#endif
ncmds = mH->ncmds;
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCmd->nsects, (unsigned)segCmd->flags);
getc(); //Azi: getchar();
getchar();
#endif
}
else
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCmd->nsects, (unsigned)segCmd->flags);
getc(); //Azi: getchar();
getchar();
#endif
}
#if DEBUG
printf("symoff: %x, nsyms: %x, stroff: %x, strsize: %x\n",
symTab->symoff, symTab->nsyms, symTab->stroff, symTab->strsize);
getc(); //Azi: getchar();
getchar();
#endif
symsSize = symTab->stroff - symTab->symoff;
trunk/i386/libsaio/disk.c
16361636
16371637
16381638
1639
1639
16401640
16411641
16421642
printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible);
}
printf("count: %d\n", bvCount);
getc(); //Azi: getchar();
getchar();
#endif
*count = bvCount;
trunk/i386/libsaio/hpet.c
9898
9999
100100
101
101
102102
103103
#if DEBUG_HPET
printf("Press [Enter] to continue...\n");
getc(); //Azi: getchar();
getchar();
#endif
}
trunk/i386/libsaio/biosfn.c
185185
186186
187187
188
188
189189
190190
191191
......
252252
253253
254254
255
255
256256
257257
258
258
259259
260260
261261
......
509509
510510
511511
512
513
512
514513
515514
516515
......
676675
677676
678677
679
680
678
681679
682680
683681
// Some BIOSes will simply ignore the value of ECX on entry.
// Probably best to keep its value at 20 to avoid surprises.
//printf("Get memory map 0x%x, %d\n", rangeArray); getc(); //Azi: getchar();
//printf("Get memory map 0x%x, %d\n", rangeArray); getchar();
if (maxRangeCount > (BIOS_LEN / sizeof(MemoryRange))) {
maxRangeCount = (BIOS_LEN / sizeof(MemoryRange));
}
#if DEBUG
{
int i;
printf("%d total ranges\n", count); getc(); //Azi: getchar();
printf("%d total ranges\n", count); getchar();
for (i=0, range = rangeArray; i<count; i++, range++) {
printf("range: type %d, base 0x%x, length 0x%x\n",
range->type, (unsigned int)range->base, (unsigned int)range->length); getc(); //Azi: getchar();
range->type, (unsigned int)range->base, (unsigned int)range->length); getchar();
}
}
#endif
printf("media_type: %x\n", pkt.media_type);
printf("drive_num: %x\n", pkt.drive_num);
printf("device_spec: %x\n", pkt.device_spec);
//printf("press a key->\n"); getc(); //Azi: getchar();
pause();
printf("press a key->\n"); getchar();
#endif
/* Some BIOSes erroneously return cf = 1 */
print_drive_info(di);
printf("uses_ebios = 0x%x\n", dp->uses_ebios);
printf("result %d\n", ret);
//printf("press a key->\n"); getc(); //Azi: getchar();
pause();
printf("press a key->\n"); getchar();
#endif
if (ret == 0) {
trunk/i386/libsaio/saio_internal.h
4949
5050
5151
52
53
52
5453
5554
5655
extern int ebiosEjectMedia(int biosdev);
extern void bios_putchar(int ch);
extern void putca(int ch, int attr, int repeat);
extern int getc(void); //Azi: getchar();
extern void pause(); //Azi: replace getc/getchar with ? console.c - btw, what is it doing here ?? there's a console.c section below...
extern void pause();
extern int readKeyboardStatus(void);
extern int readKeyboardShiftFlags(void);
extern unsigned int time18(void);
trunk/i386/boot2/Makefile
125125
126126
127127
128
128
129129
130130
131131
endif
@# this is done in a sub process after boot.sys exists so the strings are populated correctly
# this is done in a sub process after boot.sys exists so the strings are populated correctly
@make embed_symbols
@${RM} $(SYMROOT)/boot2.sys
trunk/i386/boot2/resume.c
119119
120120
121121
122
122
123123
124124
125125
......
143143
144144
145145
146
146
147147
148148
149149
printf ("Resuming from Encrypted image is unsupported.\n"
"Uncheck \"Use secure virtual memory\" in \"Security\" pane on system preferences.\n"
"Press any key to proceed with normal boot.\n");
getc(); //Azi: getchar();
getchar ();
return;
}
// depends on NVRAM
if (!((long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000))
{
printf ("Not enough space to restore image. Press any key to proceed with normal boot.\n");
getc(); //Azi: getchar();
getchar ();
return;
}
trunk/i386/boot2/boot.c
185185
186186
187187
188
188
189189
190190
191191
......
350350
351351
352352
353
353
354354
355355
356356
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
printf("Press any key to continue...");
getc(); //Azi: getchar();
getchar();
}
usb_loop();
#if DEBUG
printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
getc(); //Azi: getchar();
getchar();
#endif
useGUI = true;
trunk/i386/boot2/boot.h
9898
9999
100100
101
102
101
102
103103
104104
105105
#define kUseNvidiaROM"UseNvidiaROM"/* nvidia.c */
#define kVBIOS"VBIOS"/* nvidia.c */
#define kdcfg0"display_0"/* nvidia.c */
#define kdcfg1"display_1"/* nvidia.c */
#define kdcfg0 "display_0"/* nvidia.c */
#define kdcfg1 "display_1"/* nvidia.c */
#define kEthernetBuiltIn"EthernetBuiltIn"/* pci_setup.c */
#define kGraphicsEnabler"GraphicsEnabler"/* pci_setup.c */
trunk/i386/boot2/modules.c
1616
1717
1818
19
19
2020
2121
2222
......
8686
8787
8888
89
89
9090
9191
9292
......
185185
186186
187187
188
188
189189
190190
191191
......
304304
305305
306306
307
307
308308
309309
310310
......
370370
371371
372372
373
373
374374
375375
376376
......
379379
380380
381381
382
382
383383
384384
385385
......
891891
892892
893893
894
894
895895
896896
897897
......
910910
911911
912912
913
913
914914
915915
916916
......
928928
929929
930930
931
931
932932
933933
934934
......
953953
954954
955955
956
956
957957
958958
959959
......
10851085
10861086
10871087
1088
1088
10891089
10901090
10911091
......
11331133
11341134
11351135
1136
1136
11371137
11381138
11391139
#if CONFIG_MODULE_DEBUG
#define DBG(x...)printf(x);
#define DBGPAUSE()getc() // getchar();
#define DBGPAUSE()getchar()
#else
#define DBG(x...)
#define DBGPAUSE()
else
{
// The module does not have a valid start function
printf("Unable to start %s\n", SYMBOLS_MODULE); getc(); //Azi: getchar();
printf("Unable to start %s\n", SYMBOLS_MODULE); getchar();
}
}
}
else // The module does not have a valid start function. This may be a library.
{
printf("WARNING: Unable to start %s\n", module);
getc(); //Azi: getchar();
getchar();
}
#else
else msglog("WARNING: Unable to start %s\n", module);
#if CONFIG_MODULE_DEBUG
printf("Unable to locate symbol %s\n", name);
getc(); //Azi: getchar();
getchar();
#endif
if(strcmp(name, VOID_SYMBOL) == 0) return 0xFFFFFFFF;
else
{
verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic);
//getc(); //Azi: getchar();
//getchar();
return NULL;
}
/*if(((struct mach_header*)binary)->filetype != MH_DYLIB)
{
printf("Module is not a dylib. Unable to load.\n");
getc(); //Azi: getchar();
getchar();
return NULL; // Module is in the incorrect format
}*/
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
segmentAddress += sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
segmentAddress += tmp + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
segmentAddress += (immediate * sizeof(void*)) + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
break;
}
#if CONFIG_MODULE_DEBUG
//print_hook_list();
//getc(); //Azi: getchar();
//getchar();
#endif
}
void dyld_stub_binder()
{
printf("ERROR: dyld_stub_binder was called, should have been take care of by the linker.\n");
getc(); //Azi: getchar();
getchar();
}
#else /* CONFIG_MODULES */
trunk/i386/boot2/gui.c
142142
143143
144144
145
146
145
146
147147
148
149
150148
151149
152150
......
912910
913911
914912
915
916
913
914
917915
918916
919917
......
927925
928926
929927
930
928
931929
932
933
934
935
936
937
938
939
940
941930
942931
943932
......
949938
950939
951940
952
953
954
955941
956
957
958
959
960
961
942
962943
963944
964945
......
15821563
15831564
15841565
1585
1566
15861567
15871568
15881569
extern MenuItem *menuItems;
char prompt[BOOT_STRING_LEN];
//extern char gBootArgs[BOOT_STRING_LEN]; //Azi: getchar/prompt stuff
//char prompt[BOOT_STRING_LEN];
extern char gBootArgs[BOOT_STRING_LEN];
int prompt_pos = 0;
char prompt_text[] = "boot: ";
menuitem_t infoMenuItems[] =
void clearGraphicBootPrompt()
{
// clear text buffer
prompt[0] = '\0'; //Azi: getchar/prompt stuff
prompt_pos=0;
//prompt[0] = '\0';
//prompt_pos=0;
if(gui.bootprompt.draw == true )
return;
}
void updateGraphicBootPrompt(int key)
void updateGraphicBootPrompt()
{
if ( key == kBackspaceKey ) //Azi: getchar/prompt stuff
prompt[--prompt_pos] = '\0';
else
{
prompt[prompt_pos] = key;
prompt_pos++;
prompt[prompt_pos] = '\0';
}
fillPixmapWithColor( gui.bootprompt.pixmap, gui.bootprompt.bgcolor);
makeRoundedCorners( gui.bootprompt.pixmap);
// get the position of the end of the boot prompt text to display user input
position_t p_prompt = pos( p_text.x + ( ( strlen(prompt_text) ) * font_console.chars[0]->width ), p_text.y );
//Azi: getchar/prompt stuff
// calculate the position of the cursor
intoffset = ( prompt_pos - ( ( gui.bootprompt.width / font_console.chars[0]->width ) - strlen(prompt_text) - 2 ) );
if ( offset < 0)
offset = 0;
drawStr( prompt+offset, &font_console, gui.bootprompt.pixmap, p_prompt);
// end
drawStr( prompt + offset, &font_console, gui.bootprompt.pixmap, p_prompt);
drawStr( gBootArgs, &font_console, gui.bootprompt.pixmap, p_prompt);
gui.menu.draw = false;
gui.bootprompt.draw = true;
updateVRAM();
key = getc(); //Azi: getchar();
key = getchar();
if( key == kUpArrowkey )
if( currentline > 0 )
trunk/i386/boot2/gui.h
11
2
3
2
3
44
5
6
7
5
6
7
88
99
1010
......
1919
2020
2121
22
22
2323
2424
2525
26
26
2727
2828
29
30
29
30
3131
32
33
34
32
33
34
3535
3636
3737
38
38
3939
4040
4141
4242
43
44
45
46
43
44
45
46
4747
48
49
50
48
49
50
5151
5252
5353
......
151151
152152
153153
154
154
155155
156156
157157
/*
*gui.h
*
* gui.h
*
*
*Created by Jasmin Fazlic on 18.12.08.
*Copyright 2008/09 Jasmin Fazlic All rights reserved.
*Copyright 2008/09 iNDi All rights reserved.
* Created by Jasmin Fazlic on 18.12.08.
* Copyright 2008/09 Jasmin Fazlic All rights reserved.
* Copyright 2008/09 iNDi All rights reserved.
*
*/
#define CHARACTERS_COUNT223
#define BOOT_NORMAL0
#define BOOT_NORMAL0
#define BOOT_VERBOSE1
#define BOOT_IGNORECACHE2
#define BOOT_SINGLEUSER3
#define DO_NOT_BOOT4
#define DO_NOT_BOOT4
#define CLOSE_INFO_MENU5
#define INFOMENU_NATIVEBOOT_START1
#define INFOMENU_NATIVEBOOT_END3
#define INFOMENU_NATIVEBOOT_START 1
#define INFOMENU_NATIVEBOOT_END3
#define MENU_SHOW_MEMORY_INFO4
#define MENU_SHOW_VIDEO_INFO5
#define MENU_SHOW_HELP6
#define MENU_SHOW_MEMORY_INFO4
#define MENU_SHOW_VIDEO_INFO5
#define MENU_SHOW_HELP6
enum {
HorizontalLayout= 0,
VerticalLayout= 1
VerticalLayout= 1,
};
enum {
kBackspaceKey= 0x08,
kTabKey= 0x09,
kReturnKey= 0x0d, // '\n', //Azi: r926
kEscapeKey= 0x1b,
kUpArrowkey= 0x4800,
kTabKey= 0x09,
kReturnKey= '\r',
kEscapeKey= 0x1b,
kUpArrowkey= 0x4800,
kDownArrowkey= 0x5000,
kASCIIKeyMask= 0x7f, //Azi: getchar()***
kF5Key= 0x3f00,
kF10Key= 0x4400
kASCIIKeyMask= 0x7f,
kF5Key= 0x3f00,
kF10Key= 0x4400
};
/*
void showGraphicBootPrompt();
void clearGraphicBootPrompt();
void updateGraphicBootPrompt(int key);
void updateGraphicBootPrompt();
void updateVRAM();
trunk/i386/boot2/ramdisk.c
290290
291291
292292
293
293
294294
295295
296296
......
303303
304304
305305
306
306
307307
308308
309309
setCursorPosition(0, 0, 1);
showInfoRAMDisk();
printf("\n\nPress any key to continue.\n");
getc(); //Azi: getchar();
getchar();
setActiveDisplayPage(0);
}
else
printf("\n?rd m <filename> - mount ramdisk image\n?rd u - unmount ramdisk image");
printf("\n?rd e - enable bt(0,0) alias\n?rd d - disable bt(0,0) alias");
printf("\n\nPress any key to continue.\n");
getc(); //Azi: getchar();
getchar();
setActiveDisplayPage(0);
}
}
trunk/i386/boot2/options.c
156156
157157
158158
159
159
160160
161161
162162
......
172172
173173
174174
175
176
175
177176
178177
179178
......
184183
185184
186185
187
186
188187
189188
190189
......
206205
207206
208207
209
210
208
211209
212210
213211
214212
215
213
216214
217215
218216
......
220218
221219
222220
223
221
224222
225223
226224
227
228
229
225
226
230227
231228
232229
......
240237
241238
242239
243
240
244241
245242
246243
244
245
247246
248247
249248
250249
251250
252251
253
254
252
253
255254
256255
257256
258257
259
260
261
262
263
264
265
258
259
260
261
262
263
266264
267265
268266
269267
270268
271
272
273
274
275
276
269
270
271
272
277273
278
274
279275
280276
281277
......
348344
349345
350346
351
347
352348
353349
354350
......
385381
386382
387383
388
384
389385
390386
391387
......
702698
703699
704700
705
701
706702
707703
708704
......
870866
871867
872868
873
869
874870
875871
876872
......
911907
912908
913909
914
910
915911
916912
917913
918914
919915
920
916
921917
922918
923919
......
948944
949945
950946
951
947
952948
953949
954950
955951
956952
957
953
958954
959955
960956
......
10091005
10101006
10111007
1012
1008
10131009
10141010
10151011
......
10381034
10391035
10401036
1037
10411038
10421039
10431040
......
13461343
13471344
13481345
1349
1346
13501347
13511348
13521349
......
13891386
13901387
13911388
1392
1389
13931390
13941391
13951392
......
14091406
14101407
14111408
1412
1409
14131410
14141411
14151412
......
14561453
14571454
14581455
1459
1456
14601457
14611458
14621459
......
15071504
15081505
15091506
1510
1507
15111508
15121509
15131510
}
}
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) );
gui.redraw = true;
//==========================================================================
//char gBootArgs[BOOT_STRING_LEN];
static char gBootArgs[BOOT_STRING_LEN];
char gBootArgs[BOOT_STRING_LEN];
static char * gBootArgsPtr = gBootArgs;
static char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
static char booterCommand[BOOT_STRING_LEN];
gBootArgsPtr = gBootArgs;
memset(gBootArgs, '\0', BOOT_STRING_LEN);
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
clearGraphicBootPrompt();
}
}
extern char bootPrompt[];
extern char bootRescanPrompt[];
if ( bootArgs->Video.v_display == VGA_TEXT_MODE ) {
//Azi: getchar/prompt stuff
if( bootArgs->Video.v_display == VGA_TEXT_MODE ) {
changeCursor( 0, row, kCursorTypeUnderline, 0 );
clearScreenRows( row, kScreenLastRow );
}
clearBootArgs();
//clearBootArgs();
if (visible) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
printf( bootRescanPrompt );
} else {
printf( bootPrompt );
// printf( gBootArgs );
printf( gBootArgs );
}
}
} else {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
clearGraphicBootPrompt();
// End
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
//clearGraphicBootPrompt();
} else {
printf("Press Enter to start up the foreign OS. ");
}
key &= kASCIIKeyMask;
switch ( key )
{
{
case kBackspaceKey:
if ( gBootArgsPtr > gBootArgs )
{
*--gBootArgsPtr = '\0';
int x, y, t;
getCursorPositionAndType( &x, &y, &t );
if ( x == 0 && y )
{
x = 80; y--;
}
if (x)
x--;
if (x) x--;
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
//Azi: getchar/prompt stuff
} else
updateGraphicBootPrompt(kBackspaceKey);
*gBootArgsPtr-- = '\0';
}
}
else
{
updateGraphicBootPrompt();
}
}
break;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
putchar(key); // echo to screen
else
updateGraphicBootPrompt(key);
*gBootArgsPtr++ = key;
// end
*gBootArgsPtr++ = key;
if( bootArgs->Video.v_display != VGA_TEXT_MODE ) updateGraphicBootPrompt();
else if ( key >= ' ' && key < 0x7f) putchar(key);
}
break;
}
}
// Draw the visible items.
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
drawDeviceList(gMenuStart, gMenuEnd, gMenuSelection);
if ( gMenuItems == NULL )
return 0;
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
int res;
}
// ensure we're in graphics mode if gui is setup
if (gui.initialised && bootArgs->Video.v_display == VGA_TEXT_MODE)
if (firstRun && gui.initialised && bootArgs->Video.v_display == VGA_TEXT_MODE)
{
setVideoMode(GRAPHICS_MODE, 0);
}
}
}
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
// redraw the background buffer
gui.logo.draw = true;
drawBackground();
showBootPrompt( nextRow, showPrompt );
do {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
// redraw background
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
// reset cursor co-ords
gui.debug.cursor = pos( gui.screen.width - 160 , 10 );
}
key = getc(); //Azi: getchar();
key = getchar();
updateMenu( key, (void **) &menuBVR );
newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
* TODO: this needs to be refactored.
*/
if (strcmp( booterCommand, "video" ) == 0) {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
showInfoBox(getVBEInfoString(), getVBEModeInfoString());
} else {
printVBEModeInfo();
}
} else if ( strcmp( booterCommand, "memory" ) == 0) {
if (bootArgs->Video.v_display == GRAPHICS_MODE ) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE ) {
showInfoBox("Memory Map", getMemoryInfoString());
} else {
printMemoryInfo();
// Switch between text & graphic interfaces
// Only Permitted if started in graphics interface
if (useGUI) {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
setVideoMode(VGA_TEXT_MODE, 0);
setCursorPosition(0, 0, 0);
gui.redraw = true;
setVideoMode(GRAPHICS_MODE, 0);
updateVRAM();
updateGraphicBootPrompt();
}
}
key = 0;
intline_offset;
intc;
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
showInfoBox( "Press q to quit\n",buf );
return;
}
printf("[Type %s%sq to quit viewer]", (line_offset > 0) ? "p for previous page, " : "", (*bp != '\1') ? "space for next page, " : "");
}
c = getc(); //Azi: getchar();
c = getchar();
if (c == 'q' || c == 'Q') {
break;
}
void showHelp(void)
{
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
showInfoBox("Help. Press q to quit.\n", (char *)BootHelp_txt);
} else {
showTextBuffer((char *)BootHelp_txt, BootHelp_txt_len);
printf("Typical boot devices are 80 (First HD), 81 (Second HD)\n");
printf("Enter two-digit hexadecimal boot device [%02x]: ", bootdevice);
do {
key = getc(); //Azi: getchar();
key = getchar();
switch (key & kASCIIKeyMask) {
case kBackspaceKey:
if (digitsI > 0) {
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
if (getc() == kReturnKey) { //Azi: getchar();
if (getchar() == kReturnKey) {
return true;
} else {
return false;
trunk/i386/modules/HelloWorld/HelloWorld.cpp
3535
3636
3737
38
38
39
40
41
3942
4043
4144
......
4346
4447
4548
49
4650
4751
4852
delete obj2;
printf("Hello world from ExecKernel hook. Binary located at 0x%X\n", binary);
getc(); //Azi: getchar(); ??
getchar();
//
}
void HelloWorld_start()
//printf("Hooking 'ExecKernel'\n");
register_hook_callback("ExecKernel", &helloWorld);
register_hook_callback("Kernel Start", &helloWorld);
}
void HW::printHello()
trunk/i386/libsa/libsa.h
9393
9494
9595
96
96
9797
9898
9999
extern int strncmp(const char * s1, const char * s2, size_t n);
extern char * strcpy(char * s1, const char * s2);
extern char * strncpy(char * s1, const char * s2, size_t n);
extern size_t strlcpy(char * s1, const char * s2, size_t n); //Azi: ?? check!
extern size_t strlcpy(char * s1, const char * s2, size_t n);
extern char * strstr(const char *in, const char *str);
extern int atoi(const char * str);
extern int ptol(const char * str);
trunk/i386/libsa/string.c
166166
167167
168168
169
169
170170
171171
172172
}
size_t
strlcpy(char * s1, const char * s2, size_t n) //Azi: libsa.h
strlcpy(char * s1, const char * s2, size_t n)
{
while (n && (*s1++ = *s2++))
n--;
trunk/i386/util/fdisk/misc.c
142142
143143
144144
145
145
146146
147
147
148148
149149
150150
printf("%s [%c] ", str, default_answer ? 'y' : 'n');
fflush(stdout);
first = ch = getchar(); //Azi: what about these ?
first = ch = getchar();
while (ch != '\n' && ch != EOF)
ch = getchar(); //Azi: not messing them :P
ch = getchar();
if (ch == EOF || first == EOF)
errx(1, "eof");

Archive Download the corresponding diff file

Revision: 1034