示例#1
0
	void iiDebo1_initialize(void)
	{
		//////////
		// Window size
		//////
			gnWidth		= 800;
			gnHeight	= 600;


		//////////
		// Create the base fonts
		//////
			iBuilder_createAndInitialize(&gFonts, -1);
			fontUbuntuMono8		= iFont_create(cgcUbuntuMono,	8,	FW_NORMAL, 0, 0);
			fontUbuntuMono10	= iFont_create(cgcUbuntuMono,	10,	FW_NORMAL, 0, 0);
			fontUbuntu14		= iFont_create(cgcUbuntu,		14,	FW_NORMAL, 0, 0);


		//////////
		// Create the base bitmaps
		//////
			iBmp_createBySize(bmpDebo1				= iBmp_allocate(),			gnWidth,	gnHeight,	24);
			iBmp_createBySize(bmpStage1				= iBmp_allocate(),			67,			114,		24);
			iBmp_createBySize(bmpStage2				= iBmp_allocate(),			94,			114,		24);
			iBmp_createBySize(bmpStage3				= iBmp_allocate(),			94,			114,		24);
			iBmp_createBySize(bmpStage4				= iBmp_allocate(),			244,		133,		24);
			iBmp_createBySize(bmpStage5				= iBmp_allocate(),			83,			114,		24);
			iBmp_createBySize(bmpMemory				= iBmp_allocate(),			616,		449,		24);
			iBmp_createBySize(bmpRegisters			= iBmp_allocate(),			179,		171,		24);
			iBmp_createBySize(bmpDisassembly		= iBmp_allocate(),			181,		427,		24);
			// Mouse neutral colors
			iBmp_createBySize(bmp1Kb				= iBmp_allocate(),			74,			22,			24);
			iBmp_createBySize(bmp2Kb				= iBmp_allocate(),			74,			22,			24);
			iBmp_createBySize(bmp8Bits				= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmp16Bits				= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmp32Bits				= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmp64Bits				= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmpF5Run				= iBmp_allocate(),			50,			19,			24);
			iBmp_createBySize(bmpF8Step				= iBmp_allocate(),			54,			19,			24);
			iBmp_createBySize(bmpF12Throttle		= iBmp_allocate(),			84,			19,			24);
			// Mouse over colors
			iBmp_createBySize(bmp1KbOver			= iBmp_allocate(),			74,			22,			24);
			iBmp_createBySize(bmp2KbOver			= iBmp_allocate(),			74,			22,			24);
			iBmp_createBySize(bmp8BitsOver			= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmp16BitsOver			= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmp32BitsOver			= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmp64BitsOver			= iBmp_allocate(),			64,			22,			24);
			iBmp_createBySize(bmpF5RunOver			= iBmp_allocate(),			50,			19,			24);
			iBmp_createBySize(bmpF8StepOver			= iBmp_allocate(),			54,			19,			24);
			iBmp_createBySize(bmpF12ThrottleOver	= iBmp_allocate(),			84,			19,			24);
			// Externally rendered
			bmpLibSF_386_x40 = iBmp_rawLoad(cgc_libSF386x40Bmp);


		//////////
		// Populate the static images
		//////
			iiDebo1_populateStaticImages();
	}
示例#2
0
//////////
//
// Called to create a pseudo device context
//
//////
	SHdcX* iHwndX_createHdc(s32 tnWidth, s32 tnHeight, SBitmap* bmp)
	{
		union {
			uptr	_hdc;
			SHdcX*	hdc;
		};


		//////////
		// Make sure we have our HDC buffer allocated
		//////
			if (!gsHdcs)
				iBuilder_createAndInitialize(&gsHdcs, -1);


		//////////
		// Allocate a new one
		//////
			hdc = (SHdcX*)iBuilder_appendData(gsHdcs, (s8*)NULL, sizeof(SHdcX));
			if (hdc)
			{
				// Initialize
				hdc->isValid			= true;
				hdc->hdc				= _hdc;

				// Default settings
				hdc->isOpaque			= false;
				hdc->colorFore.color	= rgba(0,0,0,255);
				hdc->colorBack.color	= rgba(255,255,255,255);;

				// Allocate the default font
				hdc->font				= iFont_create(cgcFontName_default, 10, FW_NORMAL, 0, 0);

				// Allocate a bitmap
				if (!bmp)
				{
					// Create a bitmap
					hdc->bmp = iBmp_allocate();
					iBmp_createBySize(hdc->bmp, tnWidth, tnHeight, 24);

				} else {
					// Use the indicated bitmap
					hdc->bmp = bmp;
				}
			}


		//////////
		// Indicate success or failure
		//////
			return(hdc);
	}
