CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

GETCPU.CPP (5419B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/GETCPU.CPP 1     3/03/97 10:24a Joe_bostic $*/
     17 /***********************************************************************************************
     18  ***              C O N F I D E N T I A L  ---  W E S T W O O D  S T U D I O S               ***
     19  ***********************************************************************************************
     20  *                                                                                             *
     21  *                 Project Name : GETCPU                                                       *
     22  *                                                                                             *
     23  *                    File Name : GETCPU.CPP                                                   *
     24  *                                                                                             *
     25  *                   Programmer : Steve Tall                                                   *
     26  *                                                                                             *
     27  *                   Start Date : 6/26/96                                                      *
     28  *                                                                                             *
     29  *                  Last Update : June 26th 1996 [ST]                                          *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Overview:                                                                                   *
     33  *   Example of interface to assembly language code to find CPU type                           *
     34  *                                                                                             *
     35  *---------------------------------------------------------------------------------------------*
     36  *                                                                                             *
     37  * Functions:                                                                                  *
     38  *   Get_CPU_Type -- interface to ASM detection code                                           *
     39  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     40 
     41 
     42 //#define WIN32
     43 //#include <windows.h>
     44 #include <stdio.h>
     45 #include	<string.h>
     46 
     47 
     48 #define	bool	int
     49 
     50 /*
     51 ** Prototypes for linkage to assembly module
     52 */
     53 
     54 extern "C" {
     55 	bool __cdecl Detect_MMX_Availability(void);
     56 	void __cdecl Init_MMX(void);
     57 
     58 	extern char CPUType;
     59 	extern char VendorID;
     60 }
     61 
     62 
     63 /***********************************************************************************************
     64  * Get_CPU_Type -- Find out what kind of CPU we are running on                                 *
     65  *                                                                                             *
     66  *                                                                                             *
     67  *                                                                                             *
     68  * INPUT:    int   - reference to cpu type                                                     *
     69  *           bool  - reference to mmx availability flag                                        *
     70  *           char* - ptr to buffer to receive chip vendor info                                 *
     71  *           int   - length of above buffer                                                    *
     72  *                                                                                             *
     73  * OUTPUT:   Nothing                                                                           *
     74  *                                                                                             *
     75  * WARNINGS: None                                                                              *
     76  *                                                                                             *
     77  * HISTORY:                                                                                    *
     78  *    6/26/96 10:15AM ST : Created                                                             *
     79  *=============================================================================================*/
     80 void Get_CPU_Type(int & cpu_type, bool & mmx, char * vendor_id, int vendor_id_length)
     81 {
     82 	/*
     83 	** Call the asm CPU detection code
     84 	*/
     85 	mmx = Detect_MMX_Availability();
     86 
     87 	/*
     88 	** Return the promised results
     89 	*/
     90 	cpu_type = (int)CPUType;
     91 	char * vendor_ptr = &VendorID;
     92 	strncpy(vendor_id, vendor_ptr, vendor_id_length);
     93 }
     94 
     95 
     96 
     97 
     98 
     99 
    100 
    101 
    102 
    103