Initial commit of Command & Conquer Renegade source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:39:46 +00:00
parent 74ab8fa5e0
commit 58ed459113
4918 changed files with 1366710 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
DIRS=sys \
exe

View File

@@ -0,0 +1,144 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "windows.h"
#include "winioctl.h"
#include "stdio.h"
#include "stdlib.h"
#include "monopub.h"
#include "conio.h"
#define MESSAGE1 "*** Page 1 ***\n"
#define MESSAGE2 "*** Page 2 ***\n"
#define MESSAGE3 "Another line of text.\n"
int __cdecl main(int argc, char *argv[])
{
HANDLE handle1;
HANDLE handle2;
char attrib = 0x70;
handle1 = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle1 != INVALID_HANDLE_VALUE) {
long retval;
WriteFile(handle1, MESSAGE1, strlen(MESSAGE1), &retval, NULL);
printf("Press <ENTER> to proceed.\n");
getchar();
handle2 = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle2 != INVALID_HANDLE_VALUE) {
WriteFile(handle2, MESSAGE2, strlen(MESSAGE1), &retval, NULL);
printf("Press <ENTER> to proceed again.\n");
getchar();
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
printf("First page should reappear.\n");
getchar();
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
printf("Second page should reappear.\n");
getchar();
{
unsigned short * ptr = NULL;
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_LOCK, NULL, 0, &ptr, sizeof(ptr), &retval, 0);
if (ptr != NULL) {
*ptr = 0x0720;
}
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_UNLOCK, NULL, 0, NULL, 0, &retval, 0);
printf("Upper left character should blank out.\n");
getchar();
}
CloseHandle(handle2);
} else {
printf("Unable to open second device handle.\n");
getchar();
}
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_ATTRIBUTE, &attrib, 1, NULL, 0, &retval, 0);
WriteFile(handle1, MESSAGE3, strlen(MESSAGE3), &retval, NULL);
printf("First page should reappear with new text.\n");
getchar();
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_PAN, NULL, 0, NULL, 0, &retval, 0);
printf("Now it should pan over one column.\n");
getchar();
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SCROLL, NULL, 0, NULL, 0, &retval, 0);
printf("Now it should scroll up one row.\n");
getchar();
attrib = 0x07;
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_ATTRIBUTE, &attrib, 1, NULL, 0, &retval, 0);
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &retval, 0);
CloseHandle(handle1);
}
#ifdef NEVER
HANDLE hDriver;
UCHAR outputString[] = "Test Message\nfor the monochrome device.\n";
UCHAR altString[] = "'\t','\n'";
UCHAR topline[] = "Top line of screen.\n\n\n\n";
DWORD cbReturned;
struct {
int X;
int Y;
} cursorpos;
if ((hDriver = CreateFile("\\\\.\\MONO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != ((HANDLE)-1)) {
printf("\nRetrieved valid handle for MONO driver\n");
} else {
printf("Can't get a handle to MONO driver\n");
return 1;
}
WriteFile(hDriver, outputString, strlen(outputString), &cbReturned, NULL);
printf("WriteFile says it wrote out %d bytes.\n", cbReturned);
if (DeviceIoControl(hDriver, (DWORD) IOCTL_MONO_PRINT_RAW, altString, sizeof(altString)-1, NULL, 0, &cbReturned, 0)) {
printf("DeviceIoControl worked\n\n");
cursorpos.X = 0;
cursorpos.Y = 0;
DeviceIoControl(hDriver, (DWORD)IOCTL_MONO_SET_CURSOR, (char*)&cursorpos, sizeof(cursorpos), NULL, 0, &cbReturned, 0);
WriteFile(hDriver, topline, strlen(topline), &cbReturned, NULL);
printf("Hit <Enter> to clear the mono display: \n");
getchar();
DeviceIoControl(hDriver, (DWORD) IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &cbReturned, 0);
printf("'Bye\n");
} else {
printf("DeviceIoControl failed\n");
}
CloseHandle(hDriver);
#endif
return 0;
}

View File

@@ -0,0 +1,10 @@
!include <ntwin32.mak>
all: monotest.exe
monotest.obj: monotest.c
$(cc) $(cflags) $(cvars) $(cdebug) -I..\sys monotest.c
monotest.exe: monotest.obj
$(link) $(linkdebug) $(conflags) -out:monotest.exe monotest.obj $(conlibs)

View File

@@ -0,0 +1,11 @@
TARGETNAME=monotest
TARGETPATH=$(BASEDIR)\lib
TARGETTYPE=PROGRAM
INCLUDES=..\sys
SOURCES=monotest.c
UMTYPE=console
UMBASE=0x100000

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*++
Copyright (c) 1993 Microsoft Corporation
Module Name:
monopub.h
Abstract:
This module contains the PUBLIC (viewable by driver & Win32 apps)
definitions for the IOCTLs supported by the MONO device driver.
Environment:
Kernel & User mode
Revision History:
03-22-93 : created
--*/
//
// Define the various device type values. Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//
#define FILE_DEVICE_MONO 0x00008000
//
// The MONO device driver IOCTLs
//
#define IOCTL_MONO_CLEAR_SCREEN CTL_CODE(FILE_DEVICE_MONO, 0x801, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_PRINT_RAW CTL_CODE(FILE_DEVICE_MONO, 0x800, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_SET_CURSOR CTL_CODE(FILE_DEVICE_MONO, 0x802, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_SCROLL CTL_CODE(FILE_DEVICE_MONO, 0x803, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_BRING_TO_TOP CTL_CODE(FILE_DEVICE_MONO, 0x804, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_SET_ATTRIBUTE CTL_CODE(FILE_DEVICE_MONO, 0x805, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_PAN CTL_CODE(FILE_DEVICE_MONO, 0x806, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_LOCK CTL_CODE(FILE_DEVICE_MONO, 0x807, METHOD_BUFFERED, FILE_WRITE_DATA)
#define IOCTL_MONO_UNLOCK CTL_CODE(FILE_DEVICE_MONO, 0x808, METHOD_BUFFERED, FILE_WRITE_DATA)

View File

@@ -0,0 +1,7 @@
TARGETNAME=mono
TARGETPATH=$(BASEDIR)\lib
TARGETTYPE=EXPORT_DRIVER
DLLDEF=mono.def
SOURCES=mono.c