示例#3
0
//////////
//
// Create a region for population
//
//////
	SRegionX* iHwndX_createRegion(void)
	{
		//////////
		// Make sure the array is valid
		//////
			if (!gsRegions)
				iBuilder_createAndInitialize(&gsRegions, 1024);


		//////////
		// Create a new region
		//////
			return((SRegionX*)iBuilder_appendData(gsRegions, (s8*)NULL, sizeof(SRegionX)));
	}
示例#4
0
//////////
//
// Obtain the next font that's available
//
//////
	SFontX* iHwndX_getNextFont(void)
	{
		u32		lnI;
		SFontX* font;


		//////////
		// Make sure the master list exists
		//////
			if (!gsHfonts)
				iBuilder_createAndInitialize(&gsHfonts, -1);


		//////////
		// Search for an empty slot
		//////
			for (lnI = 0, font = (SFontX*)gsHfonts->buffer; lnI < gsHfonts->populatedLength; lnI += sizeof(SFontX), font++)
			{
				// If this one is not used, return it
				if (!font->isValid)
					break;
			}
			// If we get here, none were found


		//////////
		// Allocate a new slot if need be
		//////
			if (lnI >= gsHfonts->populatedLength)
				font = (SFontX*)iBuilder_appendData(gsHfonts, (s8*)NULL, sizeof(SFontX));



		//////////
		// Indicate success or failure
		//////
			return(font);
	}
示例#5
0
//////////
//
// Posts a message to the indicated win->msgQueue.
//
//////
	bool iHwndX_postMessage_byWin(SHwndX* win, uptr message, uptr wParam, uptr lParam)
	{
		SMessageX* msg;


		// Make sure our environment is sane
		if (win && win->isValid)
		{
			//////////
			// Make sure there's a message queue
			//////
				if (!win->msgQueue)
					iBuilder_createAndInitialize(&win->msgQueue, -1);


			//////////
			// Append the message
			//////
				msg = (SMessageX*)iBuilder_appendData(win->msgQueue, (s8*)NULL, sizeof(SMessageX));
				if (msg)
				{
					msg->msg.hwnd		= win->hwnd;
					msg->msg.message	= message;
					msg->msg.wParam		= wParam;
					msg->msg.lParam		= lParam;
					msg->msg.time		= iHwndX_getTime();
					memcpy(&msg->msg.pt, &win->mousePt, sizeof(msg->msg.pt));

					// Indicate success
					return(true);
				}
		}

		// If we get here, failure
		return(false);
	}
