Merge pull request #1360 from shinovon/symbian_squashed

Symbian port
This commit is contained in:
UnknownShadow200 2025-05-22 07:05:44 +10:00 committed by GitHub
commit 0b0f7f5f0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
48 changed files with 1551 additions and 83 deletions

4
.gitignore vendored
View File

@ -229,3 +229,7 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# Eclipse
.cproject
.project

View File

@ -299,13 +299,17 @@ static const unsigned char TA6_EC_Q[] = {
0x8A
};
static const br_x509_trust_anchor TAs[7] = {
static
#ifndef CC_BUILD_SYMBIAN
const
#endif
br_x509_trust_anchor TAs[7] = {
{
{ (unsigned char *)TA0_DN, sizeof TA0_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
{ {
(unsigned char *)TA0_RSA_N, sizeof TA0_RSA_N,
(unsigned char *)TA0_RSA_E, sizeof TA0_RSA_E,
} }
@ -316,7 +320,7 @@ static const br_x509_trust_anchor TAs[7] = {
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
{ {
(unsigned char *)TA1_RSA_N, sizeof TA1_RSA_N,
(unsigned char *)TA1_RSA_E, sizeof TA1_RSA_E,
} }
@ -327,7 +331,7 @@ static const br_x509_trust_anchor TAs[7] = {
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
{ {
(unsigned char *)TA2_RSA_N, sizeof TA2_RSA_N,
(unsigned char *)TA2_RSA_E, sizeof TA2_RSA_E,
} }
@ -337,11 +341,17 @@ static const br_x509_trust_anchor TAs[7] = {
{ (unsigned char *)TA3_DN, sizeof TA3_DN },
BR_X509_TA_CA,
{
#if defined CC_BUILD_SYMBIAN
BR_KEYTYPE_EC
/* set in SSL.c */
#else
BR_KEYTYPE_EC,
{ .ec = {
BR_EC_secp384r1,
(unsigned char *)TA3_EC_Q, sizeof TA3_EC_Q,
} }
#endif
}
},
{
@ -349,7 +359,7 @@ static const br_x509_trust_anchor TAs[7] = {
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
{ {
(unsigned char *)TA4_RSA_N, sizeof TA4_RSA_N,
(unsigned char *)TA4_RSA_E, sizeof TA4_RSA_E,
} }
@ -360,7 +370,7 @@ static const br_x509_trust_anchor TAs[7] = {
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
{ {
(unsigned char *)TA5_RSA_N, sizeof TA5_RSA_N,
(unsigned char *)TA5_RSA_E, sizeof TA5_RSA_E,
} }
@ -370,11 +380,16 @@ static const br_x509_trust_anchor TAs[7] = {
{ (unsigned char *)TA6_DN, sizeof TA6_DN },
BR_X509_TA_CA,
{
#if defined CC_BUILD_SYMBIAN
BR_KEYTYPE_EC
/* set in SSL.c */
#else
BR_KEYTYPE_EC,
{ .ec = {
BR_EC_secp384r1,
(unsigned char *)TA6_EC_Q, sizeof TA6_EC_Q,
} }
#endif
}
}
};

View File

@ -6,6 +6,9 @@
#define NOIME
#include <windows.h>
#define GLAPI WINGDIAPI
#elif defined CC_BUILD_SYMBIAN && !defined __WINSCW__
#define GLAPI IMPORT_C
#define APIENTRY
#else
#define GLAPI extern
#define APIENTRY

8
misc/symbian/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
ABLD.BAT
*.sis
!*.mmp
!*.mmh
!*.pkg
!*.rss
!*.svg
!*.txt

View File

@ -0,0 +1,30 @@
&EN
#{"ClassiCube"},(0xE212A5C2),1,0,0
[0x101F7961], 0, 0, 0, {"S60ProductID"}
[0x1028315F], 0, 0, 0, {"S60ProductID"}
[0x20022E6D], 0, 0, 0, {"S60ProductID"}
%{"ClassiCube"}
:"ClassiCube"
; Check OpenC versions
IF( version(0x20009a80, <, 1, 5, 0) ) AND NOT (EXISTS("Z:\sys\bin\libc.dll") OR EXISTS("C:\sys\bin\libc.dll"))
"incompatible_openc.txt"-"", FT, FORCEABORT
ENDIF
IF exists("z:\system\install\Series60v5.2.sis") ; Symbian^3
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\ClassiCube_sym3.exe" - "!:\sys\bin\ClassiCube.exe"
ELSE
IF exists("z:\system\install\Series60v5.0.sis") ; Symbian 9.4
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\ClassiCube_s60v5.exe" - "!:\sys\bin\ClassiCube.exe"
ELSE ; Symbian 9.2-9.3
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\ClassiCube_s60v3.exe" - "!:\sys\bin\ClassiCube.exe"
ENDIF
ENDIF
"$(EPOCROOT)\epoc32\data\z\private\10003a3f\import\apps\classicube_reg.rsc" - "!:\private\10003a3f\import\apps\classicube_reg.rsc"
"$(EPOCROOT)\epoc32\data\z\resource\apps\classicube.rsc" - "!:\resource\apps\classicube.rsc"
"$(EPOCROOT)\epoc32\data\z\resource\apps\classicube_icon.mif" - "!:\resource\apps\classicube_icon.mif"
;"$(EPOCROOT)\epoc32\winscw\c\private\e212a5c2\texpacks\classicube.zip" - "!:\private\e212a5c2\texpacks\classicube.zip"

View File

@ -0,0 +1,58 @@
TARGETTYPE exe
UID 0x100039CE 0xE212A5C2
SYSTEMINCLUDE /epoc32
SYSTEMINCLUDE /epoc32/include
SYSTEMINCLUDE /epoc32/include/mw
SYSTEMINCLUDE /epoc32/include/app
SYSTEMINCLUDE /epoc32/include/platform
SYSTEMINCLUDE /epoc32/include/platform/mw
SYSTEMINCLUDE /epoc32/include/platform/app
SYSTEMINCLUDE /epoc32/include/gles
SYSTEMINCLUDE /epoc32/include/stdapis
SYSTEMINCLUDE /epoc32/include/stdapis/sys
//SYSTEMINCLUDE /epoc32/include/libc
USERINCLUDE ../../src
USERINCLUDE ../../src/freetype
USERINCLUDE ../../third_party/bearssl/inc
USERINCLUDE ../../third_party/bearssl/src
MACRO SYMBIAN_OE_POSIX_SIGNALS
LIBRARY euser.lib
LIBRARY apgrfx.lib
LIBRARY cone.lib
LIBRARY avkon.lib
LIBRARY fbscli.lib
LIBRARY ws32.lib
LIBRARY hal.lib
LIBRARY libc.lib
LIBRARY libm.lib
LIBRARY libdl.lib
LIBRARY libpthread.lib
STATICLIBRARY libcrt0.lib
OPTION GCCE -O2 -std=c99
OPTION ARMCC -Otime --diag_suppress 1296 --diag_suppress 1293 --diag_suppress 66
OPTION_REPLACE ARMCC --cpu 6
OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast
SOURCEPATH ../../src
SOURCE Animations.c Audio.c AudioBackend.c AxisLinesRenderer.c Bitmap.c Block.c BlockPhysics.c Builder.c Camera.c Chat.c Commands.c Deflate.c Drawer.c Drawer2D.c Entity.c EntityComponents.c EntityRenderers.c EnvRenderer.c Event.c ExtMath.c FancyLighting.c Formats.c Game.c GameVersion.c Generator.c Graphics_GL1.c Graphics_SoftGPU.c Gui.c HeldBlockRenderer.c Http_Web.c Http_Worker.c Input.c InputHandler.c Inventory.c IsometricDrawer.c LBackend.c LScreens.c LWeb.c LWidgets.c Launcher.c Lighting.c Logger.c MapRenderer.c MenuOptions.c Menus.c Model.c Options.c PackedCol.c Particle.c Physics.c Picking.c Platform_Posix.c Protocol.c Queue.c Resources.c SSL.c Screens.c SelOutlineRenderer.c SelectionBox.c Server.c Stream.c String.c SystemFonts.c TexturePack.c TouchUI.c Utils.c Vectors.c Widgets.c World.c _autofit.c _cff.c _ftbase.c _ftbitmap.c _ftglyph.c _ftinit.c _ftsynth.c _psaux.c _pshinter.c _psmodule.c _sfnt.c _smooth.c _truetype.c _type1.c Vorbis.c main.c Platform_Symbian.cpp Graphics_GL2.c Window_Symbian.cpp
SOURCEPATH ../../third_party/bearssl/src
SOURCE aes_big_cbcdec.c aes_big_cbcenc.c aes_big_ctr.c aes_big_ctrcbc.c aes_big_dec.c aes_big_enc.c aes_common.c aes_ct.c aes_ct64.c aes_ct64_cbcdec.c aes_ct64_cbcenc.c aes_ct64_ctr.c aes_ct64_ctrcbc.c aes_ct64_dec.c aes_ct64_enc.c aes_ct_cbcdec.c aes_ct_cbcenc.c aes_ct_ctr.c aes_ct_ctrcbc.c aes_ct_dec.c aes_ct_enc.c aes_small_cbcdec.c aes_small_cbcenc.c aes_small_ctr.c aes_small_ctrcbc.c aes_small_dec.c aes_small_enc.c aes_x86ni.c aes_x86ni_cbcdec.c aes_x86ni_cbcenc.c aes_x86ni_ctr.c aes_x86ni_ctrcbc.c aesctr_drbg.c asn1enc.c ccm.c ccopy.c chacha20_ct.c chacha20_sse2.c dec16be.c dec16le.c dec32be.c dec32le.c dec64be.c dec64le.c des_ct.c des_ct_cbcdec.c des_ct_cbcenc.c des_support.c des_tab.c des_tab_cbcdec.c des_tab_cbcenc.c dig_oid.c dig_size.c eax.c ec_all_m15.c ec_all_m31.c ec_c25519_i15.c ec_c25519_i31.c ec_c25519_m15.c ec_c25519_m31.c ec_c25519_m62.c ec_c25519_m64.c ec_curve25519.c ec_default.c ec_keygen.c ec_p256_m15.c ec_p256_m31.c ec_p256_m62.c ec_p256_m64.c ec_prime_i15.c ec_prime_i31.c ec_pubkey.c ec_secp256r1.c ec_secp384r1.c ec_secp521r1.c ecdsa_atr.c ecdsa_default_sign_asn1.c ecdsa_default_sign_raw.c ecdsa_default_vrfy_asn1.c ecdsa_default_vrfy_raw.c ecdsa_i15_bits.c ecdsa_i15_sign_asn1.c ecdsa_i15_sign_raw.c ecdsa_i15_vrfy_asn1.c ecdsa_i15_vrfy_raw.c ecdsa_i31_bits.c ecdsa_i31_sign_asn1.c ecdsa_i31_sign_raw.c ecdsa_i31_vrfy_asn1.c ecdsa_i31_vrfy_raw.c ecdsa_rta.c enc16be.c enc16le.c enc32be.c enc32le.c enc64be.c enc64le.c encode_ec_pk8der.c encode_ec_rawder.c encode_rsa_pk8der.c encode_rsa_rawder.c gcm.c ghash_ctmul.c ghash_ctmul32.c ghash_ctmul64.c ghash_pclmul.c hkdf.c hmac.c hmac_ct.c hmac_drbg.c i15_add.c i15_bitlen.c i15_decmod.c i15_decode.c i15_decred.c i15_encode.c i15_fmont.c i15_iszero.c i15_moddiv.c i15_modpow.c i15_modpow2.c i15_montmul.c i15_mulacc.c i15_muladd.c i15_ninv15.c i15_reduce.c i15_rshift.c i15_sub.c i15_tmont.c i31_add.c i31_bitlen.c i31_decmod.c i31_decode.c i31_decred.c i31_encode.c i31_fmont.c i31_iszero.c i31_moddiv.c i31_modpow.c i31_modpow2.c i31_montmul.c i31_mulacc.c i31_muladd.c i31_ninv31.c i31_reduce.c i31_rshift.c i31_sub.c i31_tmont.c i32_add.c i32_bitlen.c i32_decmod.c i32_decode.c i32_decred.c i32_div32.c i32_encode.c i32_fmont.c i32_iszero.c i32_modpow.c i32_montmul.c i32_mulacc.c i32_muladd.c i32_ninv32.c i32_reduce.c i32_sub.c i32_tmont.c i62_modpow2.c md5.c md5sha1.c mgf1.c multihash.c poly1305_ctmul.c poly1305_ctmul32.c poly1305_ctmulq.c poly1305_i15.c prf.c prf_md5sha1.c prf_sha256.c prf_sha384.c rsa_default_keygen.c rsa_default_modulus.c rsa_default_oaep_decrypt.c rsa_default_oaep_encrypt.c rsa_default_pkcs1_sign.c rsa_default_pkcs1_vrfy.c rsa_default_priv.c rsa_default_privexp.c rsa_default_pss_sign.c rsa_default_pss_vrfy.c rsa_default_pub.c rsa_default_pubexp.c rsa_i15_keygen.c rsa_i15_modulus.c rsa_i15_oaep_decrypt.c rsa_i15_oaep_encrypt.c rsa_i15_pkcs1_sign.c rsa_i15_pkcs1_vrfy.c rsa_i15_priv.c rsa_i15_privexp.c rsa_i15_pss_sign.c rsa_i15_pss_vrfy.c rsa_i15_pub.c rsa_i15_pubexp.c rsa_i31_keygen.c rsa_i31_keygen_inner.c rsa_i31_modulus.c rsa_i31_oaep_decrypt.c rsa_i31_oaep_encrypt.c rsa_i31_pkcs1_sign.c rsa_i31_pkcs1_vrfy.c rsa_i31_priv.c rsa_i31_privexp.c rsa_i31_pss_sign.c rsa_i31_pss_vrfy.c rsa_i31_pub.c rsa_i31_pubexp.c rsa_i32_oaep_decrypt.c rsa_i32_oaep_encrypt.c rsa_i32_pkcs1_sign.c rsa_i32_pkcs1_vrfy.c rsa_i32_priv.c rsa_i32_pss_sign.c rsa_i32_pss_vrfy.c rsa_i32_pub.c rsa_i62_keygen.c rsa_i62_oaep_decrypt.c rsa_i62_oaep_encrypt.c rsa_i62_pkcs1_sign.c rsa_i62_pkcs1_vrfy.c rsa_i62_priv.c rsa_i62_pss_sign.c rsa_i62_pss_vrfy.c rsa_i62_pub.c rsa_oaep_pad.c rsa_oaep_unpad.c rsa_pkcs1_sig_pad.c rsa_pkcs1_sig_unpad.c rsa_pss_sig_pad.c rsa_pss_sig_unpad.c rsa_ssl_decrypt.c settings.c sha1.c sha2big.c sha2small.c shake.c skey_decoder.c ssl_ccert_single_ec.c ssl_ccert_single_rsa.c ssl_client.c ssl_client_default_rsapub.c ssl_client_full.c ssl_engine.c ssl_engine_default_aescbc.c ssl_engine_default_aesccm.c ssl_engine_default_aesgcm.c ssl_engine_default_chapol.c ssl_engine_default_descbc.c ssl_engine_default_ec.c ssl_engine_default_ecdsa.c ssl_engine_default_rsavrfy.c ssl_hashes.c ssl_hs_client.c ssl_io.c ssl_keyexport.c ssl_lru.c ssl_rec_cbc.c ssl_rec_ccm.c ssl_rec_chapol.c ssl_rec_gcm.c ssl_scert_single_ec.c ssl_scert_single_rsa.c sysrng.c x509_decoder.c x509_knownkey.c x509_minimal.c x509_minimal_full.c
CAPABILITY NetworkServices ReadUserData UserEnvironment WriteUserData
EPOCSTACKSIZE 0x14000
EPOCHEAPSIZE 0x80000 0x4000000
#ifdef _DEBUG
DEBUGGABLE_UDEBONLY
SRCDBG
#endif

View File

@ -0,0 +1,16 @@
TARGET ClassiCube_s60v3.exe
LIBRARY libgles_cm.lib
SOURCEPATH .
START RESOURCE classicube.rss
HEADER
TARGETPATH \resource\apps
LANG SC
END
START RESOURCE classicube_reg.rss
TARGETPATH \private\10003a3f\import\apps
END
#include "ClassiCube_common.mmh"

View File

@ -0,0 +1,18 @@
TARGET ClassiCube_s60v5.exe
MACRO CC_BUILD_SYMBIAN_S60V5
LIBRARY libgles_cm.lib
SOURCEPATH .
START RESOURCE classicube.rss
HEADER
TARGETPATH \resource\apps
LANG SC
END
START RESOURCE classicube_reg.rss
TARGETPATH \private\10003a3f\import\apps
END
#include "ClassiCube_common.mmh"

View File

@ -0,0 +1,22 @@
TARGET ClassiCube_sym3.exe
MACRO CC_BUILD_SYMBIAN_3
MACRO CC_BUILD_SYMBIAN_LIBGLESV2
ARMFPU vfpv2
LIBRARY libglesv2.lib
LIBRARY libegl.lib
SOURCEPATH .
START RESOURCE classicube.rss
HEADER
TARGETPATH \resource\apps
LANG SC
END
START RESOURCE classicube_reg.rss
TARGETPATH \private\10003a3f\import\apps
END
#include "ClassiCube_common.mmh"

View File

@ -0,0 +1,47 @@
ifeq (WINS,$(findstring WINS, $(PLATFORM)))
ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
else
ZDIR=$(EPOCROOT)epoc32\data\z
endif
TARGETDIR=$(ZDIR)\resource\apps
ICONTARGETFILENAME=$(TARGETDIR)\classicube_icon.mif
ICONDIR=.
do_nothing :
@rem do_nothing
MAKMAKE : do_nothing
BLD : do_nothing
CLEAN :
@echo ...Deleting $(ICONTARGETFILENAME)
del /q /f $(ICONTARGETFILENAME)
LIB : do_nothing
CLEANLIB : do_nothing
# ----------------------------------------------------------------------------
# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK
# and this command crashes, consider adding "/X" to the command line.
# See <http://forum.nokia.com/document/Forum_Nokia_Technical_Library_v1_35/contents/FNTL/Build_process_fails_at_mif_file_creation_in_S60_3rd_Ed_FP1_SDK.htm>
# ----------------------------------------------------------------------------
RESOURCE : $(ICONTARGETFILENAME)
$(ICONTARGETFILENAME) : $(ICONDIR)\qgn_menu_classicube.svg
mifconv $(ICONTARGETFILENAME) \
/c32 $(ICONDIR)\qgn_menu_classicube.svg
FREEZE : do_nothing
SAVESPACE : do_nothing
RELEASABLES :
@echo $(ICONTARGETFILENAME)
FINAL : do_nothing

8
misc/symbian/bld.inf Normal file
View File

@ -0,0 +1,8 @@
PRJ_PLATFORMS
DEFAULT
PRJ_MMPFILES
gnumakefile Icons_scalable_dc.mk
ClassiCube_sym3.mmp
ClassiCube_s60v5.mmp
ClassiCube_s60v3.mmp

View File

@ -0,0 +1,24 @@
NAME CUBE
#include <eikon.rh>
#include <avkon.rsg>
#include <avkon.rh>
#include <avkon.mbg>
#include <appinfo.rh>
RESOURCE RSS_SIGNATURE { }
RESOURCE TBUF { buf="ClassiCube"; }
rls_string STRING_app_caption_string "ClassiCube"
rls_string STRING_app_short_caption_string "ClassiCube"
RESOURCE LOCALISABLE_APP_INFO r_ClassiCube_localisable_app_info
{
short_caption = STRING_app_short_caption_string;
caption_and_icon = CAPTION_AND_ICON_INFO
{
caption = STRING_app_caption_string;
number_of_icons = 1;
icon_file = "\\resource\\apps\\classicube_icon.mif";
};
}

View File

@ -0,0 +1,17 @@
#include <appinfo.rh>
#include <classicube.rsg>
UID2 KUidAppRegistrationResourceFile
UID3 0xE212A5C2
RESOURCE APP_REGISTRATION_INFO
{
app_file="ClassiCube";
localisable_resource_file="\\resource\\apps\\classicube";
localisable_resource_id=R_CLASSICUBE_LOCALISABLE_APP_INFO;
embeddability=KAppNotEmbeddable;
newfile=KAppDoesNotSupportNewFile;
}

View File

@ -0,0 +1 @@
OpenC version 1.5 or later is required for installation.

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="100%" height="100%" version="1.1" viewBox="0 0 88 88" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<path d="m8.6441 64.121v-40.242c11.799-6.762 23.599-13.524 35.398-20.286 11.771 6.762 23.543 13.524 35.314 20.286v40.242c-11.771 6.762-23.543 13.524-35.314 20.286-11.799-6.762-23.599-13.524-35.398-20.286z" fill="#f6f6f6" stroke="#000" stroke-width="2.5254"/>
<path d="m43.242 43.589c11.615-6.329 23.229-12.658 34.844-18.987 0.17061 13.036 0.34123 26.072 0.51184 39.108-11.52 6.4137-23.039 12.827-34.559 19.241-0.26561-13.121-0.53123-26.241-0.79684-39.362zm6.4887 29.498c9.148-2.1355 17.3-7.5418 23.918-14.079 2.7409-3.4291-4.301-0.72803-5.9376-0.4517-0.20872-3.5138 0.79405-7.3219 1.0902-10.957 0.49356-3.7678 0.9984-7.5342 1.444-11.308-6.8805-0.31126-12.924 4.2171-17.523 8.8664-2.1717 2.9619 0.65966 7.2913 0.54964 10.869 0.8233 2.4955 0.21876 7.281 2.0147 8.2719 3.4806-0.47883 7.7111-4.7265 10.08-4.3993-2.7336 3.4438-7.1559 4.7844-10.984 6.537-1.8594 1.7557-6.9131 4.503-5.9665 6.7361l0.74082-0.03487z" fill="#cbcbcb" stroke-width=".082874"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -667,7 +667,12 @@ static cc_result Png_EncodeCore(struct Bitmap* bmp, struct Stream* stream, cc_ui
cc_uint8* curLine = buffer + (bmp->width * 4) * 1;
cc_uint8* bestLine = buffer + (bmp->width * 4) * 2;
struct ZLibState zlState;
#if CC_BUILD_MAXSTACK <= (50 * 1024)
struct ZLibState* zlState = (struct ZLibState*)Mem_TryAlloc(1, sizeof(struct ZLibState));
#else
struct ZLibState _zlState;
struct ZLibState* zlState = &_zlState;
#endif
struct Stream chunk, zlStream;
cc_uint32 stream_end, stream_beg;
int y, lineSize;
@ -700,7 +705,7 @@ static cc_result Png_EncodeCore(struct Bitmap* bmp, struct Stream* stream, cc_ui
Stream_SetU32_BE(&tmp[0], PNG_FourCC('I','D','A','T'));
if ((res = Stream_Write(&chunk, tmp, 4))) return res;
ZLib_MakeStream(&zlStream, &zlState, &chunk);
ZLib_MakeStream(&zlStream, zlState, &chunk);
lineSize = bmp->width * (alpha ? 4 : 3);
Mem_Set(prevLine, 0, lineSize);

View File

@ -355,6 +355,7 @@ void Camera_SetFov(int fov) {
}
void Camera_UpdateProjection(void) {
if (!Camera.Active) return;
Camera.Active->GetProjection(&Gfx.Projection);
Gfx_LoadMatrix(MATRIX_PROJ, &Gfx.Projection);
Event_RaiseVoid(&GfxEvents.ProjectionChanged);
@ -377,6 +378,8 @@ static void OnInit(void) {
#ifdef CC_BUILD_WIN
Camera.Sensitivity = Options_GetInt(OPT_SENSITIVITY, 1, 200, 40);
#elif defined CC_BUILD_SYMBIAN && defined CC_BUILD_TOUCH
Camera.Sensitivity = Options_GetInt(OPT_SENSITIVITY, 1, 200, 70);
#else
Camera.Sensitivity = Options_GetInt(OPT_SENSITIVITY, 1, 200, 30);
#endif

View File

@ -201,7 +201,7 @@ typedef cc_uint8 cc_bool;
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_D3D11
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
#elif defined _WIN32
#elif defined _WIN32 && !defined __WINSCW__
#define CC_BUILD_WIN
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_SCHANNEL
@ -551,6 +551,27 @@ typedef cc_uint8 cc_bool;
#define CC_GFX_BACKEND CC_GFX_BACKEND_SOFTGPU
#define CC_DISABLE_EXTRA_MODELS
#define SOFTGPU_DISABLE_ZBUFFER
#elif defined __SYMBIAN32__
#define CC_BUILD_SYMBIAN
#define CC_BUILD_MOBILE
#define CC_BUILD_POSIX
#define CC_BUILD_GLES
#define CC_BUILD_EGL
#define CC_BUILD_MAXSTACK (16 * 1024)
#define CC_BUILD_LOWMEM
#define CC_BUILD_NOMUSIC
#define CC_BUILD_NOSOUNDS
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
#if defined CC_BUILD_SYMBIAN_LIBGLESV2
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL2
#else
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
#endif
#if defined CC_BUILD_SYMBIAN_3 || defined CC_BUILD_SYMBIAN_S60V5
#define CC_BUILD_TOUCH
#endif
#endif
#endif

View File

@ -1207,7 +1207,7 @@ static cc_result Zip_ReadLocalFileHeader(struct ZipState* state, struct ZipEntry
Stream_ReadonlyPortion(&portion, stream, compressedSize);
#if CC_BUILD_MAXSTACK <= (64 * 1024)
inflate = Mem_TryAlloc(1, sizeof(struct InflateState));
inflate = (struct InflateState*)Mem_TryAlloc(1, sizeof(struct InflateState));
if (!inflate) return ERR_OUT_OF_MEMORY;
Inflate_MakeStream2(&compStream, inflate, &portion);

View File

@ -809,8 +809,10 @@ static CC_INLINE void Game_RenderFrame(void) {
EnvRenderer_UpdateFog();
AudioBackend_Tick();
#if !defined CC_BUILD_SYMBIAN
/* TODO: Not calling Gfx_EndFrame doesn't work with Direct3D9 */
if (Window_Main.Inactive) return;
#endif
Gfx_ClearBuffers(GFX_BUFFER_COLOR | GFX_BUFFER_DEPTH);
#ifdef CC_BUILD_SPLITSCREEN

View File

@ -565,10 +565,21 @@ static void NotchyGen_CreateSurfaceLayer(void) {
int hIndex = 0, index;
BlockRaw above;
int x, y, z;
struct OctaveNoise n1, n2;
#if CC_BUILD_MAXSTACK <= (16 * 1024)
struct NoiseBuffer {
struct OctaveNoise n1, n2;
};
struct NoiseBuffer* buf = TempMem_Alloc(sizeof(struct NoiseBuffer));
struct OctaveNoise* n1 = &buf->n1;
struct OctaveNoise* n2 = &buf->n2;
#else
struct OctaveNoise _n1, _n2;
struct OctaveNoise* n1 = &_n1;
struct OctaveNoise* n2 = &_n2;
#endif
OctaveNoise_Init(&n1, &rnd, 8);
OctaveNoise_Init(&n2, &rnd, 8);
OctaveNoise_Init(n1, &rnd, 8);
OctaveNoise_Init(n2, &rnd, 8);
Gen_CurrentState = "Creating surface";
for (z = 0; z < World.Length; z++) {
@ -582,10 +593,10 @@ static void NotchyGen_CreateSurfaceLayer(void) {
above = y >= World.MaxY ? BLOCK_AIR : Gen_Blocks[index + World.OneY];
/* TODO: update heightmap */
if (above == BLOCK_STILL_WATER && (OctaveNoise_Calc(&n2, (float)x, (float)z) > 12)) {
if (above == BLOCK_STILL_WATER && (OctaveNoise_Calc(n2, (float)x, (float)z) > 12)) {
Gen_Blocks[index] = BLOCK_GRAVEL;
} else if (above == BLOCK_AIR) {
Gen_Blocks[index] = (y <= waterLevel && (OctaveNoise_Calc(&n1, (float)x, (float)z) > 8)) ? BLOCK_SAND : BLOCK_GRASS;
Gen_Blocks[index] = (y <= waterLevel && (OctaveNoise_Calc(n1, (float)x, (float)z) > 8)) ? BLOCK_SAND : BLOCK_GRASS;
}
}
}

View File

@ -21,13 +21,21 @@
/* e.g. GLAPI void APIENTRY glFunction(int value); */
#define GL_FUNC(retType, name, args) GLAPI retType APIENTRY name args;
#include "../misc/opengl/GL1Funcs.h"
#if defined CC_BUILD_SYMBIAN
#include "../misc/opengl/GL2Funcs.h"
#endif
#if defined CC_BUILD_GL11
static GLuint activeList;
#define gl_DYNAMICLISTID 1234567891
static void* dynamicListData;
static cc_uint16 gl_indices[GFX_MAX_INDICES];
#define GL_INDICES
#else
#if CC_BUILD_MAXSTACK <= (64 * 1024)
static cc_uint16 gl_indices[GFX_MAX_INDICES];
#define GL_INDICES
#endif
/* OpenGL functions use stdcall instead of cdecl on Windows */
static void (APIENTRY *_glBindBuffer)(GLenum target, GfxResourceID buffer); /* NOTE: buffer is actually a GLuint in OpenGL */
static void (APIENTRY *_glDeleteBuffers)(GLsizei n, const GLuint *buffers);
@ -96,14 +104,16 @@ void Gfx_Create(void) {
*#########################################################################################################################*/
#ifndef CC_BUILD_GL11
GfxResourceID Gfx_CreateIb2(int count, Gfx_FillIBFunc fillFunc, void* obj) {
cc_uint16 indices[GFX_MAX_INDICES];
#ifndef GL_INDICES
cc_uint16* gl_indices[GFX_MAX_INDICES];
#endif
GfxResourceID id = NULL;
cc_uint32 size = count * sizeof(cc_uint16);
_glGenBuffers(1, (GLuint*)&id);
fillFunc(indices, count, obj);
fillFunc(gl_indices, count, obj);
_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id);
_glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, indices, GL_STATIC_DRAW);
_glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, gl_indices, GL_STATIC_DRAW);
return id;
}
@ -470,6 +480,9 @@ static void Gfx_RestoreState(void) {
gfx_format = -1;
_glHint(GL_FOG_HINT, GL_NICEST);
#if defined CC_BUILD_SYMBIAN
_glHint(0x0C50 /*GL_PERSPECTIVE_CORRECTION_HINT*/, GL_NICEST);
#endif
_glAlphaFunc(GL_GREATER, 0.5f);
_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
_glDepthFunc(GL_LEQUAL);
@ -692,6 +705,22 @@ static void FallbackOpenGL(void) {
#endif
static void GLBackend_Init(void) {
#if defined CC_BUILD_SYMBIAN
static const cc_string bgra_ext = String_FromConst("EXT_texture_format_BGRA8888");
static const cc_string bgra_sym = String_FromConst("GL_IMG_texture_format_BGRA8888");
cc_string extensions = String_FromReadonly((const char*)_glGetString(GL_EXTENSIONS));
cc_bool has_ext_bgra = String_CaselessContains(&extensions, &bgra_ext);
cc_bool has_sym_bgra = String_CaselessContains(&extensions, &bgra_sym);
_glGenBuffers = glGenBuffers;
_glDeleteBuffers = glDeleteBuffers;
_glBindBuffer = glBindBuffer;
_glBufferData = glBufferData;
_glBufferSubData = glBufferSubData;
convert_rgba = PIXEL_FORMAT != GL_RGBA && !has_ext_bgra && !has_sym_bgra;
#else
static const struct DynamicLibSym coreVboFuncs[] = {
DynamicLib_ReqSym2("glBindBuffer", glBindBuffer), DynamicLib_ReqSym2("glDeleteBuffers", glDeleteBuffers),
DynamicLib_ReqSym2("glGenBuffers", glGenBuffers), DynamicLib_ReqSym2("glBufferData", glBufferData),
@ -721,6 +750,7 @@ static void GLBackend_Init(void) {
convert_rgba = major == 1 && minor <= 1 && !String_CaselessContains(&extensions, &bgraExt);
FallbackOpenGL();
}
#endif
}
#endif
#endif

View File

@ -35,6 +35,11 @@ static const struct DynamicLibSym core_funcs[] = {
#include "../misc/opengl/GL1Macros.h"
#if CC_BUILD_MAXSTACK <= (64 * 1024)
static cc_uint16 gl_indices[GFX_MAX_INDICES];
#define GL_INDICES
#endif
#include "_GLShared.h"
static void GLBackend_Init(void);
@ -68,12 +73,14 @@ static GLuint GL_GenAndBind(GLenum target) {
}
GfxResourceID Gfx_CreateIb2(int count, Gfx_FillIBFunc fillFunc, void* obj) {
cc_uint16 indices[GFX_MAX_INDICES];
#ifndef GL_INDICES
cc_uint16 gl_indices[GFX_MAX_INDICES];
#endif
GLuint id = GL_GenAndBind(GL_ELEMENT_ARRAY_BUFFER);
cc_uint32 size = count * sizeof(cc_uint16);
fillFunc(indices, count, obj);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, indices, GL_STATIC_DRAW);
fillFunc(gl_indices, count, obj);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, gl_indices, GL_STATIC_DRAW);
return uint_to_ptr(id);
}
@ -535,18 +542,22 @@ static void GLBackend_Init(void) {
#define _GL_MINOR_VERSION 33308
GLint major = 0, minor = 0;
glGetIntegerv(_GL_MAJOR_VERSION, &major);
glGetIntegerv(_GL_MINOR_VERSION, &minor);
customMipmapsLevels = major >= 3 && minor >= 2;
static const cc_string bgra_ext = String_FromConst("EXT_texture_format_BGRA8888");
static const cc_string bgra_ext = String_FromConst("EXT_texture_format_BGRA8888");
static const cc_string bgra_apl = String_FromConst("APPLE_texture_format_BGRA8888");
static const cc_string bgra_sym = String_FromConst("GL_IMG_texture_format_BGRA8888");
cc_string extensions = String_FromReadonly((const char*)_glGetString(GL_EXTENSIONS));
cc_bool has_ext_bgra = String_CaselessContains(&extensions, &bgra_ext);
cc_bool has_apl_bgra = String_CaselessContains(&extensions, &bgra_apl);
cc_bool has_sym_bgra = String_CaselessContains(&extensions, &bgra_sym);
glGetIntegerv(_GL_MAJOR_VERSION, &major);
glGetIntegerv(_GL_MINOR_VERSION, &minor);
customMipmapsLevels = major >= 3 && minor >= 2;
Platform_Log2("BGRA support - Ext: %t, Apple: %t", &has_ext_bgra, &has_apl_bgra);
convert_rgba = PIXEL_FORMAT != GL_RGBA && !has_ext_bgra && !has_apl_bgra;
convert_rgba = PIXEL_FORMAT != GL_RGBA && !has_ext_bgra && !has_apl_bgra && !has_sym_bgra;
#else
customMipmapsLevels = true;
const GLubyte* ver = glGetString(GL_VERSION);
@ -583,6 +594,9 @@ static void Gfx_FreeState(void) {
}
static void Gfx_RestoreState(void) {
struct Bitmap bmp;
BitmapCol pixels[1] = { BITMAPCOLOR_WHITE };
InitDefaultResources();
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
@ -594,8 +608,6 @@ static void Gfx_RestoreState(void) {
glDepthFunc(GL_LEQUAL);
/* 1x1 dummy white texture */
struct Bitmap bmp;
BitmapCol pixels[1] = { BITMAPCOLOR_WHITE };
Bitmap_Init(bmp, 1, 1, pixels);
Gfx_RecreateTexture(&white_square, &bmp, 0, false);
}

View File

@ -124,7 +124,11 @@ static void LoadOptions(void) {
Gui.ShowFPS = Options_GetBool(OPT_SHOW_FPS, true);
Gui.RawInventoryScale = Options_GetFloat(OPT_INVENTORY_SCALE, 0.25f, 5.0f, 1.0f);
#if defined CC_BUILD_SYMBIAN && defined CC_BUILD_TOUCH
Gui.RawHotbarScale = Options_GetFloat(OPT_HOTBAR_SCALE, 0.25f, 5.0f, 2.0f);
#else
Gui.RawHotbarScale = Options_GetFloat(OPT_HOTBAR_SCALE, 0.25f, 5.0f, 1.0f);
#endif
Gui.RawChatScale = Options_GetFloat(OPT_CHAT_SCALE, 0.25f, 5.0f, 1.0f);
Gui.RawCrosshairScale = Options_GetFloat(OPT_CROSSHAIR_SCALE, 0.25f, 5.0f, 1.0f);
Gui.RawTouchScale = Options_GetFloat(OPT_TOUCH_SCALE, 0.25f, 5.0f, 1.0f);

View File

@ -839,7 +839,7 @@ static void MainScreen_ApplyUpdateLabel(struct MainScreen* s) {
}
}
#ifdef CC_BUILD_CONSOLE
#if defined CC_BUILD_CONSOLE || defined CC_BUILD_SYMBIAN
static void MainScreen_ExitApp(void* w) {
Window_Main.Exists = false;
}
@ -880,7 +880,7 @@ static void MainScreen_Activated(struct LScreen* s_) {
LButton_Add(s, &s->btnOptions, 100, 35, "Options",
SwitchToSettings, main_btnOptions);
#ifdef CC_BUILD_CONSOLE
#if defined CC_BUILD_CONSOLE || defined CC_BUILD_SYMBIAN
LLabel_Add(s, &s->lblUpdate, "&eChecking..", main_lblUpdate_N);
LButton_Add(s, &s->btnUpdates, 100, 35, "Exit",
MainScreen_ExitApp, main_btnUpdates);

View File

@ -27,7 +27,7 @@
static HANDLE curProcess = CUR_PROCESS_HANDLE;
static cc_uintptr spRegister;
#elif defined CC_BUILD_OPENBSD || defined CC_BUILD_HAIKU || defined CC_BUILD_SERENITY
#elif defined CC_BUILD_OPENBSD || defined CC_BUILD_HAIKU || defined CC_BUILD_SERENITY || defined CC_BUILD_SYMBIAN
#include <signal.h>
/* These operating systems don't provide sys/ucontext.h */
/* But register constants be found from includes in <signal.h> */
@ -276,7 +276,7 @@ static void DumpFrame(cc_string* trace, void* addr) {
cc_uintptr addr_ = (cc_uintptr)addr;
String_Format1(trace, "%x", &addr_);
}
#elif defined CC_BUILD_POSIX && !defined CC_BUILD_OS2
#elif defined CC_BUILD_POSIX && !defined CC_BUILD_OS2 && !defined CC_BUILD_SYMBIAN
/* need to define __USE_GNU for dladdr */
#ifndef __USE_GNU
#define __USE_GNU
@ -446,6 +446,11 @@ void Logger_Backtrace(cc_string* trace, void* ctx) {
}
String_AppendConst(trace, _NL);
}
#elif defined CC_BUILD_SYMBIAN
void Logger_Backtrace(cc_string* trace, void* ctx) {
String_AppendConst(trace, "-- backtrace unimplemented --");
/* There is no dladdr on Symbian */
}
#elif defined CC_BUILD_POSIX
/* musl etc - rely on unwind from GCC instead */
#define CC_BACKTRACE_UNWIND

View File

@ -1391,7 +1391,7 @@ static cc_result SaveLevelScreen_SaveMap(const cc_string* path) {
struct GZipState* state;
cc_result res;
state = Mem_TryAlloc(1, sizeof(struct GZipState));
state = (struct GZipState*)Mem_TryAlloc(1, sizeof(struct GZipState));
res = ERR_OUT_OF_MEMORY;
if (!state) { Logger_SysWarn(res, "allocating temp memory"); return res; }

View File

@ -200,7 +200,7 @@ void Model_LockVB(struct Entity* entity, int verticesCount) {
#endif
real_vertices = Models.Vertices;
Models.Vertices = Gfx_LockDynamicVb(modelVB, VERTEX_FORMAT_TEXTURED, verticesCount);
Models.Vertices = (struct VertexTextured*)Gfx_LockDynamicVb(modelVB, VERTEX_FORMAT_TEXTURED, verticesCount);
}
void Model_UnlockVB(void) {
@ -530,7 +530,7 @@ struct CustomModel* CustomModel_Get(int id) {
/* TODO log message if allocation fails? */
if (!custom_models)
custom_models = Mem_TryAlloc(MAX_CUSTOM_MODELS, sizeof(struct CustomModel));
custom_models = (struct CustomModel*)Mem_TryAlloc(MAX_CUSTOM_MODELS, sizeof(struct CustomModel));
if (!custom_models) return NULL;
return &custom_models[id];

View File

@ -14,11 +14,26 @@
#include <errno.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <pthread.h>
#include <utime.h>
#include <signal.h>
#include <stdio.h>
#if defined CC_BUILD_SYMBIAN
#include <stdapis/string.h>
#include <stdapis/arpa/inet.h>
#include <stdapis/netinet/in.h>
#include <stdapis/sys/socket.h>
#include <stdapis/sys/ioctl.h>
#include <stdapis/sys/types.h>
#include <stdapis/sys/stat.h>
#include <stdapis/sys/time.h>
#include <stdapis/sys/select.h>
#include <stdapis/netdb.h>
#else
#include <string.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
@ -26,10 +41,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <utime.h>
#include <signal.h>
#include <stdio.h>
#include <netdb.h>
#endif
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
const cc_result ReturnCode_FileNotFound = ENOENT;
@ -87,10 +100,13 @@ cc_bool Platform_ReadonlyFilesystem;
/*########################################################################################################################*
*---------------------------------------------------------Memory----------------------------------------------------------*
*#########################################################################################################################*/
void* Mem_Set(void* dst, cc_uint8 value, unsigned numBytes) { return memset( dst, value, numBytes); }
void* Mem_Copy(void* dst, const void* src, unsigned numBytes) { return memcpy( dst, src, numBytes); }
void* Mem_Move(void* dst, const void* src, unsigned numBytes) { return memmove(dst, src, numBytes); }
void* Mem_Set(void* dst, cc_uint8 value, unsigned numBytes) { return (void*) memset( dst, value, numBytes); }
void* Mem_Copy(void* dst, const void* src, unsigned numBytes) { return (void*) memcpy( dst, src, numBytes); }
void* Mem_Move(void* dst, const void* src, unsigned numBytes) { return (void*) memmove(dst, src, numBytes); }
#if defined CC_BUILD_SYMBIAN
/* implemented in Platform_Symbian.cpp */
#else
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
cc_uint32 size = CalcMemSize(numElems, elemsSize);
return size ? malloc(size) : NULL;
@ -108,6 +124,7 @@ void* Mem_TryRealloc(void* mem, cc_uint32 numElems, cc_uint32 elemsSize) {
void Mem_Free(void* mem) {
if (mem) free(mem);
}
#endif
/*########################################################################################################################*
@ -135,8 +152,11 @@ TimeMS DateTime_CurrentUTC(void) {
void DateTime_CurrentLocal(struct cc_datetime* t) {
struct timeval cur;
struct tm loc_time;
time_t s;
gettimeofday(&cur, NULL);
localtime_r(&cur.tv_sec, &loc_time);
s = cur.tv_sec;
localtime_r(&s, &loc_time);
t->year = loc_time.tm_year + 1900;
t->month = loc_time.tm_mon + 1;
@ -154,6 +174,8 @@ void DateTime_CurrentLocal(struct cc_datetime* t) {
#if defined CC_BUILD_HAIKU || defined CC_BUILD_BEOS
/* Implemented in interop_BeOS.cpp */
#elif defined CC_BUILD_SYMBIAN
/* Implemented in Platform_Symbian.cpp */
#elif defined CC_BUILD_DARWIN
static cc_uint64 sw_freqMul, sw_freqDiv;
static void Stopwatch_Init(void) {
@ -251,6 +273,9 @@ static void SignalHandler(int sig, siginfo_t* info, void* ctx) {
Logger_DoAbort(0, msg.buffer, ctx);
}
#if defined CC_BUILD_SYMBIAN
/* implemented in Platform_Symbian.cpp */
#else
void CrashHandler_Install(void) {
struct sigaction sa = { 0 };
/* sigemptyset(&sa.sa_mask); */
@ -264,6 +289,7 @@ void CrashHandler_Install(void) {
sigaction(SIGABRT, &sa, NULL);
sigaction(SIGFPE, &sa, NULL);
}
#endif
void Process_Abort2(cc_result result, const char* raw_msg) {
Logger_DoAbort(result, raw_msg, NULL);
@ -326,7 +352,7 @@ cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCall
len = String_Length(src);
String_AppendUtf8(&path, src, len);
#if defined CC_BUILD_HAIKU || defined CC_BUILD_SOLARIS || defined CC_BUILD_HPUX || defined CC_BUILD_IRIX || defined CC_BUILD_BEOS
#if defined CC_BUILD_HAIKU || defined CC_BUILD_SOLARIS || defined CC_BUILD_HPUX || defined CC_BUILD_IRIX || defined CC_BUILD_BEOS || defined CC_BUILD_SYMBIAN
{
char full_path[NATIVE_STR_LEN];
struct stat sb;
@ -435,6 +461,11 @@ void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char*
*handle = ptr;
pthread_attr_init(&attrs);
#if defined CC_BUILD_SYMBIAN
if (stackSize >= 64 * 1024) {
stackSize = 64 * 1024;
}
#endif
pthread_attr_setstacksize(&attrs, stackSize);
res = pthread_create(ptr, &attrs, ExecThread, (void*)func);
@ -631,6 +662,11 @@ void Platform_LoadSysFonts(void) {
String_FromConst("/@unixroot/usr/share/fonts"),
String_FromConst("/@unixroot/usr/local/share/fonts")
};
#elif defined CC_BUILD_SYMBIAN
static const cc_string dirs[] = {
String_FromConst("Z:\\resource\\fonts"),
String_FromConst("C:\\resource\\fonts")
};
#else
static const cc_string dirs[] = {
String_FromConst("/usr/share/fonts"),
@ -649,7 +685,7 @@ void Platform_LoadSysFonts(void) {
/*########################################################################################################################*
*---------------------------------------------------------Socket----------------------------------------------------------*
*#########################################################################################################################*/
#if defined CC_BUILD_OS2
#if defined CC_BUILD_OS2 || defined CC_BUILD_SYMBIAN
#undef AF_INET6
#endif
@ -766,7 +802,16 @@ cc_result Socket_Create(cc_socket* s, cc_sockaddr* addr, cc_bool nonblocking) {
if (nonblocking) {
int blocking_raw = -1; /* non-blocking mode */
ioctl(*s, FIONBIO, &blocking_raw);
#if defined CC_BUILD_SYMBIAN
int res = fcntl(*s, F_GETFL, 0);
if (res < 0) return errno;
res = fcntl(*s, F_SETFL, res | O_NONBLOCK);
if (res < 0) return errno;
#else
int err = ioctl(*s, FIONBIO, &blocking_raw);
if (err == -1) return errno;
#endif
}
return 0;
}
@ -795,7 +840,7 @@ void Socket_Close(cc_socket s) {
close(s);
}
#if defined CC_BUILD_DARWIN || defined CC_BUILD_BEOS
#if defined CC_BUILD_DARWIN || defined CC_BUILD_BEOS || defined CC_BUILD_SYMBIAN
/* poll is broken on old OSX apparently https://daniel.haxx.se/docs/poll-vs-select.html */
/* BeOS lacks support for poll */
static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
@ -908,6 +953,8 @@ void Process_Exit(cc_result code) { exit(code); }
/* Implemented in Platform_Android.c */
#elif defined CC_BUILD_IOS
/* implemented in interop_ios.m */
#elif defined CC_BUILD_SYMBIAN
/* implemented in Window_Symbian.cpp */
#elif defined CC_BUILD_MACOS
cc_result Process_StartOpen(const cc_string* args) {
UInt8 str[NATIVE_STR_LEN];
@ -1123,6 +1170,7 @@ cc_bool Updater_Supported = true;
/* implemented in Platform_Android.c */
#elif defined CC_BUILD_IOS
/* implemented in interop_ios.m */
#elif defined CC_BUILD_SYMBIAN
#else
cc_bool Updater_Clean(void) { return true; }
@ -1292,6 +1340,8 @@ cc_bool DynamicLib_DescribeError(cc_string* dst) {
#ifdef CC_BUILD_DARWIN
const cc_string DynamicLib_Ext = String_FromConst(".dylib");
#elif defined CC_BUILD_SYMBIAN
const cc_string DynamicLib_Ext = String_FromConst(".dll");
#else
const cc_string DynamicLib_Ext = String_FromConst(".so");
#endif
@ -1334,7 +1384,7 @@ static void Platform_InitPosix(void) {
}
void Platform_Free(void) { }
#if defined CC_BUILD_IRIX || defined CC_BUILD_HPUX
#if defined CC_BUILD_IRIX || defined CC_BUILD_HPUX || defined CC_BUILD_SYMBIAN
cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
const char* err = strerror(res);
if (!err || res >= 1000) return false;
@ -1387,6 +1437,14 @@ void Platform_Init(void) {
Platform_InitPosix();
Platform_InitSpecific();
}
#elif defined CC_BUILD_SYMBIAN
extern void Symbian_Stopwatch_Init(void);
void Platform_Init(void) {
Platform_SingleProcess = true;
Symbian_Stopwatch_Init();
Platform_InitPosix();
}
#else
void Platform_Init(void) {
#ifdef CC_BUILD_MOBILE
@ -1542,11 +1600,28 @@ static cc_result GetMachineID(cc_uint32* key) {
DecodeMachineID(strBuffer, str.length, key);
return 0;
}
#elif defined CC_BUILD_SYMBIAN
extern cc_result Symbian_GetMachineID(cc_uint32* key);
static cc_result GetMachineID(cc_uint32* key) {
return Symbian_GetMachineID(key);
}
#else
static cc_result GetMachineID(cc_uint32* key) { return ERR_NOT_SUPPORTED; }
#endif
cc_result Platform_GetEntropy(void* data, int len) {
#if defined CC_BUILD_SYMBIAN
cc_uint32 rnd = 0, i;
for (i = 0; i < len; ++i) {
if (i % 4 == 0)
rnd = rand();
((cc_uint8*) data)[i] = rnd;
rnd >>= 8;
}
return 0;
#else
int ret;
int fd = open("/dev/urandom", O_RDONLY);
if (fd < 0) return ERR_NOT_SUPPORTED;
@ -1555,6 +1630,7 @@ cc_result Platform_GetEntropy(void* data, int len) {
ret = read(fd, data, len);
close(fd);
return ret == -1 ? errno : 0;
#endif
}

126
src/Platform_Symbian.cpp Normal file
View File

@ -0,0 +1,126 @@
#include "Core.h"
#if defined CC_BUILD_SYMBIAN
extern "C" {
#include "Errors.h"
#include "Platform.h"
#include "Logger.h"
#include "String.h"
#include <unistd.h>
#include <errno.h>
}
#include <e32base.h>
#include <hal.h>
TInt tickPeriod;
const struct UpdaterInfo Updater_Info = {
"&eRedownload and reinstall to update", 0, NULL
};
cc_bool Updater_Clean(void) { return true; }
cc_result Updater_Start(const char** action) {
return ERR_NOT_SUPPORTED;
}
cc_result Updater_GetBuildTime(cc_uint64* timestamp) {
return ERR_NOT_SUPPORTED;
}
cc_result Updater_MarkExecutable(void) {
return ERR_NOT_SUPPORTED;
}
cc_result Updater_SetNewBuildTime(cc_uint64 timestamp) {
return ERR_NOT_SUPPORTED;
}
cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
// Directory is already set by platform: !:/private/e212a5c2
return 0;
}
void Platform_ShareScreenshot(const cc_string* filename) {
}
static CC_NOINLINE cc_uint32 CalcMemSize(cc_uint32 numElems, cc_uint32 elemsSize) {
cc_uint32 numBytes;
if (!numElems || !elemsSize) return 1; /* treat 0 size as 1 byte */
numBytes = numElems * elemsSize;
if (numBytes / elemsSize != numElems) return 0; /* Overflow */
return numBytes;
}
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
cc_uint32 size = CalcMemSize(numElems, elemsSize);
return size ? User::Alloc(size) : NULL;
}
void* Mem_TryAllocCleared(cc_uint32 numElems, cc_uint32 elemsSize) {
cc_uint32 size = CalcMemSize(numElems, elemsSize);
return size ? User::AllocZ(size) : NULL;
}
void* Mem_TryRealloc(void* mem, cc_uint32 numElems, cc_uint32 elemsSize) {
cc_uint32 size = CalcMemSize(numElems, elemsSize);
return size ? User::ReAlloc(mem, size) : NULL;
}
void Mem_Free(void* mem) {
if (mem) User::Free(mem);
}
static void ExceptionHandler(TExcType type) {
cc_string msg; char msgB[64];
String_InitArray(msg, msgB);
String_AppendConst(&msg, "Exception: ");
String_AppendInt(&msg, (int) type);
msg.buffer[msg.length] = '\0';
Logger_DoAbort(0, msg.buffer, 0);
User::HandleException((TUint32*) &type);
}
void CrashHandler_Install(void) {
#if !defined _DEBUG
User::SetExceptionHandler(ExceptionHandler, 0xffffffff);
#endif
}
extern "C" void Symbian_Stopwatch_Init(void);
void Symbian_Stopwatch_Init(void) {
if (HAL::Get(HAL::ENanoTickPeriod, tickPeriod) != KErrNone) {
User::Panic(_L("Could not init timer"), 0);
}
}
cc_uint64 Stopwatch_Measure(void) {
return (cc_uint64)User::NTickCount();
}
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
if (end < beg) return 0;
return (end - beg) * tickPeriod;
}
#define MACHINE_KEY "Symbian_Symbian_"
extern "C" cc_result Symbian_GetMachineID(cc_uint32* key);
cc_result Symbian_GetMachineID(cc_uint32* key) {
TInt res;
Mem_Copy(key, MACHINE_KEY, sizeof(MACHINE_KEY) - 1);
if (HAL::Get(HAL::ESerialNumber, res) == KErrNone) {
key[0] = res;
}
if (HAL::Get(HAL::EMachineUid, res) == KErrNone) {
key[1] = res;
}
return 0;
}
#endif

View File

@ -62,16 +62,26 @@ static cc_result ZipEntry_ExtractData(struct ResourceZipEntry* e, struct Stream*
*------------------------------------------------------Utility functions -------------------------------------------------*
*#########################################################################################################################*/
static void ZipFile_InspectEntries(const cc_string* path, Zip_SelectEntry selector) {
struct ZipEntry entries[64];
struct Stream stream;
cc_result res;
#if CC_BUILD_MAXSTACK <= (16 * 1024)
struct ZipEntry* entries = (struct ZipEntry*)Mem_TryAllocCleared(64, sizeof(struct ZipEntry));
if (!entries) { Logger_SysWarn2(ERR_OUT_OF_MEMORY, "allocating", path); return; }
#else
struct ZipEntry entries[64];
#endif
res = Stream_OpenFile(&stream, path);
if (res == ReturnCode_FileNotFound) return;
if (res) { Logger_SysWarn2(res, "opening", path); return; }
#if CC_BUILD_MAXSTACK <= (16 * 1024)
res = Zip_Extract(&stream, selector, NULL,
entries, 64);
#else
res = Zip_Extract(&stream, selector, NULL,
entries, Array_Elems(entries));
#endif
if (res) Logger_SysWarn2(res, "inspecting", path);
/* No point logging error for closing readonly file */
@ -80,7 +90,7 @@ static void ZipFile_InspectEntries(const cc_string* path, Zip_SelectEntry select
static cc_result ZipEntry_ExtractData(struct ResourceZipEntry* e, struct Stream* data, struct ZipEntry* source) {
cc_uint32 size = source->UncompressedSize;
e->value.data = Mem_TryAlloc(size, 1);
e->value.data = (cc_uint8*)Mem_TryAlloc(size, 1);
e->size = size;
if (!e->value.data) return ERR_OUT_OF_MEMORY;
@ -737,13 +747,22 @@ static cc_result CCTextures_ProcessEntry(const cc_string* path, struct Stream* d
}
static cc_result CCTextures_ExtractZip(struct HttpRequest* req) {
struct ZipEntry entries[64];
struct Stream src;
cc_result res;
#if CC_BUILD_MAXSTACK <= (16 * 1024)
struct ZipEntry* entries = (struct ZipEntry*)Mem_TryAllocCleared(64, sizeof(struct ZipEntry));
if (!entries) return ERR_OUT_OF_MEMORY;
#else
struct ZipEntry entries[64];
#endif
Stream_ReadonlyMemory(&src, req->data, req->size);
if ((res = Zip_Extract(&src, CCTextures_SelectEntry, CCTextures_ProcessEntry,
#if CC_BUILD_MAXSTACK <= (16 * 1024)
entries, 64))) return res;
#else
entries, Array_Elems(entries)))) return res;
#endif
return Stream_WriteAllTo(&ccTexPack, req->data, req->size);
}
@ -909,13 +928,27 @@ static cc_result ClassicPatcher_ProcessEntry(const cc_string* path, struct Strea
}
static cc_result ClassicPatcher_ExtractFiles(struct HttpRequest* req) {
struct ZipEntry entries[64];
struct Stream src;
cc_result res;
#if CC_BUILD_MAXSTACK <= (16 * 1024)
struct ZipEntry* entries = (struct ZipEntry*)Mem_TryAllocCleared(64, sizeof(struct ZipEntry));
if (!entries) return ERR_OUT_OF_MEMORY;
#else
struct ZipEntry entries[64];
#endif
Stream_ReadonlyMemory(&src, req->data, req->size);
#if CC_BUILD_MAXSTACK <= (16 * 1024)
res = Zip_Extract(&src,
ClassicPatcher_SelectEntry, ClassicPatcher_ProcessEntry,
entries, 16);
Mem_Free(entries);
return res;
#else
return Zip_Extract(&src,
ClassicPatcher_SelectEntry, ClassicPatcher_ProcessEntry,
entries, Array_Elems(entries));
#endif
}
static void PatchTerrainTile(struct Bitmap* src, int srcX, int srcY, int tileX, int tileY) {
@ -1022,13 +1055,22 @@ static cc_result ModernPatcher_ProcessEntry(const cc_string* path, struct Stream
}
static cc_result ModernPatcher_ExtractFiles(struct HttpRequest* req) {
struct ZipEntry entries[64];
struct Stream src;
#if CC_BUILD_MAXSTACK <= (16 * 1024)
struct ZipEntry* entries = (struct ZipEntry*)Mem_TryAllocCleared(64, sizeof(struct ZipEntry));
if (!entries) return ERR_OUT_OF_MEMORY;
#else
struct ZipEntry entries[64];
#endif
Stream_ReadonlyMemory(&src, req->data, req->size);
return Zip_Extract(&src,
ModernPatcher_SelectEntry, ModernPatcher_ProcessEntry,
#if CC_BUILD_MAXSTACK <= (16 * 1024)
entries, 64);
#else
entries, Array_Elems(entries));
#endif
}

View File

@ -494,10 +494,22 @@ cc_result SSL_Init(cc_socket socket, const cc_string* host_, void** out_ctx) {
char host[NATIVE_STR_LEN];
String_EncodeUtf8(host, host_);
ctx = Mem_TryAlloc(1, sizeof(SSLContext));
ctx = (SSLContext*)Mem_TryAlloc(1, sizeof(SSLContext));
if (!ctx) return ERR_OUT_OF_MEMORY;
*out_ctx = (void*)ctx;
#if defined CC_BUILD_SYMBIAN
{
TAs[3].pkey.key.ec.curve = BR_EC_secp384r1;
TAs[3].pkey.key.ec.q = (unsigned char *)TA3_EC_Q;
TAs[3].pkey.key.ec.qlen = sizeof TA3_EC_Q;
TAs[6].pkey.key.ec.curve = BR_EC_secp384r1;
TAs[6].pkey.key.ec.q = (unsigned char *)TA6_EC_Q;
TAs[6].pkey.key.ec.qlen = sizeof TA6_EC_Q;
}
#endif
br_ssl_client_init_full(&ctx->sc, &ctx->xc, TAs, TAs_NUM);
InjectEntropy(ctx);
SetCurrentTime(ctx);
@ -557,10 +569,12 @@ cc_result SSL_WriteAll(void* ctx_, const cc_uint8* data, cc_uint32 count) {
int res = br_sslio_write_all(&ctx->ioc, data, count);
if (res < 0) {
if (ctx->writeError) return ctx->writeError;
int err = br_ssl_engine_last_error(&ctx->sc.eng);
return SSL_ERROR_SHIFT | (err & 0xFFFF);
if (ctx->writeError) {
return ctx->writeError;
} else {
int err = br_ssl_engine_last_error(&ctx->sc.eng);
return SSL_ERROR_SHIFT | (err & 0xFFFF);
}
}
br_sslio_flush(&ctx->ioc);

View File

@ -536,6 +536,16 @@ static cc_string font_candidates[] = {
String_FromConst("Roboto"), /* Android (broken on some Android 10 devices) */
String_FromConst("Geneva"), /* for ancient macOS versions */
String_FromConst("Droid Sans"), /* for old Android versions */
#if defined CC_BUILD_SYMBIAN
String_FromConst("Nokia Sans TitleSmBd S60"),
String_FromConst("Nokia Sans S60"),
String_FromConst("Nokia Hindi S60"),
String_FromConst("Series 60 Sans TitleSmBd"),
String_FromConst("Series 60 Sans"),
String_FromConst("Series 60 Hindi"),
String_FromConst("Series 60 Korean"),
String_FromConst("Heisei Kaku Gothic S60"),
#endif
String_FromConst("Google Sans") /* Droid Sans is now known as Google Sans on some Android devices (e.g. a Pixel 6) */
};

View File

@ -529,25 +529,46 @@ static cc_result ExtractPng(struct Stream* stream) {
static cc_bool needReload;
static cc_result ExtractFrom(struct Stream* stream, const cc_string* path) {
#if CC_BUILD_MAXSTACK <= (32 * 1024)
struct ZipEntry* entries = (struct ZipEntry*)Mem_TryAllocCleared(512, sizeof(struct ZipEntry));
#else
struct ZipEntry entries[512];
#endif
cc_result res;
#if CC_BUILD_MAXSTACK <= (32 * 1024)
if (!entries) return ERR_OUT_OF_MEMORY;
#endif
Event_RaiseVoid(&TextureEvents.PackChanged);
/* If context is lost, then trying to load textures will just fail */
/* So defer loading the texture pack until context is restored */
if (Gfx.LostContext) { needReload = true; return 0; }
if (Gfx.LostContext) {
needReload = true;
res = 0;
goto ret;
}
needReload = false;
res = ExtractPng(stream);
if (res == PNG_ERR_INVALID_SIG) {
/* file isn't a .png image, probably a .zip archive then */
#if CC_BUILD_MAXSTACK <= (32 * 1024)
res = Zip_Extract(stream, SelectZipEntry, ProcessZipEntry,
entries, 512);
#else
res = Zip_Extract(stream, SelectZipEntry, ProcessZipEntry,
entries, Array_Elems(entries));
#endif
if (res) Logger_SysWarn2(res, "extracting", path);
} else if (res) {
Logger_SysWarn2(res, "decoding", path);
}
ret:
#if CC_BUILD_MAXSTACK <= (32 * 1024)
Mem_Free(entries);
#endif
return res;
}

View File

@ -277,9 +277,9 @@ static cc_bool VirtualKeyboard_OnInputDown(int key, struct InputDevice* device)
if (deltaX || deltaY) {
VirtualKeyboard_Scroll(deltaX, deltaY);
} else if (key == CCPAD_START || key == CCPAD_1) {
} else if (key == CCPAD_START || key == CCPAD_1 || key == CCKEY_ENTER) {
VirtualKeyboard_ClickSelected();
} else if (key == CCPAD_SELECT || key == CCPAD_2) {
} else if (key == CCPAD_SELECT || key == CCPAD_2 || key == CCKEY_ESCAPE) {
VirtualKeyboard_Close();
} else if (key == CCPAD_3) {
VirtualKeyboard_Backspace();
@ -431,6 +431,7 @@ static void VirtualKeyboard_Hook(void) {
/* the virtual keyboard in the first place gets mistakenly processed */
kb_needsHook = false;
Event_Register_(&ControllerEvents.AxisUpdate, NULL, VirtualKeyboard_PadAxis);
PointerHooks.DownHook = VirtualKeyboard_PointerMove;
PointerHooks.MoveHook = VirtualKeyboard_PointerMove;
PointerHooks.UpHook = VirtualKeyboard_PointerUp;
}
@ -478,6 +479,7 @@ static void VirtualKeyboard_Close(void) {
VirtualKeyboard_Close3D();
Event_Unregister_(&ControllerEvents.AxisUpdate, NULL, VirtualKeyboard_PadAxis);
PointerHooks.DownHook = NULL;
PointerHooks.MoveHook = NULL;
PointerHooks.UpHook = NULL;
Window_Main.SoftKeyboardFocus = false;

View File

@ -684,9 +684,11 @@ void HotbarWidget_Create(struct HotbarWidget* w) {
w->verticesCount = 0;
#ifdef CC_BUILD_TOUCH
int i;
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR - 1; i++) {
w->touchId[i] = -1;
{
int i;
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR - 1; i++) {
w->touchId[i] = -1;
}
}
#endif
}

746
src/Window_Symbian.cpp Normal file
View File

@ -0,0 +1,746 @@
#include "Core.h"
#if defined CC_BUILD_SYMBIAN
#include <include/bitmap.h>
#include <e32base.h>
#include <coemain.h>
#include <e32keys.h>
#include <w32std.h>
#include <aknutils.h>
#include <aknnotewrappers.h>
#include <apgwgnam.h>
#include <stdlib.h>
#include <apgcli.h>
extern "C" {
#include <stdapis/string.h>
#include <gles/egl.h>
#include "_WindowBase.h"
#include "Errors.h"
#include "Logger.h"
#include "String.h"
#include "Gui.h"
#include "Graphics.h"
#include "Game.h"
#include "VirtualKeyboard.h"
}
static cc_bool launcherMode;
class CWindow;
CWindow* window;
class CWindow : public CBase
{
public:
static CWindow* NewL();
void HandleWsEvent(const TWsEvent& aEvent);
void AllocFrameBuffer(int width, int height);
void DrawFramebuffer(Rect2D r, struct Bitmap* bmp);
void FreeFrameBuffer();
void ProcessEvents(float delta);
void RequestClose();
void InitEvents();
cc_result OpenBrowser(const cc_string* url);
~CWindow();
TWsEvent iWsEvent;
TRequestStatus iWsEventStatus;
RWindow* iWindow;
private:
CWindow();
void ConstructL();
void CreateWindowL();
RWsSession iWsSession;
RWindowGroup iWindowGroup;
CWsScreenDevice* iWsScreenDevice;
CWindowGc* iWindowGc;
CFbsBitmap* iBitmap;
CApaWindowGroupName* iWindowGroupName;
TBool iEventsInitialized;
};
//
CWindow* CWindow::NewL() {
CWindow* self = new (ELeave) CWindow();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
void CWindow::CreateWindowL() {
TPixelsTwipsAndRotation pixnrot;
iWsScreenDevice->GetScreenModeSizeAndRotation(iWsScreenDevice->CurrentScreenMode(), pixnrot);
iWindow->SetExtent(TPoint(0, 0), pixnrot.iPixelSize);
iWindow->SetRequiredDisplayMode(iWsScreenDevice->DisplayMode());
#ifdef CC_BUILD_SYMBIAN_3
iWindow->EnableAdvancedPointers();
#endif
iWindow->Activate();
iWindow->SetVisible(ETrue);
iWindow->SetNonFading(ETrue);
iWindow->SetShadowDisabled(ETrue);
iWindow->EnableRedrawStore(EFalse);
iWindow->EnableVisibilityChangeEvents();
iWindow->SetNonTransparent();
iWindow->SetBackgroundColor();
iWindow->SetOrdinalPosition(0);
// Enable drag events
iWindow->PointerFilter(EPointerFilterDrag, 0);
WindowInfo.Focused = true;
WindowInfo.Exists = true;
WindowInfo.Handle.ptr = (void*) iWindow;
#ifdef CC_BUILD_TOUCH
WindowInfo.SoftKeyboard = SOFT_KEYBOARD_VIRTUAL;
#endif
TInt w = pixnrot.iPixelSize.iWidth,
h = pixnrot.iPixelSize.iHeight;
DisplayInfo.Width = w;
DisplayInfo.Height = h;
WindowInfo.Width = w;
WindowInfo.Height = h;
WindowInfo.UIScaleX = DEFAULT_UI_SCALE_X;
WindowInfo.UIScaleY = DEFAULT_UI_SCALE_Y;
if (w <= 360) {
DisplayInfo.ScaleX = 0.5f;
DisplayInfo.ScaleY = 0.5f;
} else {
DisplayInfo.ScaleX = 1;
DisplayInfo.ScaleY = 1;
}
}
CWindow::CWindow() {
}
CWindow::~CWindow() {
if (iWindowGc) {
delete iWindowGc;
iWindowGc = NULL;
}
if (iWindow) {
iWindow->SetOrdinalPosition(KOrdinalPositionSwitchToOwningWindow);
iWindow->Close();
delete iWindow;
iWindow = NULL;
}
if (iWsScreenDevice) {
delete iWsScreenDevice;
iWsScreenDevice = NULL;
}
}
void CWindow::ConstructL() {
delete CActiveScheduler::Current();
CActiveScheduler* actScheduler = new (ELeave) CActiveScheduler();
CActiveScheduler::Install(actScheduler);
CCoeEnv* env = CCoeEnv::Static();
if (!env) {
User::Panic(_L("CoeEnv::Static not initialized"), 0);
}
iWsSession = env->WsSession();
iWsScreenDevice = new (ELeave) CWsScreenDevice(iWsSession);
User::LeaveIfError(iWsScreenDevice->Construct());
iWindowGroup = RWindowGroup(iWsSession);
User::LeaveIfError(iWindowGroup.Construct(reinterpret_cast<TUint32>(this) - 1));
iWindowGroup.SetOrdinalPosition(0);
iWindowGroup.EnableScreenChangeEvents();
#ifdef CC_BUILD_TOUCH
iWindowGroup.EnableReceiptOfFocus(EFalse);
#else
iWindowGroup.EnableReceiptOfFocus(ETrue);
#endif
iWindowGroupName = CApaWindowGroupName::NewL(iWsSession, iWindowGroup.Identifier());
iWindowGroupName->SetAppUid(TUid::Uid(0xE212A5C2));
iWindowGroupName->SetCaptionL(_L("ClassiCube"));
iWindowGroupName->SetHidden(EFalse);
iWindowGroupName->SetSystem(EFalse);
iWindowGroupName->SetRespondsToShutdownEvent(ETrue);
iWindowGroupName->SetWindowGroupName(iWindowGroup);
iWindow = new (ELeave) RWindow(iWsSession);
TInt err = iWindow->Construct(iWindowGroup, reinterpret_cast<TUint32>(this));
User::LeaveIfError(err);
TRAP(err, CreateWindowL());
if (err) {
User::Panic(_L("Window creation failed"), err);
}
RWindowGroup rootWin = CCoeEnv::Static()->RootWin();
CApaWindowGroupName* rootWindGroupName = 0;
TRAP_IGNORE(rootWindGroupName = CApaWindowGroupName::NewL(iWsSession, rootWin.Identifier()));
if (rootWindGroupName) {
rootWindGroupName->SetHidden(ETrue);
rootWindGroupName->SetWindowGroupName(rootWin);
}
TDisplayMode displayMode = iWindow->DisplayMode();
TInt bufferSize = 0;
switch (displayMode) {
case EColor4K:
bufferSize = 12;
break;
case EColor64K:
bufferSize = 16;
break;
case EColor16M:
bufferSize = 24;
break;
case EColor16MU:
case EColor16MA:
bufferSize = 32;
break;
default:
break;
}
DisplayInfo.Depth = bufferSize;
iWsSession.EventReadyCancel();
}
static int ConvertKey(TInt aScanCode) {
// TODO array?
switch (aScanCode) {
case EStdKeyBackspace:
return CCKEY_BACKSPACE;
case EStdKeyTab:
return CCKEY_TAB;
case EStdKeyEnter:
return CCKEY_ENTER;
case EStdKeyEscape:
return CCKEY_ESCAPE;
case EStdKeySpace:
return CCKEY_SPACE;
case EStdKeyPrintScreen:
return CCKEY_PRINTSCREEN;
case EStdKeyPause:
return CCKEY_PAUSE;
case EStdKeyHome:
return CCKEY_HOME;
case EStdKeyEnd:
return CCKEY_END;
case EStdKeyPageUp:
return CCKEY_PAGEUP;
case EStdKeyPageDown:
return CCKEY_PAGEDOWN;
case EStdKeyInsert:
return CCKEY_INSERT;
case EStdKeyDelete:
return CCKEY_DELETE;
case EStdKeyLeftArrow:
return CCKEY_LEFT;
case EStdKeyRightArrow:
return CCKEY_RIGHT;
case EStdKeyUpArrow:
return CCKEY_UP;
case EStdKeyDownArrow:
return CCKEY_DOWN;
case EStdKeyLeftShift:
return CCKEY_LSHIFT;
case EStdKeyRightShift:
return CCKEY_RSHIFT;
case EStdKeyLeftAlt:
return CCKEY_LALT;
case EStdKeyRightAlt:
return CCKEY_RALT;
case EStdKeyLeftCtrl:
return CCKEY_LCTRL;
case EStdKeyRightCtrl:
return CCKEY_RCTRL;
case EStdKeyLeftFunc:
return CCKEY_LWIN;
case EStdKeyRightFunc:
return CCKEY_RWIN;
case EStdKeyNumLock:
return CCKEY_NUMLOCK;
case EStdKeyScrollLock:
return CCKEY_SCROLLLOCK;
case 0x30:
return CCKEY_0;
case 0x31:
return CCKEY_1;
case 0x32:
return CCKEY_2;
case 0x33:
return CCKEY_3;
case 0x34:
return CCKEY_4;
case 0x35:
return CCKEY_5;
case 0x36:
return CCKEY_6;
case 0x37:
return CCKEY_7;
case 0x38:
return CCKEY_8;
case 0x39:
return CCKEY_9;
case EStdKeyComma:
return CCKEY_COMMA;
case EStdKeyFullStop:
return CCKEY_PERIOD;
case EStdKeyForwardSlash:
return CCKEY_SLASH;
case EStdKeyBackSlash:
return CCKEY_BACKSLASH;
case EStdKeySemiColon:
return CCKEY_SEMICOLON;
case EStdKeySingleQuote:
return CCKEY_QUOTE;
case EStdKeyHash:
return '#';
case EStdKeySquareBracketLeft:
return CCKEY_LBRACKET;
case EStdKeySquareBracketRight:
return CCKEY_RBRACKET;
case EStdKeyMinus:
return CCKEY_MINUS;
case EStdKeyEquals:
return CCKEY_EQUALS;
case EStdKeyNkpForwardSlash:
return CCKEY_KP_DIVIDE;
case EStdKeyNkpAsterisk:
return CCKEY_KP_MULTIPLY;
case EStdKeyNkpMinus:
return CCKEY_KP_MINUS;
case EStdKeyNkpPlus:
return CCKEY_KP_PLUS;
case EStdKeyNkpEnter:
return CCKEY_KP_ENTER;
case EStdKeyNkp1:
return CCKEY_KP1;
case EStdKeyNkp2:
return CCKEY_KP2;
case EStdKeyNkp3:
return CCKEY_KP3;
case EStdKeyNkp4:
return CCKEY_KP4;
case EStdKeyNkp5:
return CCKEY_KP5;
case EStdKeyNkp6:
return CCKEY_KP6;
case EStdKeyNkp7:
return CCKEY_KP7;
case EStdKeyNkp8:
return CCKEY_KP8;
case EStdKeyNkp9:
return CCKEY_KP9;
case EStdKeyNkp0:
return CCKEY_KP0;
case EStdKeyNkpFullStop:
return CCKEY_KP_DECIMAL;
case EStdKeyIncVolume:
return CCKEY_VOLUME_UP;
case EStdKeyDecVolume:
return CCKEY_VOLUME_DOWN;
// softkeys
case EStdKeyDevice0: // left soft
return CCKEY_F1;
case EStdKeyDevice1: // right soft
return CCKEY_ESCAPE;
case EStdKeyDevice3: // d-pad center
return CCKEY_ENTER;
}
return aScanCode;
}
void CWindow::HandleWsEvent(const TWsEvent& aWsEvent) {
TInt eventType = aWsEvent.Type();
switch (eventType) {
case EEventKeyDown: {
Input_Set(ConvertKey(aWsEvent.Key()->iScanCode), true);
break;
}
case EEventKeyUp: {
Input_Set(ConvertKey(aWsEvent.Key()->iScanCode), false);
break;
}
case EEventScreenDeviceChanged:
//case 27: /* EEventDisplayChanged */
{
TPixelsTwipsAndRotation pixnrot;
iWsScreenDevice->GetScreenModeSizeAndRotation(iWsScreenDevice->CurrentScreenMode(), pixnrot);
if (pixnrot.iPixelSize != iWindow->Size()) {
iWindow->SetExtent(TPoint(0, 0), pixnrot.iPixelSize);
TInt w = pixnrot.iPixelSize.iWidth,
h = pixnrot.iPixelSize.iHeight;
DisplayInfo.Width = w;
DisplayInfo.Height = h;
WindowInfo.Width = w;
WindowInfo.Height = h;
Event_RaiseVoid(&WindowEvents.Resized);
}
Event_RaiseVoid(&WindowEvents.RedrawNeeded);
break;
}
case EEventFocusLost: {
#if 0 // TODO
if (!WindowInfo.Focused) break;
WindowInfo.Focused = false;
Event_RaiseVoid(&WindowEvents.FocusChanged);
#endif
break;
}
case EEventFocusGained: {
if (!WindowInfo.Focused) {
WindowInfo.Focused = true;
Event_RaiseVoid(&WindowEvents.FocusChanged);
}
Event_RaiseVoid(&WindowEvents.RedrawNeeded);
break;
}
// shutdown request from task manager
case KAknShutOrHideApp: {
RequestClose();
break;
}
// shutdown request from system (out of memory)
case EEventUser: {
TApaSystemEvent apaSystemEvent = *(TApaSystemEvent*) aWsEvent.EventData();
if (apaSystemEvent == EApaSystemEventShutdown) {
RequestClose();
}
break;
}
case EEventWindowVisibilityChanged: {
if (aWsEvent.Handle() == reinterpret_cast<TUint32>(this)) {
WindowInfo.Inactive = (aWsEvent.VisibilityChanged()->iFlags & TWsVisibilityChangedEvent::EFullyVisible) == 0;
Event_RaiseVoid(&WindowEvents.InactiveChanged);
}
break;
}
#ifdef CC_BUILD_TOUCH
case EEventPointer: {
#ifdef CC_BUILD_SYMBIAN_3
TAdvancedPointerEvent* pointer = aWsEvent.Pointer();
long num = pointer->IsAdvancedPointerEvent() ? pointer->PointerNumber() : 0;
#else
TPointerEvent* pointer = aWsEvent.Pointer();
long num = 0;
#endif
TPoint pos = pointer->iPosition;
switch (pointer->iType) {
case TPointerEvent::EButton1Down:
Input_AddTouch(num, pos.iX, pos.iY);
break;
case TPointerEvent::EDrag:
Input_AddTouch(num, pos.iX, pos.iY);
break;
case TPointerEvent::EButton1Up:
Input_RemoveTouch(num, pos.iX, pos.iY);
break;
default:
break;
}
break;
}
#endif
}
}
void CWindow::AllocFrameBuffer(int width, int height) {
FreeFrameBuffer();
if (!iWindowGc) {
iWindowGc = new (ELeave) CWindowGc(iWsScreenDevice);
iWindowGc->Construct();
}
iBitmap = new CFbsBitmap();
iBitmap->Create(TSize(width, height), EColor16MA);
}
void CWindow::FreeFrameBuffer() {
if (iWindowGc != NULL) {
delete iWindowGc;
iWindowGc = NULL;
}
if (iBitmap != NULL) {
delete iBitmap;
iBitmap = NULL;
}
}
void CWindow::DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
if (!iWindowGc) return;
iWindow->Invalidate(/*TRect(r.x, r.y, r.width, r.height)*/);
iWindow->BeginRedraw();
iWindowGc->Activate(*iWindow);
if (iBitmap) {
// iBitmap->BeginDataAccess();
iBitmap->LockHeap();
TUint8* data = (TUint8*) iBitmap->DataAddress();
const TUint8* src = (TUint8*) bmp->scan0;
for (TInt row = bmp->height - 1; row >= 0; --row) {
memcpy(data, src, bmp->width * BITMAPCOLOR_SIZE);
src += bmp->width * BITMAPCOLOR_SIZE;
data += iBitmap->DataStride();
}
// iBitmap->EndDataAccess();
iBitmap->UnlockHeap();
iWindowGc->BitBlt(TPoint(0, 0), iBitmap/*, TRect(r.x, r.y, r.width, r.height)*/);
}
iWindowGc->Deactivate();
iWindow->EndRedraw();
iWsSession.Flush();
}
void CWindow::ProcessEvents(float delta) {
RThread thread;
TInt error = KErrNone;
while (thread.RequestCount()) {
CActiveScheduler::RunIfReady(error, CActive::EPriorityIdle);
User::WaitForAnyRequest();
}
while (iWsEventStatus != KRequestPending) {
iWsSession.GetEvent(window->iWsEvent);
HandleWsEvent(window->iWsEvent);
iWsEventStatus = KRequestPending;
iWsSession.EventReady(&iWsEventStatus);
}
}
void CWindow::RequestClose() {
WindowInfo.Exists = false;
Event_RaiseVoid(&WindowEvents.Closing);
}
void CWindow::InitEvents() {
iWindow->Invalidate();
iWindow->BeginRedraw();
iWindow->EndRedraw();
iWsSession.Flush();
if (iEventsInitialized)
return;
iEventsInitialized = ETrue;
iWsEventStatus = KRequestPending;
iWsSession.EventReady(&iWsEventStatus);
}
cc_result CWindow::OpenBrowser(const cc_string* url) {
#if 0
TUid browserUid = {0x1020724d};
TApaTaskList tasklist(window->iWsSession);
TApaTask task = tasklist.FindApp(browserUid);
TPtrC des;
// TODO convert url to utf16
if (task.Exists()) {
task.BringToForeground();
} else {
RApaLsSession ls;
if (!ls.Connect()) {
TThreadId tid;
ls.StartDocument(des, browserUid, tid);
ls.Close();
}
}
#endif
return ERR_NOT_SUPPORTED;
}
//
void Window_PreInit(void) {
CCoeEnv* env = new (ELeave) CCoeEnv();
TRAPD(err, env->ConstructL(ETrue, 0));
if (err != KErrNone) {
User::Panic(_L("Failed to create CoeEnv"), 0);
}
}
void Window_Init(void) {
TRAPD(err, window = CWindow::NewL());
if (err) {
User::Panic(_L("Failed to initialize CWindow"), err);
}
#ifdef CC_BUILD_TOUCH
//TBool touch = AknLayoutUtils::PenEnabled();
bool touch = true;
Input_SetTouchMode(touch);
Gui_SetTouchUI(touch);
#endif
}
void Window_Free(void) {
if (window) {
delete window;
window = NULL;
}
CCoeEnv::Static()->DestroyEnvironment();
delete CCoeEnv::Static();
}
void Window_Create2D(int width, int height) {
launcherMode = true;
window->InitEvents();
}
void Window_Create3D(int width, int height) {
launcherMode = false;
window->InitEvents();
}
void Window_Destroy(void) {
}
void Window_SetTitle(const cc_string* title) { }
void Clipboard_GetText(cc_string* value) { }
void Clipboard_SetText(const cc_string* value) { }
int Window_GetWindowState(void) { return WINDOW_STATE_FULLSCREEN; }
cc_result Window_EnterFullscreen(void) { return 0; }
cc_result Window_ExitFullscreen(void) { return 0; }
int Window_IsObscured(void) {
return WindowInfo.Inactive;
}
void Window_Show(void) { }
void Window_SetSize(int width, int height) { }
void Window_RequestClose(void) {
window->RequestClose();
}
void Window_ProcessEvents(float delta) {
window->ProcessEvents(delta);
}
void Window_EnableRawMouse(void) { Input.RawMode = true; }
void Window_UpdateRawMouse(void) { }
void Window_DisableRawMouse(void) { Input.RawMode = false; }
void Gamepads_Init(void) {
}
void Gamepads_Process(float delta) {
}
void ShowDialogCore(const char* title, const char* msg) {
// TODO
static const cc_string t2 = String_Init((char*) title, String_Length(title), String_Length(title));
Logger_Log(&t2);
static const cc_string msg2 = String_Init((char*) msg, String_Length(msg), String_Length(msg));
Logger_Log(&msg2);
}
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
VirtualKeyboard_Open(args, launcherMode);
}
void OnscreenKeyboard_SetText(const cc_string* text) {
VirtualKeyboard_SetText(text);
}
void OnscreenKeyboard_Close(void) {
VirtualKeyboard_Close();
}
void Window_LockLandscapeOrientation(cc_bool lock) {
// TODO
}
static void Cursor_GetRawPos(int* x, int* y) { *x = 0; *y = 0; }
void Cursor_SetPosition(int x, int y) { }
static void Cursor_DoSetVisible(cc_bool visible) { }
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
return ERR_NOT_SUPPORTED;
}
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
return ERR_NOT_SUPPORTED;
}
void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "bitmap");
bmp->width = width;
bmp->height = height;
window->AllocFrameBuffer(width, height);
}
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
window->DrawFramebuffer(r, bmp);
}
void Window_FreeFramebuffer(struct Bitmap* bmp) {
window->FreeFrameBuffer();
Mem_Free(bmp->scan0);
}
#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL1
void GLContext_Create(void) {
static EGLint attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BUFFER_SIZE, DisplayInfo.Depth,
EGL_DEPTH_SIZE, 16,
EGL_NONE
};
ctx_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(ctx_display, NULL, NULL);
EGLint numConfigs;
eglChooseConfig(ctx_display, attribs, &ctx_config, 1, &numConfigs);
ctx_context = eglCreateContext(ctx_display, ctx_config, EGL_NO_CONTEXT, NULL);
if (!ctx_context) Process_Abort2(eglGetError(), "Failed to create EGL context");
GLContext_InitSurface();
}
#endif
cc_result Process_StartOpen(const cc_string* args) {
TInt err = 0;
TRAP(err, err = window->OpenBrowser(args));
return (cc_result) err;
}
#endif

View File

@ -107,7 +107,11 @@ static void CallTexSubImage2D(int lvl, int x, int y, int width, int height, void
static void CallTexImage2D(int lvl, int width, int height, void* pixels) {
void* tmp;
if (!convert_rgba) {
#if defined CC_BUILD_SYMBIAN
_glTexImage2D(GL_TEXTURE_2D, lvl, _GL_BGRA_EXT, width, height, 0, PIXEL_FORMAT, TRANSFER_FORMAT, pixels);
#else
_glTexImage2D(GL_TEXTURE_2D, lvl, GL_RGBA, width, height, 0, PIXEL_FORMAT, TRANSFER_FORMAT, pixels);
#endif
return;
}
@ -310,7 +314,21 @@ cc_result Gfx_TakeScreenshot(struct Stream* output) {
bmp.scan0 = (BitmapCol*)Mem_TryAlloc(bmp.width * bmp.height, BITMAPCOLOR_SIZE);
if (!bmp.scan0) return ERR_OUT_OF_MEMORY;
#if defined CC_BUILD_SYMBIAN
_glReadPixels(0, 0, bmp.width, bmp.height, GL_RGBA, TRANSFER_FORMAT, bmp.scan0);
/* ??? */
if (convert_rgba) {
BitmapCol* tmp = (BitmapCol*)Mem_TryAlloc(bmp.width * bmp.height, BITMAPCOLOR_SIZE);
if (!tmp) return ERR_OUT_OF_MEMORY;
ConvertRGBA(tmp, bmp.scan0, bmp.width * bmp.height);
Mem_Free(bmp.scan0);
bmp.scan0 = tmp;
}
#else
_glReadPixels(0, 0, bmp.width, bmp.height, PIXEL_FORMAT, TRANSFER_FORMAT, bmp.scan0);
#endif
res = Png_Encode(&bmp, output, GL_GetRow, false, NULL);
Mem_Free(bmp.scan0);
@ -371,6 +389,10 @@ void Gfx_EndFrame(void) {
#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL1
if (Window_IsObscured()) {
TickReducedPerformance();
#if defined CC_BUILD_SYMBIAN
/* eglSwapBuffers on Symbian 9.2 renders on top of everything */
return;
#endif
} else {
EndReducedPerformance();
}

View File

@ -202,7 +202,7 @@ static void EncipherBlock(cc_uint32* v, const cc_uint32* key, cc_string* dst) {
cc_uint32 v0 = v[0], v1 = v[1], sum = 0, delta = 0x9E3779B9;
int i;
for (i = 0; i < 12; i++)
for (i = 0; i < 12; i++)
{
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + key[sum & 3]);
sum += delta;
@ -216,7 +216,7 @@ static void DecipherBlock(cc_uint32* v, const cc_uint32* key) {
cc_uint32 v0 = v[0], v1 = v[1], delta = 0x9E3779B9, sum = delta * 12;
int i;
for (i = 0; i < 12; i++)
for (i = 0; i < 12; i++)
{
v1 -= (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + key[(sum>>11) & 3]);
sum -= delta;

View File

@ -103,7 +103,9 @@ static CC_INLINE void InitGraphicsMode(struct GraphicsMode* m) {
/*########################################################################################################################*
*-------------------------------------------------------EGL OpenGL--------------------------------------------------------*
*#########################################################################################################################*/
#if !defined CC_BUILD_SYMBIAN
#include <EGL/egl.h>
#endif
static EGLDisplay ctx_display;
static EGLContext ctx_context;
static EGLSurface ctx_surface;
@ -114,7 +116,11 @@ static cc_uintptr ctx_visualID;
static void GLContext_InitSurface(void); // replacement in Window_Switch.c for handheld/docked resolution fix
#else
static void GLContext_InitSurface(void) {
#if defined EGLNativeWindowType
EGLNativeWindowType window = (EGLNativeWindowType)Window_Main.Handle.ptr;
#else
NativeWindowType window = (NativeWindowType)Window_Main.Handle.ptr;
#endif
if (!window) return; /* window not created or lost */
ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, window, NULL);
@ -139,7 +145,10 @@ static void DumpEGLConfig(EGLConfig config) {
eglGetConfigAttrib(ctx_display, config, EGL_ALPHA_SIZE, &alpha);
eglGetConfigAttrib(ctx_display, config, EGL_DEPTH_SIZE, &depth);
eglGetConfigAttrib(ctx_display, config, EGL_NATIVE_VISUAL_ID, &vid);
#if defined EGL_RENDERABLE_TYPE
/* e.g Symbian 9.2-9.4 only support EGL 1.1 */
eglGetConfigAttrib(ctx_display, config, EGL_RENDERABLE_TYPE, &mode);
#endif
Platform_Log4("EGL R:%i, G:%i, B:%i, A:%i", &red, &green, &blue, &alpha);
Platform_Log3("EGL D: %i, V: %h, S: %h", &depth, &vid, &mode);
@ -161,6 +170,9 @@ static void ChooseEGLConfig(EGLConfig* configs, EGLint num_configs) {
}
}
#if defined CC_BUILD_SYMBIAN && CC_GFX_BACKEND != CC_GFX_BACKEND_GL2
/* Implemented in Window_Symbian.cpp */
#else
void GLContext_Create(void) {
#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL2
static EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
@ -221,6 +233,7 @@ void GLContext_Create(void) {
if (!ctx_context) Process_Abort2(eglGetError(), "Failed to create EGL context");
GLContext_InitSurface();
}
#endif
void GLContext_Update(void) {
GLContext_FreeSurface();
@ -240,14 +253,18 @@ void GLContext_Free(void) {
}
void* GLContext_GetAddress(const char* function) {
return eglGetProcAddress(function);
return (void*) eglGetProcAddress(function);
}
cc_bool GLContext_SwapBuffers(void) {
EGLint err;
if (!ctx_surface) return false;
if (eglSwapBuffers(ctx_display, ctx_surface)) return true;
#if defined CC_BUILD_SYMBIAN
if (GLContext_TryRestore() && eglSwapBuffers(ctx_display, ctx_surface)) {
return true;
}
#endif
err = eglGetError();
/* TODO: figure out what errors need to be handled here */
Process_Abort2(err, "Failed to swap buffers");

View File

@ -101,7 +101,10 @@ FT_BEGIN_HEADER
/* performance-critical functions (e.g. FT_MulFix). You should only do */
/* that to verify that the assembler function works properly, or to */
/* execute benchmark tests of the various implementations. */
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
#ifdef CC_BUILD_SYMBIAN
#define FT_CONFIG_OPTION_NO_ASSEMBLER
#endif
/*************************************************************************/

View File

@ -124,6 +124,10 @@
* BearSSL source archive also comes with sample code.
*/
#if defined __ARMCC__ && defined __SYMBIAN32__
#define inline __inline
#endif
#include "bearssl_hash.h"
#include "bearssl_hmac.h"
#include "bearssl_kdf.h"

View File

@ -27,7 +27,11 @@
#include <stddef.h>
#include <stdint.h>
#ifdef __SYMBIAN32__
#include <stdapis/string.h>
#else
#include <string.h>
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -25,7 +25,11 @@
#ifndef INNER_H__
#define INNER_H__
#ifdef __SYMBIAN32__
#include <stdapis/string.h>
#else
#include <string.h>
#endif
#include <limits.h>
#include "config.h"

View File

@ -1284,10 +1284,11 @@ br_ssl_engine_compute_master(br_ssl_engine_context *cc,
int prf_id, const void *pms, size_t pms_len)
{
br_tls_prf_impl iprf;
br_tls_prf_seed_chunk seed[2] = {
{ cc->client_random, sizeof cc->client_random },
{ cc->server_random, sizeof cc->server_random }
};
br_tls_prf_seed_chunk seed[2];
seed[0].data = cc->client_random;
seed[0].len = sizeof cc->client_random;
seed[1].data = cc->server_random;
seed[1].len = sizeof cc->server_random;
iprf = br_ssl_engine_get_PRF(cc, prf_id);
iprf(cc->session.master_secret, sizeof cc->session.master_secret,
@ -1302,10 +1303,11 @@ compute_key_block(br_ssl_engine_context *cc, int prf_id,
size_t half_len, unsigned char *kb)
{
br_tls_prf_impl iprf;
br_tls_prf_seed_chunk seed[2] = {
{ cc->server_random, sizeof cc->server_random },
{ cc->client_random, sizeof cc->client_random }
};
br_tls_prf_seed_chunk seed[2];
seed[0].data = cc->server_random;
seed[0].len = sizeof cc->server_random;
seed[1].data = cc->client_random;
seed[1].len = sizeof cc->client_random;
iprf = br_ssl_engine_get_PRF(cc, prf_id);
iprf(kb, half_len << 1,

View File

@ -68,7 +68,11 @@ void br_ssl_hs_client_run(void *t0ctx);
#include <stddef.h>
#ifdef __SYMBIAN32__
#include <stdapis/string.h>
#else
#include <string.h>
#endif
#include "inner.h"