c++ in unreal script

Discussions about Coding and Scripting
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: c++ in unreal script

Post by Shadow »

I don't trust these changed headers. As for the example with the trace class: working with a class that relies on that changed class leads to a dll error while in use... the engine and core headers shouldn't be modified, instead creating a subclass with extended functionality is the way to go. Also I think it's illegal since the change of these headers and recompiling leads to new custom core.dll and engine.dll files. If not I would have raped the original public headers to death for my SDK since ages... instead of coding own engine and core files.
Image
User avatar
UT Sniper (SJA94)
Inhuman
Posts: 753
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: Retard
Location: England
Contact:

Re: c++ in unreal script

Post by UT Sniper (SJA94) »

Ok i will stick to the stock 1's, i dont want errors :lol2: .
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: c++ in unreal script

Post by Shadow »

Yes, staying with the official public headers is the best to ensure proper functionality. Other than that I don't see any point why someone should use these SDKs, really. These SDKs are only a compilation of class definition headers of the engine packages (engine, core, d3d driver etc). It also seems that Temp2 hacked the original DLL files of several UEngine games in a way of reverse engineering to get the headers of games where no public headers are available (UT2004).
Image
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: c++ in unreal script

Post by anth »

Shadow wrote:Yes, staying with the official public headers is the best to ensure proper functionality. Other than that I don't see any point why someone should use these SDKs, really. These SDKs are only a compilation of class definition headers of the engine packages (engine, core, d3d driver etc). It also seems that Temp2 hacked the original DLL files of several UEngine games in a way of reverse engineering to get the headers of games where no public headers are available (UT2004).
The official headers don't garantuee compatibility at all. I've run into lots of differences between v436, v440 and v451 (especially in the netdrivers).

You don't have to hack anything to get headers for games that have to public SDK by the way. Especially in the case of UEngine 2 (which is usually dynamically linked), a lot of information can be derived by statically analyzing the dlls (and upackages). You can get the class names and function names from the dll export tables, vtable layouts from the relocation sections, class member layouts from both GObjObjects (and partially from native classes inside UPackages) and then there's some non-UObject classes that are tricky to extract from the dlls but that have hardly changed since UE1. All in all, you can get nearly fully accurate headers by a bit of static analysis and some recycling of UE1 code (which is exactly what the owner of the site that was linked to did).
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: c++ in unreal script

Post by Shadow »

Of course they don't garantuee anything, but on my opinion I trust them more than some changed ones. Also the public source is Build 432, is common that one runs into trouble between build versions with it in some cases.
Image
User avatar
UT Sniper (SJA94)
Inhuman
Posts: 753
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: Retard
Location: England
Contact:

Re: c++ in unreal script

Post by UT Sniper (SJA94) »

i have spent alot off time trying to get vc++2010 to work and it keeps failing. i don't know if i have missed somethink or made a type-o. But i would post the error just incase 1 of u have seen it before. (doing hazard tut)

Code: Select all

1>------ Build started: Project: Hazard DLL, Configuration: Release Win32 ------
1>  hzTest.cpp
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1367): error C2220: warning treated as error - no 'object' file generated
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1367): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>          c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1362) : see reference to class template instantiation 'TMapBase<TK,TI>::TPair' being compiled
1>          c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1556) : see reference to class template instantiation 'TMapBase<TK,TI>' being compiled
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1367): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1370): error C2535: 'TMapBase<TK,TI>::TPair::TPair(void)' : member function already defined or declared
1>          c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1367) : see declaration of 'TMapBase<TK,TI>::TPair::TPair'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1409): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1409): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1472): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1472): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1481): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1481): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1589): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>          c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1621) : see reference to class template instantiation 'TMultiMap<TK,TI>' being compiled
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1589): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1593): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1593): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1600): warning C4346: 'TTypeInfo<T>::ConstInitType' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>c:\unrealtournament\hazard\hazard\hazard\UnTemplate.h(1600): error C2061: syntax error : identifier 'ConstInitType'
1>c:\unrealtournament\hazard\hazard\hazard\UnModel.h(158): error C2065: 'i' : undeclared identifier
1>c:\unrealtournament\hazard\hazard\hazard\UnModel.h(158): error C2065: 'i' : undeclared identifier
1>c:\unrealtournament\hazard\hazard\hazard\UnModel.h(158): error C2065: 'i' : undeclared identifier
1>c:\unrealtournament\hazard\hazard\hazard\UnModel.h(159): error C2065: 'i' : undeclared identifier
1>c1xx : fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Note i will retry it again from scratch.
User avatar
Saya-chan
Adept
Posts: 446
Joined: Mon Jun 02, 2008 10:46 am
Personal rank: Former UT99 modder
Location: Vigo, Galicia
Contact:

Re: c++ in unreal script

Post by Saya-chan »

Those errors seem very, very familiar. It's all because the headers were made specifically for Visual Studio 2005, so there are a lot of random incompatibility issues with modern ones.

I think there were modified headers somewhere to be compatible with Visual Studio 2008 (and apparently also with 2010, which I am using, too). As far as I remember, in another thread, anth gave me this link when I asked for them.
Image
  ~♥~ Bless the Cute Emperor ~♥~
User avatar
UT Sniper (SJA94)
Inhuman
Posts: 753
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: Retard
Location: England
Contact:

Re: c++ in unreal script

Post by UT Sniper (SJA94) »

even with the headers above im still getting the same error, am i doing somethink wrong or should i get an older visual studio?

the reason for the long delay, im making a text editor program, to improve my c++ skills.

Code: Select all

1>------ Build started: Project: Hazard DLL, Configuration: Release Win32 ------
1>  hzTest.cpp
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnFile.h(459): error C2664: 'FMalloc::Malloc' : cannot convert parameter 2 from 'const wchar_t [4]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnFile.h(479): error C2664: 'FMalloc::Malloc' : cannot convert parameter 2 from 'const wchar_t [4]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnTemplate.h(1012): error C2446: ':' : no conversion from 'const wchar_t *' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnTemplate.h(1054): error C2679: binary '+=' : no operator found which takes a right-hand operand of type 'const wchar_t [2]' (or there is no acceptable conversion)
1>          c:\unrealtournament\hazard\src\hazard dll\core\inc\UnTemplate.h(1024): could be 'FString &FString::operator +=(const TCHAR *)'
1>          c:\unrealtournament\hazard\src\hazard dll\core\inc\UnTemplate.h(1039): or       'FString &FString::operator +=(const FString &)'
1>          while trying to match the argument list '(FString, const wchar_t [2])'
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnTemplate.h(1247): error C2440: 'default argument' : cannot convert from 'const wchar_t [1]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnTemplate.h(1247): error C2548: 'FStringOutputDevice::FStringOutputDevice' : missing default parameter for parameter 1
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnName.h(128): error C2446: ':' : no conversion from 'const wchar_t *' to 'TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnObjBas.h(191): error C2440: 'initializing' : cannot convert from 'const wchar_t [8]' to 'const TCHAR []'
1>          There is no context in which this conversion is possible
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnObjBas.h(193): error C2664: 'appUnwindf' : cannot convert parameter 1 from 'const wchar_t [3]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnObjBas.h(198): error C2664: 'appSprintf' : cannot convert parameter 2 from 'const wchar_t [17]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnObjBas.h(448): error C2440: 'return' : cannot convert from 'const wchar_t [7]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnObjBas.h(521): error C2440: 'initializing' : cannot convert from 'const wchar_t [25]' to 'const TCHAR []'
1>          There is no context in which this conversion is possible
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnObjBas.h(521): error C2664: 'appUnwindf' : cannot convert parameter 1 from 'const wchar_t [3]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnCorObj.h(117): error C2440: 'default argument' : cannot convert from 'const wchar_t [1]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnCorObj.h(117): error C2548: 'UTextBuffer::UTextBuffer' : missing default parameter for parameter 1
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnCorObj.h(110): error C2512: 'UTextBuffer' : no appropriate default constructor available
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnClass.h(266): error C2664: 'appSprintf' : cannot convert parameter 2 from 'const wchar_t [4]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnClass.h(460): error C2664: 'appStricmp' : cannot convert parameter 2 from 'const wchar_t [6]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnClass.h(462): error C2664: 'appSprintf' : cannot convert parameter 2 from 'const wchar_t [5]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnClass.h(470): error C2440: 'initializing' : cannot convert from 'const wchar_t [22]' to 'const TCHAR []'
1>          There is no context in which this conversion is possible
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnClass.h(477): error C2664: 'appUnwindf' : cannot convert parameter 1 from 'const wchar_t [3]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UnScript.h(193): error C2446: ':' : no conversion from 'const wchar_t *' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UFactory.h(47): error C2440: 'default argument' : cannot convert from 'const wchar_t [1]' to 'const TCHAR *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UFactory.h(47): error C2548: 'UFactory::StaticImportObject' : missing default parameter for parameter 5
1>c:\unrealtournament\hazard\src\hazard dll\core\inc\UFactory.h(48): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: c++ in unreal script