示例#6
0
//////////
//
// Top level lasm1 assembler
//
//////
	int main(int argc, char* argv[])
	{
		s32					lnI, lnErrors, lnWarnings, lnOrg, numread;
		bool				llMap;
		SEM*				asmFile;
		SBuilder*			map;
		SLine*				line;
		FILE*				lfh;
		SOppie1Instruction*	instr;
		s8					buffer[2048];
		s8					output[2048];


//////////
//
// 		SBsa				bsa;
// 		SOra				ora;
// 		SOrr				orr;
//
// 		memset(&bsa, 0, sizeof(bsa));
// 		memset(&ora, 0, sizeof(ora));
// 		memset(&orr, 0, sizeof(orr));
// 		bsa.ooooo	= 0x1f;
// 		ora.ooo		= 0x7;
// 		orr.oooo	= 0xf;
// 		_asm nop;
//
//////


		//////////
		// Identify ourself
		//////
			printf("LibSF Oppie-1 Assembler v0.02\n");


		//////////
		// Initialize Visual FreePro, Jr. stuff
		///////
			InitializeCriticalSection(&cs_uniqueIdAccess);
			InitializeCriticalSection(&cs_logData);


		//////////
		// lasm1 only takes one parameter, the input filename
		//////
			if (argc < 2 || argc > 3)
			{
				// Display syntax
				printf("Usage:  lasm1 myfile.asm /map\n");

			} else {
				// Allocate our load manager
				asmFile = iSEM_allocate(true);
				if (!asmFile)
				{
					// Internal error
					printf("Internal error allocating load buffer\n");

				} else {
					// Try to physically load it
					if (!iSEM_loadFromDisk(asmFile, argv[1], false, false))
					{
						// Error opening
						printf("Unable to open %s\n", argv[1]);

					} else {
						// Indicate we're in progress
						printf("Assembling %s\n", argv[1]);

						// See if they specified /map
						llMap = (argc == 3 && strlen(argv[2]) == 4 && _memicmp(argv[2], "/map", 4) == 0);

						//////////
						// Parse every line into known components
						//////
							for (line = asmFile->firstLine; line; line = (SLine*)line->ll.next)
								iParseSourceCodeLine(line);


						//////////
						// Compile every line that can be compiled, report any errors
						//////
							for (	line = asmFile->firstLine, lnErrors = 0, lnWarnings = 0;
									line;
									line = (SLine*)line->ll.next	)
							{
								// Compile pass-1
								if (line->compilerInfo->firstComp && line->compilerInfo->firstComp->iCode != _ICODE_COMMENT)
									iCompileSourceCodeLine(asmFile, line, &lnErrors, &lnWarnings, 1);
							}

							// If there were any errors, exit
							if (lnErrors != 0)
								exit_program(-1);


						//////////
						// Assign addresses to everything
						//////
							for (	lnOrg = 0, line = asmFile->firstLine;
									line;
									line = (SLine*)line->ll.next	)
							{
								//////////
								// Based on the type update it
								//////
									instr = (SOppie1Instruction*)line->compilerInfo->extra_info;
									if (instr->isOrg)
									{
										// Update the origin
										lnOrg		= instr->org;

									} else {
										// Store the origin, and increase beyond this instruction's length
										instr->org	= lnOrg;
										lnOrg		+= instr->size;
									}
							}


						//////////
						// Compile every line which has an address that may not have been resolvable before
						//////
							for (	line = asmFile->firstLine, lnErrors = 0, lnWarnings = 0;
									line;
									line = (SLine*)line->ll.next	)
							{
								// Compile pass-2
								iCompileSourceCodeLine(asmFile, line, &lnErrors, &lnWarnings, 2);
							}

							// If there were any errors, exit
							if (lnErrors != 0)
								exit_program(-2);


						//////////
						// When we get here, every line has compiled out.
						// Look for memory locations which will overlay
						//////
							memset(output, 0, sizeof(output));
							memset(buffer, 0, sizeof(buffer));
							for (	line = asmFile->firstLine;
									line;
									line = (SLine*)line->ll.next	)
							{
								//////////
								// Grab the instruction for this line
								//////
									instr = (SOppie1Instruction*)line->compilerInfo->extra_info;
									if (instr->size != 0)
									{
										// There's some content there
										if (instr->isData)
										{
											//////////
											// Store the data
											//////
												for (lnI = 0; lnI < instr->size; lnI++)
												{
													// Increase our test buffer count
													++buffer[instr->org + lnI];
													if (buffer[instr->org + 1] > 1)
													{
														// We've overwritten a prior memory value
														printf("Addresses overlap on line %u\n", line->lineNumber);
														exit_program(-3);
													}

													// Copy the raw data
													output[instr->org + lnI] = instr->data[lnI];
												}

										} else if (instr->isInstruction) {
											//////////
											// Store the instruction
											//////
												if (instr->org + instr->size - 1 >= 2048)
												{
													// It will wrap around the end
													printf("Invalid address for line %u\n", line->lineNumber);
													exit_program(-4);
												}


											//////////
											// Increase for first byte
											//////
												++buffer[instr->org];
												output[instr->org] = instr->ora.i_data1;
												if (buffer[instr->org] > 1)
												{
													// We've overwritten a prior memory value
													printf("Addresses overlap on line %u\n", line->lineNumber);
													exit_program(-5);
												}


											//////////
											// If there's a second byte, do that one as well
											//////
												if (instr->size == 2)
												{
													++buffer[instr->org + 1];
													output[instr->org + 1] = instr->ora.i_data2;
													if (buffer[instr->org + 1] > 1)
													{
														// We've overwritten a prior memory value
														printf("Addresses overlap on line %u\n", line->lineNumber);
														exit_program(-6);
													}
												}
										}
									}
							}


						//////////
						// Create the otuput file
						//////
							memcpy(argv[1] + strlen(argv[1]) - 4, ".img", 4);
							lfh = fopen(argv[1], "wb+");
							if (!lfh)
							{
								// Could not create the output file
								printf("Error creating %s\n", argv[1]);
								exit_program(-7);
							}


						//////////
						// Write the buffer
						//////
							numread = fwrite(output, 1, 2048, lfh);
							fclose(lfh);
							if (numread != 2048)
							{
								printf("Error writing 2048 bytes\n");
								exit_program(-8);

							} else {
								// Success
								printf("Wrote 2048 bytes\n");
							}


						//////////
						// They specified a map file
						//////
							if (llMap)
							{
								//////////
								// Allocate our output buffer
								//////
									iBuilder_createAndInitialize(&map, -1);


								//////////
								// Iterate through each line and convey data, or disassembly for the output
								//////
									for (	line = asmFile->firstLine, lnErrors = 0, lnWarnings = 0;
											line;
											line = (SLine*)line->ll.next	)
									{
										//////////
										// Grab the instruction for this line
										//////
											instr = (SOppie1Instruction*)line->compilerInfo->extra_info;
											if (instr->size != 0)
											{
												//////////
												// Show the address:
												//////
													sprintf(buffer, "%03x: \0", instr->org);
													iBuilder_appendData(map, buffer, -1);


												//////////
												// There's some content there
												//////
													memset(buffer, 0, sizeof(buffer));
													if (instr->isData)
													{
														//////////
														// Show the data
														//////
															for (lnI = 0; lnI < instr->size; lnI++)
																sprintf(buffer + (lnI * 3), "%02x%s", instr->data[lnI], ((lnI + 1 < instr->size) ? ",\0" : " \0"));


													} else if (instr->isInstruction) {
														// Disassemble the instruction
														iiDebo1_decodeAssembly(buffer, instr->org, false, true, (u8*)output);
														memset(buffer + strlen(buffer), 32, 64);
														buffer[45] = '/';
														buffer[46] = '/';
														memcpy(buffer + 48, line->sourceCode->data_s8, line->sourceCode_populatedLength);
														buffer[48 + line->sourceCode_populatedLength] = 0;
													}


												//////////
												// Append the data
												//////
													iBuilder_appendData(map, buffer, strlen(buffer));
													iBuilder_appendCrLf(map);
											}

									}


								//////////
								// Save the map file
								//////
									memcpy(argv[1] + strlen(argv[1]) - 4, ".map", 4);
									iBuilder_asciiWriteOutFile(map, argv[1]);

							}

					}
				}
			}


		//////////
		// Task completed (one way or another :-))
		//////
			exit_program(0);
	}
示例#7
0
//////////
//
// Called to load a file into the indicated buffer.
//
//////
	bool iBuilder_asciiReadFromFile(SBuilder** builder, cu8* tcPathname)
	{
		u32		lnSize, lnNumread;
		FILE*	lfh;


		// Make sure our environment is sane
		if (builder && tcPathname)
		{
			//////////
			// If we don't have a buffer, create one
			//////
				if (!*builder)
					iBuilder_createAndInitialize(builder, -1);


			// Try to open the indicated file
			lfh = fopen((s8*)tcPathname, "rb");
			if (lfh)
			{
				//////////
				// Find out how big the file is
				//////
					fseek(lfh, 0, SEEK_END);
					lnSize = ftell(lfh);
					fseek(lfh, 0, SEEK_SET);


				//////////
				// Allocate that buffer
				//////
					iBuilder_verifySizeForNewBytes(*builder, lnSize);


				//////////
				// Read in the content
				//////
					lnNumread						= (u32)fread((*builder)->data_s8 + (*builder)->populatedLength, 1, lnSize, lfh);
					(*builder)->populatedLength	+= min(lnNumread, lnSize);


				//////////
				// Close the file
				//////
					fclose(lfh);


				//////////
				// Were we successful?
				//////
					if (lnNumread == lnSize)
						return(true);	// We're good

			} else {
				// We could not open the file
				// We don't do anything here, but just trap the condition and note it here in the comments
			}
		}
		// If we get here, failure
		return(false);
	}
示例#8
0
//////////
//
// Called at startup one time to declare the initial desktop window as a pseudo-window
// which is
//
//////
	SHwndX* iHwndX_declareDesktopHwnd(void)
	{
		s32			lnWidth, lnHeight;
		WNDCLASSEX	wcx;
		SHwndX*		win;


		//////////
		// Allocate our primary SHwndX buffer if need be
		//////
			if (!gsWindows)			iBuilder_createAndInitialize(&gsWindows, -1);
			if (!gsClasses)			iBuilder_createAndInitialize(&gsClasses, -1);
			if (!gsHdcs)			iBuilder_createAndInitialize(&gsHdcs, -1);


		//////////
		// Connect to X11
		//////
			gsDesktop.display		= XOpenDisplay(NULL);
			gsDesktop.screen		= DefaultScreen(gsDesktop.display);
			gsDesktop.depth			= DefaultDepth(gsDesktop.display, gsDesktop.screen);
			gsDesktop.connection	= ConnectionNumber(gsDesktop.display);
			gsDesktop.windowDesktop	= RootWindow(gsDesktop.display, gsDesktop.screen);


		//////////
		// Register our logical desktop class
		//////
			memset(&wcx, 0, sizeof(wcx));
			wcx.cbSize			= sizeof(wcx);
			wcx.style			= CS_OWNDC;
			wcx._lpfnWndProc	= (uptr)&DefWindowProc;
			wcx.lpszClassName	= (cs8*)&cgcDesktop[0];
			wcx.lpszMenuName	= (cs8*)&cgcDesktop[0];
			RegisterClassEx(&wcx);


		//////////
		// Create our logical desktop window
		//////
			lnWidth			= XDisplayWidth(gsDesktop.display, gsDesktop.screen);
			lnHeight		= XDisplayHeight(gsDesktop.display, gsDesktop.screen);
debug_break;
			ghWndDesktop	= CreateWindowEx(	0, cgcDesktop, cgcDesktop, WS_POPUP,
												0, 0, lnWidth, lnHeight,
												null0, null0, null0, null0);


		//////////
		// Create our default device context
		//////
			win = iHwndX_findWindow_byHwnd(ghWndDesktop);
			if (win)
			{
				// Create the actual hdc
				win->hdcx = iHwndX_createHdc(lnWidth, lnHeight, NULL);

				// Populate with default items
				//XQueryFont(gsDesktop.display, "*");
			}


		//////////
		// Return the logical desktop pointer
		//////
			return(win);
	}