Post by anth »

ALT+F7 -> Configuration Properties -> C/C++ -> Language -> Treat wchar_t as built-in type -> NO
User avatar
UT Sniper (SJA94)
Inhuman
Posts: 753
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: Retard
Location: England
Contact:

Re: c++ in unreal script

Post by UT Sniper (SJA94) »

Thanks that got rid of the headers errors, i just have to recode somethink then it should work :gj:

Code: Select all

1>------ Build started: Project: Hazard DLL, Configuration: Release Win32 ------
1>  hzTest.cpp
1>hzTest.cpp(49): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(66): error C2065: 'i' : undeclared identifier
1>hzTest.cpp(66): error C2065: 'MyBool' : undeclared identifier
1>hzTest.cpp(69): error C2355: 'this' : can only be referenced inside non-static member functions
1>hzTest.cpp(69): error C2227: left of '->eventBroadcastMessage' must point to class/struct/union/generic type
1>hzTest.cpp(70): error C2355: 'this' : can only be referenced inside non-static member functions
1>hzTest.cpp(70): error C2227: left of '->eventSampleEvent' must point to class/struct/union/generic type
1>hzTest.cpp(70): error C2065: 'i' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'ASampleClass' : undeclared identifier
1>hzTest.cpp(76): error C2070: ''unknown-type'': illegal sizeof operand
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'StaticClassFlags' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C3861: 'StaticClass': identifier not found
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C3861: 'StaticClass': identifier not found
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'GUID1' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'GUID2' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'GUID3' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'GUID4' : undeclared identifier
1>hzTest.cpp(76): error C3861: 'StaticConfigName': identifier not found
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'InternalConstructor' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C2065: 'StaticConstructor' : undeclared identifier
1>hzTest.cpp(76): error C2653: 'ASampleClass' : is not a class or namespace name
1>hzTest.cpp(76): error C3861: 'StaticClass': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
User avatar
UT Sniper (SJA94)
Inhuman
Posts: 753
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: Retard
Location: England
Contact:

Re: c++ in unreal script

Post by UT Sniper (SJA94) »

Came across these UDN documents from epic games. There is 2 on native coding and more for coding . http://utdatabase.99k.org/files/ut99/do ... es.com.zip

And also many other tutorials mapping, coding, skinning, audio, video, running servers ect.
http://utdatabase.99k.org/docs.html
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: c++ in unreal script

Post by anth »

Those UDN docs on native coding were copy pasted from the guy who wrote the Hazard tutorial (i.e. the tutorial you've already seen).
Post Reply