示例#9
0
//////////
//
// Create a new font
//
//////
	SFont* iFont_create(cu8* tcFontName, u32 tnFontSize, u32 tnFontWeight, u32 tnItalics, u32 tnUnderline)
	{
		s32		lnLength;
		u32		lnI;
		SFont*	font;
		SFont*	fontFirstUnused;


		//////////
		// Make sure
		//////
			if (!gFonts)
				iBuilder_createAndInitialize(&gFonts);


		//////////
		// See if there is an unused slot
		//////
			fontFirstUnused	= NULL;
			lnLength		= (s32)strlen((s8*)tcFontName);
			for (lnI = 0; lnI < gFonts->populatedLength; lnI += sizeof(SFont))
			{
				// Grab the pointer
				font = (SFont*)(gFonts->data_u8 + lnI);

				// If used
				if (!font->isUsed)
				{
					// Mark this one if we haven't found a free slot yet
					fontFirstUnused = font;
					break;
				}
			}


		//////////
		// Allocate a new pointer
		//////
			if (!fontFirstUnused)		font = (SFont*)iBuilder_allocateBytes(gFonts, sizeof(SFont));
			else						font = fontFirstUnused;

			// Double-check
			if (!font)
				return(font);

			// Initialize
			memset(font, 0, sizeof(SFont));


		//////////
		// Populate
		//////
			font->isUsed					= true;
			font->hdc						= CreateCompatibleDC(GetDC(GetDesktopWindow()));
			iDatum_duplicate(&font->name, tcFontName, lnLength + 1);
			font->_size						= tnFontSize;
			font->_weight					= tnFontWeight;
			font->_italics					= tnItalics;
			font->_underline				= tnUnderline;
			font->isItalic					= ((tnItalics == 0)				? false : true);
			font->isBold					= ((tnFontWeight > FW_NORMAL)	? true : false);
			font->isUnderline				= ((tnUnderline == 0)			? false : true);
			iiFont_refresh(font);


		// Indicate our success
		return(font);
	}
示例#10
0
//////////
//
// Startup initialization, called from WinMain() only.
//
//////
	void iVjr_init(HACCEL* hAccelTable)
	{
		SThisCode*		thisCode = NULL;
		RECT			lrc;
#if !defined(_NONVJR_COMPILE)
		u8				logBuffer[256];
		SBitmap*		bmp;
#if defined(_GRACE_COMPILE)
		SGraceParams	params;
#endif
#endif


		// Get startup time
		systemStartedTickCount	= GetTickCount();
		systemStartedMs			= iTime_getLocalMs();

		// Fixup values that can't be properly encoded at compile-time
		iObjProp_init_fixup();

		// Initialize basic data engine
		iDbf_startup(true);

		// Create a 1x1 no image bitmap placeholder
		bmpNoImage = iBmp_allocate();
		iBmp_createBySize(bmpNoImage, 1, 1, 24);

		// Initialize primitive variables
		iVariable_createDefaultValues(NULL);
		iVariable_createPropsMaster(NULL);
		iVjr_init_createConstants();

		// Initialize our critical sections
		InitializeCriticalSection(&cs_uniqueIdAccess);
		InitializeCriticalSection(&cs_logData);

		// These arrows are used as a standard throughout the system for the size of an icon.
		// They must be loaded first.
		bmpArrowUl		= iBmp_rawLoad(cgc_arrowUlBmp);
		bmpArrowUr		= iBmp_rawLoad(cgc_arrowUrBmp);
		bmpArrowLl		= iBmp_rawLoad(cgc_arrowLlBmp);
		bmpArrowLr		= iBmp_rawLoad(cgc_arrowLrBmp);

		// Initialize our builders
		iBuilder_createAndInitialize(&gWindows,	-1);
		iBuilder_createAndInitialize(&gFonts,	-1);

		// Default font
		gsFontDefault				= iFont_create(cgcFontName_default,			10,	FW_NORMAL,	0, 0);
		gsFontDefault9				= iFont_create(cgcFontName_default,			9,	FW_NORMAL,	0, 0);
		gsFontDefaultBold			= iFont_create(cgcFontName_default,			10,	FW_BOLD,	0, 0);
		gsFontDefaultItalic8		= iFont_create(cgcFontName_default,			8,	FW_NORMAL,	1, 0);
		gsFontDefaultFixedPoint		= iFont_create(cgcFontName_defaultFixed,	10,	FW_NORMAL,	0, 0);
		gsWindowTitleBarFont		= iFont_create(cgcFontName_windowTitleBar,	12,	FW_NORMAL,	0, 0);
		gsWindowTitleBarFontSubform	= iFont_create(cgcFontName_windowTitleBar,	10,	FW_NORMAL,	0, 0);
		gsFontDefaultTooltip		= iFont_create(cgcFontName_defaultTooltip,	9,	FW_BOLD,	0, 0);
		gsFontCask					= iFont_create(cgcFontName_cask,			20, FW_BOLD,	0, 0);

		// Initialize the sound system
		isound_initialize();
		memset(&gseRootSounds, 0, sizeof(gseRootSounds));	// Initialize our root sounds array

//////////
// Jul.29.2014
// Removed due to limitations in the Shobjidl.h in MinGW.  Can be manually re-added with copy-and-paste... enjoy doing that! :-)
//		// Taskbar interface
//		HRESULT		hRes;
//		hRes = OleInitialize(NULL);
//		CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void**)&giTaskbar);
//////////


		//////////
		// Allocate a sourceLight area
		//////
			bmpSourceLight = iBmp_allocate();
			iBmp_createBySize(bmpSourceLight, 800, 1024, 24);
			iSourceLight_reset();


		//////////
		// Load our icons and images
		//////
			bmpVjrIcon						= iBmp_rawLoad(cgc_appIconBmp);
			bmpJDebiIcon					= iBmp_rawLoad(cgc_jdebiAppIconBmp);
			bmpSourceCodeIcon				= iBmp_rawLoad(cgc_sourcecodeIconBmp);
			bmpLocalsIcon					= iBmp_rawLoad(cgc_localsIconBmp);
			bmpWatchIcon					= iBmp_rawLoad(cgc_watchIconBmp);
			bmpCommandIcon					= iBmp_rawLoad(cgc_commandIconBmp);
			bmpDebugIcon					= iBmp_rawLoad(cgc_debugIconBmp);
			bmpOutputIcon					= iBmp_rawLoad(cgc_outputIconBmp);
			bmpSourceLightIcon				= iBmp_rawLoad(cgc_sourcelightIconBmp);

			// Carousels
			bmpCarouselCarouselIcon			= iBmp_rawLoad(cgc_carouselCarouselBmp);
			bmpCarouselTabsIcon				= iBmp_rawLoad(cgc_carouselTabsBmp);
			bmpCarouselPad					= iBmp_rawLoad(cgc_carouselPadBmp);
			bmpCarouselIcon					= iBmp_rawLoad(cgc_carouselIconBmp);
			bmpCarouselRiderTabClose		= iBmp_rawLoad(cgc_carouselRiderTabCloseBmp);

			bmpClose						= iBmp_rawLoad(cgc_closeBmp);
			bmpMaximize						= iBmp_rawLoad(cgc_maximizeBmp);
			bmpMinimize						= iBmp_rawLoad(cgc_minimizeBmp);
			bmpMove							= iBmp_rawLoad(cgc_moveBmp);

			bmpCheckboxOn					= iBmp_rawLoad(cgc_checkboxOnBmp);
			bmpCheckboxOff					= iBmp_rawLoad(cgc_checkboxOffBmp);

			bmpButton						= iBmp_rawLoad(cgc_buttonBmp);
			bmpTextbox						= iBmp_rawLoad(cgc_textboxBmp);

			bmpStoplightRed					= iBmp_rawLoad(cgc_stoplightRedBmp);
			bmpStoplightAmber				= iBmp_rawLoad(cgc_stoplightAmberBmp);
			bmpStoplightGreen				= iBmp_rawLoad(cgc_stoplightGreenBmp);
			bmpStoplightBlue				= iBmp_rawLoad(cgc_stoplightBlueBmp);

			bmpBreakpointAlways				= iBmp_rawLoad(cgc_breakpointAlways);
			bmpBreakpointAlwaysCountdown	= iBmp_rawLoad(cgc_breakpointAlwaysCountdown);
			bmpConditionalTrue				= iBmp_rawLoad(cgc_breakpointConditionalTrue);
			bmpConditionalFalse				= iBmp_rawLoad(cgc_breakpointConditionalFalse);
			bmpConditionalTrueCountdown		= iBmp_rawLoad(cgc_breakpointConditionalTrueCountdown);
			bmpConditionalFalseCountdown	= iBmp_rawLoad(cgc_breakpointConditionalFalseCountdown);

			bmpDapple1						= iBmp_rawLoad(cgc_dappleBmp);
			bmpDapple1Tmp					= iBmp_rawLoad(cgc_dappleBmp);
			bmpDapple2						= iBmp_rawLoad(cgc_dapple2Bmp);
			bmpDapple2Tmp					= iBmp_rawLoad(cgc_dapple2Bmp);


		//////////
		// Casks
		//////
			iVjr_init_loadCaskIcons();


		//////////
		// Bitmap array
		//////
			iVjr_init_loadBitmapArray();


		//////////
		// The radio image has a 44x44 dot in the upper-left.
		//////
			bmpRadio	= iBmp_rawLoad(cgc_radioBmp);											// Load the raw bmpRadio
			bmpRadioDot = iBmp_createAndExtractRect(bmpRadio, 0, 0, 44, 44);					// Extract the 44x44 rectangle
			SetRect(&lrc, 0, 0, 44, 44);
			iBmp_fillRect(bmpRadio, &lrc, whiteColor, whiteColor, whiteColor, whiteColor, false, NULL, false);		// And cover it up with white


		//////////
		// Splash screen
		//////
#if !defined(_NONVJR_COMPILE)
			// Load the splash screen
			if (glShowSplashScreen)
			{
				bmpVjrSplash = iBmp_rawLoad(cgc_splashBmp);
				bmp = iiVjr_buildSplashScreen(bmpVjrSplash);
				CreateThread(0, 0, &iSplash_show, bmp, 0, 0);
			}

			// Play the startup music if any
			sprintf((s8*)logBuffer, "VJr launched %u milliseconds after system boot\0", systemStartedTickCount);
			iVjr_appendSystemLog(thisCode, logBuffer);
			if (glShowSplashScreen)
				CreateThread(0, 0, &iPlay_ariaSplash, (LPVOID)cgcSoundStartupWav, 0, 0);
#endif

		// Focus window accumulator
#if !defined(_NONVJR_COMPILE)
		iVjr_appendSystemLog(thisCode, (u8*)"Create focus highlight buffer");
#endif
		iBuilder_createAndInitialize(&gFocusHighlights, -1);

		// Create the default reference datetimes
#if !defined(_NONVJR_COMPILE)
		iVjr_appendSystemLog(thisCode, (u8*)"Create default datetime variables");
#endif
		iVjr_init_createDefaultDatetimes();

		// Create our message window
#if !defined(_NONVJR_COMPILE)
		iVjr_appendSystemLog(thisCode, (u8*)"Create message window");
#endif
		iVjr_init_createMessageWindow();

		// Create our global variables
#if !defined(_NONVJR_COMPILE)
		iVjr_appendSystemLog(thisCode, (u8*)"Create global and system variables");
#endif
		iVjr_init_createGlobalSystemVariables();

		// Create our default objects
#if !defined(_NONVJR_COMPILE)
		iVjr_appendSystemLog(thisCode, (u8*)"Create default objects");
#endif
		iVjr_init_createDefaultObjects();

		// Create our main screen window
#if !defined(_NONVJR_COMPILE)
		iVjr_appendSystemLog(thisCode, (u8*)"TEMPORARY:  Manually create _jdebi");
		iVjr_init_jdebi_create();

		// Initially render each one
		iVjr_appendSystemLog(thisCode, (u8*)"Render _jdebi");
		iObj_render(NULL, _jdebi, true);

		// Attach them to physical windows
		iVjr_appendSystemLog(thisCode, (u8*)"Allocate OS Window for _jdebi");
		gWinJDebi = iWindow_allocate();
		iObj_createWindowForForm(NULL, _jdebi, gWinJDebi, IDI_JDEBI);

		// Initially populate _screen
		// Load in the history if it exists
		if (!iSEM_loadFromDisk(thisCode, NULL, screenData, cgcScreenDataFilename, false, true))
		{
			// Indicate success
			sprintf((s8*)logBuffer, "Loaded: %s\0", cgcScreenDataFilename);
			iSEM_appendLine(thisCode, _output_editbox->p.sem, logBuffer, (s32)strlen(logBuffer), false);
			iVjr_appendSystemLog(thisCode, (u8*)"Populate _screen with default data");
			iSEM_appendLine(thisCode, screenData, (u8*)cgcScreenTitle, -1, false);
			iSEM_appendLine(thisCode, screenData, NULL, 0, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"Please report any bugs:  http://www.visual-freepro.org/vjr", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"Thank you, and may the Lord Jesus Christ bless you richly. :-)", -1, false);
			iSEM_appendLine(thisCode, screenData, NULL, 0, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"              _____              In God's sight we've come together.", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |             We've come together to help each other.", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |             Let's grow this project up ... together!", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"     ________|     |________     In service and love to The Lord, forever!", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"    |                       |", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"    |________       ________|    Sponsored by:", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |                 LibSF -- Liberty Software Foundation", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |    Contributors:", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |        Hernan Cano, Stefano D'Amico", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |    Lead Project Contact:  [email protected]", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |     |    We need more coders. Please consider helping out.", -1, false);
			iSEM_appendLine(thisCode, screenData, (u8*)"             |_____|    Your contribution would make a difference. :-)", -1, false);
			iSEM_appendLine(thisCode, screenData, NULL, 0, false);
		}
		// Navigate to the end of the content
		iSEM_navigateToEndLine(thisCode, screenData, _screen);

		// Initially populate _jdebi
		// Load in the history if it exists
		if (!iSEM_loadFromDisk(thisCode, NULL, _command_editbox->p.sem, cgcCommandHistoryFilename, true, true))
		{
			// Indicate success
			sprintf((s8*)logBuffer, "Loaded: %s\0", cgcCommandHistoryFilename);
			iSEM_appendLine(thisCode, _output_editbox->p.sem, logBuffer, (s32)strlen(logBuffer), false);
			iSEM_appendLine(thisCode, _command_editbox->p.sem, (u8*)"*** Welcome to Visual FreePro, Junior! :-)", -1, false);
			iSEM_appendLine(thisCode, _command_editbox->p.sem, (u8*)"*** For now, this can be thought of as a command window ... with a twist.", -1, false);
			iSEM_appendLine(thisCode, _command_editbox->p.sem, (u8*)"*** It works like an editor window.  You can insert new lines, edit old ones, etc.", -1, false);
			iSEM_appendLine(thisCode, _command_editbox->p.sem, (u8*)"*** To execute a command, press F6. If you're on the last line use F6 or Enter.", -1, false);
			iSEM_appendLine(thisCode, _command_editbox->p.sem, (u8*)"*** See http://www.visual-freepro.org/wiki/index.php/VXB for supported commands.", -1, false);
			iSEM_appendLine(thisCode, _command_editbox->p.sem, (u8*)"*** Remember always:  Love makes you smile. It keeps an inner peace like no other. :-)", -1, false);
		}

		// Navigate to the last line
		iSEM_navigateToEndLine(thisCode, _command_editbox->p.sem, _command_editbox);

		// Make sure there's a blank line at the end
		if (_command_editbox->p.sem->line_cursor->sourceCode_populatedLength != 0)
		{
			iSEM_appendLine(thisCode, _command_editbox->p.sem, NULL, 0, false);
			iSEM_navigateToEndLine(thisCode, _command_editbox->p.sem, _command_editbox);
		}

		// Load some source code
		if (iSEM_loadFromDisk(thisCode, _sourceCode_rider, _sourceCode_editbox->p.sem, cgcStartupPrgFilename, true, true))
		{
			// Indicate success
			sprintf((s8*)logBuffer, "Loaded: %s\0", cgcStartupPrgFilename);
			iSEM_appendLine(thisCode, _output_editbox->p.sem, logBuffer, (s32)strlen(logBuffer), false);
		}

		// Redraw
		iVjr_appendSystemLog(thisCode, (u8*)"Final render _jdebi");
		iWindow_render(NULL, gWinJDebi, true);

		// Remove the splash screen 1/2 second later
		CreateThread(0, 0, &iSplash_delete, (LPVOID)500, 0, 0);

#if defined(_GRACE_COMPILE)
		// Create a thread to display the content in 3D
		memset(&params, 0, sizeof(params));
		params._func_mouse			= (uptr)&iGrace_mouse;
		params._func_motion			= (uptr)&iGrace_motion;
		params._func_passiveMotion	= (uptr)&iGrace_passiveMotion;
		params._func_key			= (uptr)&iGrace_key;
		params._func_special		= (uptr)&iGrace_special;
		params._func_reshape		= (uptr)&iGrace_reshape;
		params._func_display		= (uptr)&iGrace_display;
		params._func_idle			= (uptr)&iGrace_idle;
		CreateThread(0, 0, &iGrace, (LPVOID)&params, 0, 0);
#endif
#endif
	}