add more custom screen resolutions, fix build

This commit is contained in:
nillerusr 2022-01-25 00:14:29 +03:00
parent 0fb75b41fd
commit 303b387e76
22 changed files with 189 additions and 803 deletions

View File

@ -595,9 +595,13 @@ void GLMDisplayInfo::PopulateModes( void )
// Add double of everything also - Retina proofing hopefully. // Add double of everything also - Retina proofing hopefully.
m_modes->AddToTail( new GLMDisplayMode( w * 2, h * 2, 0 ) ); m_modes->AddToTail( new GLMDisplayMode( w * 2, h * 2, 0 ) );
} }
m_modes->AddToTail( new GLMDisplayMode( w, w * ((float)m_info.m_displayPixelHeight/m_info.m_displayPixelWidth), 0 ) );
} }
} }
m_modes->AddToTail( new GLMDisplayMode( m_info.m_displayPixelWidth / 2, m_info.m_displayPixelHeight / 2, 0 ) );
m_modes->Sort( DisplayModeSortFunction ); m_modes->Sort( DisplayModeSortFunction );
// remove dupes. // remove dupes.

View File

@ -2286,7 +2286,9 @@ bool CVideoMode_MaterialSystem::Init( )
int bitsperpixel = 32; int bitsperpixel = 32;
bool bAllowSmallModes = false; bool bAllowSmallModes = false;
#ifndef ANDROID
if ( CommandLine()->FindParm( "-small" ) ) if ( CommandLine()->FindParm( "-small" ) )
#endif
{ {
bAllowSmallModes = true; bAllowSmallModes = true;
} }

View File

@ -355,7 +355,7 @@ void CGame::HandleMsg_Close( const InputEvent_t &event )
void CGame::DispatchInputEvent( const InputEvent_t &event ) void CGame::DispatchInputEvent( const InputEvent_t &event )
{ {
switch( event.m_nType ) switch( event.m_nType & 0xFFFF )
{ {
// Handle button events specially, // Handle button events specially,
// since we have all manner of crazy filtering going on when dealing with them // since we have all manner of crazy filtering going on when dealing with them

File diff suppressed because one or more lines are too long

View File

@ -735,7 +735,7 @@ public:
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ); virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar );
virtual void IN_TouchEvent( int type, int fingerId, int x, int y ); virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 );
private: private:
void UncacheAllMaterials( ); void UncacheAllMaterials( );
void ResetStringTablePointers(); void ResetStringTablePointers();
@ -1424,17 +1424,24 @@ int CHLClient::IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszC
return input->KeyEvent( eventcode, keynum, pszCurrentBinding ); return input->KeyEvent( eventcode, keynum, pszCurrentBinding );
} }
void CHLClient::IN_TouchEvent( int type, int fingerId, int x, int y ) void CHLClient::IN_TouchEvent( uint data, uint data2, uint data3, uint data4 )
{ {
if( enginevgui->IsGameUIVisible() ) if( enginevgui->IsGameUIVisible() )
return; return;
touch_event_t ev; touch_event_t ev;
ev.type = type; ev.type = data & 0xFFFF;
ev.fingerid = fingerId; ev.fingerid = (data >> 16) & 0xFFFF;
ev.x = x; ev.x = (double)((data2 >> 16) & 0xFFFF) / 0xFFFF;
ev.y = y; ev.y = (double)(data2 & 0xFFFF) / 0xFFFF;
union{uint i;float f;} ifconv;
ifconv.i = data3;
ev.dx = ifconv.f;
ifconv.i = data4;
ev.dy = ifconv.f;
gTouch.ProcessEvent( &ev ); gTouch.ProcessEvent( &ev );
} }

View File

@ -62,11 +62,36 @@ CTouchPanel::CTouchPanel( vgui::VPANEL parent ) : BaseClass( NULL, "TouchPanel"
SetVisible( true ); SetVisible( true );
} }
void CTouchPanel::Paint() void CTouchPanel::Paint()
{ {
gTouch.Frame(); gTouch.Frame();
} }
void CTouchPanel::OnScreenSizeChanged(int iOldWide, int iOldTall)
{
BaseClass::OnScreenSizeChanged(iOldWide, iOldTall);
int w,h;
w = ScreenWidth();
h = ScreenHeight();
gTouch.screen_w = ScreenWidth(); gTouch.screen_h = h;
SetBounds( 0, 0, w, h );
}
void CTouchPanel::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
int w,h;
w = ScreenWidth();
h = ScreenHeight();
gTouch.screen_w = ScreenWidth(); gTouch.screen_h = h;
SetBounds( 0, 0, w, h );
}
CON_COMMAND( touch_addbutton, "add native touch button" ) CON_COMMAND( touch_addbutton, "add native touch button" )
{ {
rgba_t color; rgba_t color;
@ -282,7 +307,7 @@ void CTouchControls::Init()
char buf[256]; char buf[256];
Q_snprintf(buf, sizeof buf, "exec %s\n", touch_config_file.GetString()); Q_snprintf(buf, sizeof buf, "exec %s\n", touch_config_file.GetString());
engine->ClientCmd_Unrestricted(buf); engine->ClientCmd_Unrestricted(buf);
Q_snprintf(buf, sizeof buf, "cfg/%s", touch_config_file.GetString()); Q_snprintf(buf, sizeof buf, "cfg/%s", touch_config_file.GetString());
if( !filesystem->FileExists(buf) ) if( !filesystem->FileExists(buf) )
WriteConfig(); WriteConfig();
@ -530,8 +555,8 @@ void CTouchControls::ProcessEvent(touch_event_t *ev)
void CTouchControls::EditEvent(touch_event_t *ev) void CTouchControls::EditEvent(touch_event_t *ev)
{ {
float x = ev->x / (float)screen_w; const float x = ev->x;
float y = ev->y / (float)screen_h; const float y = ev->y;
//CUtlLinkedList<CTouchButton*>::iterator it; //CUtlLinkedList<CTouchButton*>::iterator it;
@ -556,13 +581,11 @@ void CTouchControls::EditEvent(touch_event_t *ev)
{ {
move_finger = ev->fingerid; move_finger = ev->fingerid;
selection = btn; selection = btn;
dx = x; dy = y;
break; break;
} }
else if( resize_finger == -1 ) else if( resize_finger == -1 )
{ {
resize_finger = ev->fingerid; resize_finger = ev->fingerid;
dx2 = x; dy2 = y;
} }
} }
} }
@ -574,7 +597,6 @@ void CTouchControls::EditEvent(touch_event_t *ev)
move_finger = -1; move_finger = -1;
IN_CheckCoords( &selection->x1, &selection->y1, &selection->x2, &selection->y2 ); IN_CheckCoords( &selection->x1, &selection->y1, &selection->x2, &selection->y2 );
selection = nullptr; selection = nullptr;
dx = dy = 0.f;
} }
else if( ev->fingerid == resize_finger ) else if( ev->fingerid == resize_finger )
resize_finger = -1; resize_finger = -1;
@ -586,20 +608,15 @@ void CTouchControls::EditEvent(touch_event_t *ev)
if( move_finger == ev->fingerid ) if( move_finger == ev->fingerid )
{ {
selection->x1 += x-dx; selection->x1 += ev->dx;
selection->x2 += x-dx; selection->x2 += ev->dx;
selection->y1 += y-dy; selection->y1 += ev->dy;
selection->y2 += y-dy; selection->y2 += ev->dy;
dx = x;
dy = y;
} }
else if( resize_finger == ev->fingerid ) else if( resize_finger == ev->fingerid )
{ {
selection->x2 += x-dx2; selection->x2 += ev->dx;
selection->y2 += y-dy2; selection->y2 += ev->dy;
dx2 = x; dy2 = y;
} }
} }
} }
@ -607,8 +624,8 @@ void CTouchControls::EditEvent(touch_event_t *ev)
void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass
{ {
float x = ev->x / (float)screen_w; const float x = ev->x;
float y = ev->y / (float)screen_h; const float y = ev->y;
float f, s; float f, s;
@ -627,10 +644,8 @@ void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass
} }
else if( btn->type == touch_look ) else if( btn->type == touch_look )
{ {
yaw += touch_yaw.GetFloat() * ( dx - x ) * sensitivity.GetFloat(); yaw -= touch_yaw.GetFloat() * ev->dx * sensitivity.GetFloat();
pitch -= touch_pitch.GetFloat() * ( dy - y ) * sensitivity.GetFloat(); pitch += touch_pitch.GetFloat() * ev->dy * sensitivity.GetFloat();
dx = x;
dy = y;
} }
} }
} }
@ -638,8 +653,8 @@ void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass
void CTouchControls::FingerPress(touch_event_t *ev) void CTouchControls::FingerPress(touch_event_t *ev)
{ {
float x = ev->x / (float)screen_w; const float x = ev->x;
float y = ev->y / (float)screen_h; const float y = ev->y;
CUtlLinkedList<CTouchButton*>::iterator it; CUtlLinkedList<CTouchButton*>::iterator it;
@ -668,11 +683,7 @@ void CTouchControls::FingerPress(touch_event_t *ev)
else if( btn->type == touch_look ) else if( btn->type == touch_look )
{ {
if( look_finger == -1 ) if( look_finger == -1 )
{
dx = x;
dy = y;
look_finger = ev->fingerid; look_finger = ev->fingerid;
}
else else
btn->finger = look_finger; btn->finger = look_finger;
} }
@ -722,7 +733,7 @@ void CTouchControls::EnableTouchEdit(bool enable)
resize_finger = move_finger = look_finger = wheel_finger = -1; resize_finger = move_finger = look_finger = wheel_finger = -1;
move_button = NULL; move_button = NULL;
configchanged = true; configchanged = true;
AddButton( "close_edit", "vgui/touch/exit", "touch_disableedit", 0.010000, 0.837778, 0.080000, 0.980000, rgba_t(255,255,255,255), 0, 1.f, TOUCH_FL_NOEDIT ); AddButton( "close_edit", "vgui/touch/back", "touch_disableedit", 0.010000, 0.837778, 0.080000, 0.980000, rgba_t(255,255,255,255), 0, 1.f, TOUCH_FL_NOEDIT );
} }
else else
{ {

View File

@ -72,8 +72,7 @@ struct event_clientcmd_t
struct event_s struct event_s
{ {
int type; int type;
int x; float x,y,dx,dy;
int y;
int fingerid; int fingerid;
} typedef touch_event_t; } typedef touch_event_t;
@ -110,8 +109,11 @@ class CTouchPanel : public vgui::Panel
public: public:
CTouchPanel( vgui::VPANEL parent ); CTouchPanel( vgui::VPANEL parent );
virtual ~CTouchPanel( void ) {}; virtual ~CTouchPanel( void ) {};
virtual void Paint(); virtual void Paint();
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
protected:
MESSAGE_FUNC_INT_INT( OnScreenSizeChanged, "OnScreenSizeChanged", oldwide, oldtall );
}; };
abstract_class ITouchPanel abstract_class ITouchPanel
@ -189,6 +191,8 @@ public:
void EnableTouchEdit(bool enable); void EnableTouchEdit(bool enable);
CTouchPanel *touchPanel; CTouchPanel *touchPanel;
float screen_h, screen_w;
private: private:
bool initialized = false; bool initialized = false;
ETouchState state; ETouchState state;
@ -200,7 +204,6 @@ private:
CTouchButton *move_button; CTouchButton *move_button;
float move_start_x, move_start_y; float move_start_x, move_start_y;
float dx, dy, dx2, dy2;
// editing // editing
CTouchButton *edit; CTouchButton *edit;
@ -221,8 +224,6 @@ private:
bool config_loaded; bool config_loaded;
vgui::HFont textfont; vgui::HFont textfont;
int mouse_events; int mouse_events;
float screen_h, screen_w;
}; };
extern CTouchControls gTouch; extern CTouchControls gTouch;

View File

@ -66,19 +66,7 @@ def build(bld):
if bld.env.DEST_OS != 'android': if bld.env.DEST_OS != 'android':
install_path += '/'+bld.env.GAMES+'/bin' install_path += '/'+bld.env.GAMES+'/bin'
source = [ 'touch.cpp', 'arch.c' ] source = [ 'touch.cpp' ]
if bld.env.DEST_OS == 'android':
source += [
'third/minizip/mz_zip.c',
'third/minizip/mz_strm.c',
'third/minizip/mz_strm_mem.c',
'third/minizip/mz_strm_buf.c',
'third/minizip/mz_strm_split.c',
'third/minizip/mz_strm_posix.c',
'third/minizip/mz_strm_zlib.c',
'third/minizip/mz_os_posix.c'
]
source += game["sources"] source += game["sources"]
includes += game["includes"] includes += game["includes"]

View File

@ -1041,6 +1041,7 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N
unicodeText = g_pVGuiLocalize->Find("#GameUI_AspectWide16x10"); unicodeText = g_pVGuiLocalize->Find("#GameUI_AspectWide16x10");
g_pVGuiLocalize->ConvertUnicodeToANSI(unicodeText, pszAspectName[2], 32); g_pVGuiLocalize->ConvertUnicodeToANSI(unicodeText, pszAspectName[2], 32);
#ifndef ANDROID
int iNormalItemID = m_pAspectRatio->AddItem( pszAspectName[0], NULL ); int iNormalItemID = m_pAspectRatio->AddItem( pszAspectName[0], NULL );
int i16x9ItemID = m_pAspectRatio->AddItem( pszAspectName[1], NULL ); int i16x9ItemID = m_pAspectRatio->AddItem( pszAspectName[1], NULL );
int i16x10ItemID = m_pAspectRatio->AddItem( pszAspectName[2], NULL ); int i16x10ItemID = m_pAspectRatio->AddItem( pszAspectName[2], NULL );
@ -1061,6 +1062,12 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N
m_pAspectRatio->ActivateItem( i16x10ItemID ); m_pAspectRatio->ActivateItem( i16x10ItemID );
break; break;
} }
#else
int iNormalItemID = m_pAspectRatio->AddItem( "lemonparty.org", NULL );
m_pAspectRatio->ActivateItem( iNormalItemID );
m_pGammaButton->SetEnabled(false);
#endif
char pszVRModeName[2][64]; char pszVRModeName[2][64];
unicodeText = g_pVGuiLocalize->Find("#GameUI_Disabled"); unicodeText = g_pVGuiLocalize->Find("#GameUI_Disabled");
@ -1110,6 +1117,10 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N
m_pWindowed->AddItem( "#GameUI_Windowed", NULL ); m_pWindowed->AddItem( "#GameUI_Windowed", NULL );
#endif #endif
#ifdef ANDROID
m_pWindowed->SetEnabled( false );
#endif
LoadControlSettings("Resource\\OptionsSubVideo.res"); LoadControlSettings("Resource\\OptionsSubVideo.res");
// Moved down here so we can set the Drop down's // Moved down here so we can set the Drop down's
@ -1160,9 +1171,10 @@ void COptionsSubVideo::PrepareResolutionList()
// Clean up before filling the info again. // Clean up before filling the info again.
m_pMode->DeleteAllItems(); m_pMode->DeleteAllItems();
#ifndef ANDROID
m_pAspectRatio->SetItemEnabled(1, false); m_pAspectRatio->SetItemEnabled(1, false);
m_pAspectRatio->SetItemEnabled(2, false); m_pAspectRatio->SetItemEnabled(2, false);
#endif
// get full video mode list // get full video mode list
vmode_t *plist = NULL; vmode_t *plist = NULL;
int count = 0; int count = 0;
@ -1225,7 +1237,9 @@ void COptionsSubVideo::PrepareResolutionList()
GetResolutionName( plist, sz, sizeof( sz ), desktopWidth, desktopHeight ); GetResolutionName( plist, sz, sizeof( sz ), desktopWidth, desktopHeight );
int itemID = -1; int itemID = -1;
int iAspectMode = GetScreenAspectMode( plist->width, plist->height ); int iAspectMode = GetScreenAspectMode( plist->width, plist->height );
#ifndef ANDROID
if ( iAspectMode > 0 ) if ( iAspectMode > 0 )
{ {
m_pAspectRatio->SetItemEnabled( iAspectMode, true ); m_pAspectRatio->SetItemEnabled( iAspectMode, true );
@ -1237,8 +1251,15 @@ void COptionsSubVideo::PrepareResolutionList()
{ {
itemID = m_pMode->AddItem( sz, NULL); itemID = m_pMode->AddItem( sz, NULL);
} }
#else
float aspect = (float)plist->width / plist->height;
float native_aspect = (float)desktopWidth / desktopHeight;
// try and find the best match for the resolution to be selected if( fabs(native_aspect - aspect) < 0.01f )
itemID = m_pMode->AddItem( sz, NULL);
#endif
// try and find the bestplistplistplist match for the resolution to be selected
if ( plist->width == currentWidth && plist->height == currentHeight ) if ( plist->width == currentWidth && plist->height == currentHeight )
{ {
selectedItemID = itemID; selectedItemID = itemID;
@ -1250,7 +1271,9 @@ void COptionsSubVideo::PrepareResolutionList()
} }
// disable ratio selection if we can't display widescreen. // disable ratio selection if we can't display widescreen.
#ifndef ANDROID
m_pAspectRatio->SetEnabled( bFoundWidescreen ); m_pAspectRatio->SetEnabled( bFoundWidescreen );
#endif
m_nSelectedMode = selectedItemID; m_nSelectedMode = selectedItemID;
@ -1377,7 +1400,11 @@ void COptionsSubVideo::OnResetData()
#endif #endif
// reset gamma control // reset gamma control
#ifdef ANDROID
m_pGammaButton->SetEnabled( false );
#else
m_pGammaButton->SetEnabled( !config.Windowed() ); m_pGammaButton->SetEnabled( !config.Windowed() );
#endif
m_pHDContent->SetSelected( BUseHDContent() ); m_pHDContent->SetSelected( BUseHDContent() );
@ -1577,8 +1604,12 @@ void COptionsSubVideo::PerformLayout()
if ( m_pGammaButton ) if ( m_pGammaButton )
{ {
#ifdef ANDROID
m_pGammaButton->SetEnabled( false );
#else
const MaterialSystem_Config_t &config = materials->GetCurrentConfigForVideoCard(); const MaterialSystem_Config_t &config = materials->GetCurrentConfigForVideoCard();
m_pGammaButton->SetEnabled( !config.Windowed() ); m_pGammaButton->SetEnabled( !config.Windowed() );
#endif
} }
} }
@ -1600,10 +1631,12 @@ void COptionsSubVideo::OnTextChanged(Panel *pPanel, const char *pszText)
OnDataChanged(); OnDataChanged();
} }
} }
else if (pPanel == m_pAspectRatio) #ifndef ANDROID
{ else if (pPanel == m_pAspectRatio)
{
PrepareResolutionList(); PrepareResolutionList();
} }
#endif
else if (pPanel == m_pWindowed) else if (pPanel == m_pWindowed)
{ {
PrepareResolutionList(); PrepareResolutionList();
@ -1645,7 +1678,11 @@ void COptionsSubVideo::EnableOrDisableWindowedForVR()
} }
else else
{ {
#ifdef ANDROID
m_pWindowed->SetEnabled( false );
#else
m_pWindowed->SetEnabled( true ); m_pWindowed->SetEnabled( true );
#endif
} }
} }

View File

@ -333,10 +333,7 @@ public:
void JoystickButtonRelease( int joystickId, int button ); // same as above. void JoystickButtonRelease( int joystickId, int button ); // same as above.
void JoystickAxisMotion( int joystickId, int axis, int value ); void JoystickAxisMotion( int joystickId, int axis, int value );
void FingerDown( int fingerId, int x, int y ); void FingerEvent( int eventType, int fingerId, float x, float y, float dx, float dy );
void FingerUp( int fingerId, int x, int y );
void FingerMotion( int fingerId, int x, int y );
// Steam Controller // Steam Controller
void ReadSteamController( int iIndex ); void ReadSteamController( int iIndex );

View File

@ -24,19 +24,15 @@ int TouchSDLWatcher( void *userInfo, SDL_Event *event )
if( !window ) if( !window )
return 0; return 0;
int width, height;
width = height = 0;
SDL_GetWindowSize(window, &width, &height);
switch ( event->type ) { switch ( event->type ) {
case SDL_FINGERDOWN: case SDL_FINGERDOWN:
pInputSystem->FingerDown( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height ); pInputSystem->FingerEvent( IE_FingerDown, event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy );
break; break;
case SDL_FINGERUP: case SDL_FINGERUP:
pInputSystem->FingerUp( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height ); pInputSystem->FingerEvent( IE_FingerUp, event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy );
break; break;
case SDL_FINGERMOTION: case SDL_FINGERMOTION:
pInputSystem->FingerMotion( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height ); pInputSystem->FingerEvent( IE_FingerMotion ,event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy );
break; break;
} }
@ -67,32 +63,20 @@ void CInputSystem::ShutdownTouch()
m_bTouchInitialized = false; m_bTouchInitialized = false;
} }
void CInputSystem::FingerDown(int fingerId, int x, int y) void CInputSystem::FingerEvent(int eventType, int fingerId, float x, float y, float dx, float dy)
{ {
m_touchAccumEvent = IE_FingerDown; // Shit, but should work with arm/x86
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerDown, m_nLastSampleTick, fingerId, x, y); int data0 = fingerId << 16 | eventType;
} int _x = (int)((double)x*0xFFFF);
int _y = (int)((double)y*0xFFFF);
void CInputSystem::FingerUp(int fingerId, int x, int y) int data1 = _x << 16 | (_y & 0xFFFF);
{
m_touchAccumEvent = IE_FingerUp; union{int i;float f;} ifconv;
m_touchAccumFingerId = fingerId; ifconv.f = dx;
m_touchAccumX = x; int _dx = ifconv.i;
m_touchAccumY = y; ifconv.f = dy;
int _dy = ifconv.i;
PostEvent(IE_FingerUp, m_nLastSampleTick, fingerId, x, y);
} PostEvent(data0, m_nLastSampleTick, data1, _dx, _dy);
void CInputSystem::FingerMotion(int fingerId, int x, int y)
{
m_touchAccumEvent = IE_FingerMotion;
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerMotion, m_nLastSampleTick, fingerId, x, y);
} }

View File

@ -163,15 +163,10 @@ static FILE *GetDebugFileHandle( void )
// mat_autosave_glshaders instructs the engine to save out the shader table at key points // mat_autosave_glshaders instructs the engine to save out the shader table at key points
// to the filename glshaders.cfg // to the filename glshaders.cfg
// //
#ifdef ANDROID
ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "0" );
ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "0" );
#else
ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "1" ); ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "1" );
ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "1" ); ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "1" );
#endif #endif
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Explicit instantiation of shader buffer implementation // Explicit instantiation of shader buffer implementation
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -943,7 +938,8 @@ void CShaderManager::Shutdown()
} }
#endif #endif
#ifdef DX_TO_GL_ABSTRACTION #if defined (DX_TO_GL_ABSTRACTION) && !defined (ANDROID)
if (mat_autosave_glshaders.GetInt()) if (mat_autosave_glshaders.GetInt())
{ {
SaveShaderCache("glshaders.cfg"); SaveShaderCache("glshaders.cfg");
@ -3757,6 +3753,10 @@ CON_COMMAND( mat_shadercount, "display count of all shaders and reset that count
#if defined( DX_TO_GL_ABSTRACTION ) #if defined( DX_TO_GL_ABSTRACTION )
void CShaderManager::DoStartupShaderPreloading() void CShaderManager::DoStartupShaderPreloading()
{ {
#ifdef ANDROID // Too slow
return;
#endif
if (mat_autoload_glshaders.GetInt()) if (mat_autoload_glshaders.GetInt())
{ {
double flStartTime = Plat_FloatTime(); double flStartTime = Plat_FloatTime();

View File

@ -790,7 +790,7 @@ public:
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0; virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0;
virtual void IN_TouchEvent( int type, int fingerId, int x, int y ) = 0; virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ) = 0;
}; };
#define CLIENT_DLL_INTERFACE_VERSION "VClient017" #define CLIENT_DLL_INTERFACE_VERSION "VClient017"

View File

@ -581,6 +581,20 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo )
} }
} }
const char *ExtraVpkPaths = getenv( "EXTRAS_VPK_PATH" );
char szAbsSearchPath[MAX_PATH];
if( ExtraVpkPaths )
{
CUtlStringList vecPaths;
V_SplitString( ExtraVpkPaths, ",", vecPaths );
FOR_EACH_VEC( vecPaths, idxExtraPath )
{
FileSystem_AddLoadedSearchPath( initInfo, "GAME", vecPaths[idxExtraPath], false );
}
}
bool bLowViolence = initInfo.m_bLowViolence; bool bLowViolence = initInfo.m_bLowViolence;
for ( KeyValues *pCur=pSearchPaths->GetFirstValue(); pCur; pCur=pCur->GetNextValue() ) for ( KeyValues *pCur=pSearchPaths->GetFirstValue(); pCur; pCur=pCur->GetNextValue() )
{ {
@ -602,11 +616,12 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo )
// We need a special identifier in the gameinfo.txt here because the base hl2 folder exists in different places. // We need a special identifier in the gameinfo.txt here because the base hl2 folder exists in different places.
// In the case of a game or a Steam-launched dedicated server, all the necessary prior engine content is mapped in with the Steam depots, // In the case of a game or a Steam-launched dedicated server, all the necessary prior engine content is mapped in with the Steam depots,
// so we can just use the path as-is. // so we can just use the path as-is.
pLocation += strlen( BASESOURCEPATHS_TOKEN ); pLocation += strlen( BASESOURCEPATHS_TOKEN );
} }
CUtlStringList vecFullLocationPaths; CUtlStringList vecFullLocationPaths;
char szAbsSearchPath[MAX_PATH];
V_MakeAbsolutePath( szAbsSearchPath, sizeof( szAbsSearchPath ), pLocation, pszBaseDir ); V_MakeAbsolutePath( szAbsSearchPath, sizeof( szAbsSearchPath ), pLocation, pszBaseDir );
// Now resolve any ./'s. // Now resolve any ./'s.

View File

@ -993,6 +993,7 @@ typedef enum _D3DTEXTUREADDRESS
typedef enum _D3DSHADEMODE typedef enum _D3DSHADEMODE
{ {
D3DSHADE_NONE = 0,
D3DSHADE_FLAT = 1, D3DSHADE_FLAT = 1,
D3DSHADE_GOURAUD = 2, D3DSHADE_GOURAUD = 2,
D3DSHADE_PHONG = 3, D3DSHADE_PHONG = 3,

View File

@ -48,8 +48,8 @@ CFLAGS = {
'common': { 'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP # disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'], 'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'], 'clang': ['-g0', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-g', '-fvisibility=hidden'], 'gcc': ['-g0', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3'] 'owcc': ['-fno-short-enum', '-ffloat-store', '-g3']
}, },
'fast': { 'fast': {

View File

@ -255,7 +255,7 @@ class Android:
if self.is_arm(): if self.is_arm():
if self.arch == 'armeabi-v7a': if self.arch == 'armeabi-v7a':
# ARMv7 support # ARMv7 support
cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS'] cflags += ['-mthumb', '-mfpu=neon-vfpv4', '-mcpu=cortex-a7', '-mtune=cortex-a7', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS']
if not self.is_clang() and not self.is_host(): if not self.is_clang() and not self.is_host():
cflags += [ '-mvectorize-with-neon-quad' ] cflags += [ '-mvectorize-with-neon-quad' ]

View File

@ -3361,11 +3361,11 @@ void convert_texture( GLint &internalformat, GLsizei width, GLsizei height, GLen
if( format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA ) if( format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA )
internalformat = format; internalformat = format;
// if( internalformat == GL_SRGB8_ALPHA8 ) if( internalformat == GL_SRGB8_ALPHA8 )
// internalformat = GL_RGBA; internalformat = GL_RGBA;
// if( internalformat == GL_SRGB8 ) if( internalformat == GL_SRGB8 )
// internalformat = GL_RGB; internalformat = GL_RGB;
if( data ) if( data )
{ {
@ -3412,12 +3412,12 @@ void convert_texture( GLint &internalformat, GLsizei width, GLsizei height, GLen
else if( internalformat == GL_SRGB8_ALPHA8 ) else if( internalformat == GL_SRGB8_ALPHA8 )
{ {
// pixel_srgb_inplace( data, 4, width, height ); // pixel_srgb_inplace( data, 4, width, height );
internalformat = GL_RGBA; // internalformat = GL_RGBA;
} }
else if( internalformat == GL_SRGB8 ) else if( internalformat == GL_SRGB8 )
{ {
// pixel_srgb_inplace( data, 3, width, height ); // pixel_srgb_inplace( data, 3, width, height );
internalformat = GL_RGB; // internalformat = GL_RGB;
} }
} }
@ -3659,15 +3659,17 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
GLenum glDataFormat = format->m_glDataFormat; // this could change if expansion kicks in GLenum glDataFormat = format->m_glDataFormat; // this could change if expansion kicks in
GLenum glDataType = format->m_glDataType; GLenum glDataType = format->m_glDataType;
GLMTexLayoutSlice *slice = &m_layout->m_slices[ desc->m_sliceIndex ]; GLMTexLayoutSlice *slice = &m_layout->m_slices[ desc->m_sliceIndex ];
void *sliceAddress = m_backing ? (m_backing + slice->m_storageOffset) : NULL; // this would change for PBO void *sliceAddress = m_backing ? (m_backing + slice->m_storageOffset) : NULL; // this would change for PBO
// allow use of subimage if the target is texture2D and it has already been teximage'd // allow use of subimage if the target is texture2D and it has already been teximage'd
bool mayUseSubImage = false; bool mayUseSubImage = false;
#ifdef ANDROID
if ( (target==GL_TEXTURE_2D) && (m_sliceFlags[ desc->m_sliceIndex ] & kSliceValid) ) if ( (target==GL_TEXTURE_2D) && (m_sliceFlags[ desc->m_sliceIndex ] & kSliceValid) )
{ {
// mayUseSubImage = gl_enabletexsubimage.GetInt() != 0; mayUseSubImage = gl_enabletexsubimage.GetInt() != 0;
} }
#endif
// check flavor, 2D, 3D, or cube map // check flavor, 2D, 3D, or cube map
// we also have the choice to use subimage if this is a tex already created. (open question as to benefit) // we also have the choice to use subimage if this is a tex already created. (open question as to benefit)

View File

@ -29,11 +29,13 @@
#ifdef _X360 #ifdef _X360
#include "xbox/xbox_win32stubs.h" #include "xbox/xbox_win32stubs.h"
#endif #endif
#include "MatSystemSurface.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
using namespace vgui; using namespace vgui;
extern CMatSystemSurface g_MatSystemSurface;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Vgui input events // Vgui input events
@ -374,7 +376,7 @@ static vgui::MouseCode ButtonCodeToMouseCode( ButtonCode_t buttonCode )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool InputHandleInputEvent( const InputEvent_t &event ) bool InputHandleInputEvent( const InputEvent_t &event )
{ {
switch( event.m_nType ) switch( event.m_nType & 0xFFFF )
{ {
case IE_ButtonPressed: case IE_ButtonPressed:
{ {
@ -425,25 +427,35 @@ bool InputHandleInputEvent( const InputEvent_t &event )
break; break;
case IE_FingerDown: case IE_FingerDown:
{ {
//g_pIInput->InternalCursorMoved( event.m_nData2, event.m_nData3 ); int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h);
g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 ); uint data = (uint)event.m_nData;
x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF);
y = h*((double)(data & 0xFFFF) / 0xFFFF);
g_pIInput->UpdateCursorPosInternal( x, y );
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED ); g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED );
g_pIInput->InternalMousePressed( MOUSE_LEFT ); g_pIInput->InternalMousePressed( MOUSE_LEFT );
} }
return true; return true;
case IE_FingerUp: case IE_FingerUp:
{ {
g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 ); int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h);
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED ); uint data = (uint)event.m_nData;
x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF);
y = h*((double)(data & 0xFFFF) / 0xFFFF);
g_pIInput->UpdateCursorPosInternal( x, y );
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED );
g_pIInput->InternalMouseReleased( MOUSE_LEFT ); g_pIInput->InternalMouseReleased( MOUSE_LEFT );
} }
return true; return true;
case IE_FingerMotion: case IE_FingerMotion:
{ {
//g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 ); int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h);
g_pIInput->InternalCursorMoved( event.m_nData2, event.m_nData3 ); uint data = (uint)event.m_nData;
x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF);
y = h*((double)(data & 0xFFFF) / 0xFFFF);
g_pIInput->InternalCursorMoved( x, y );
} }
return true; return true;
case IE_ButtonDoubleClicked: case IE_ButtonDoubleClicked:
{ {
// NOTE: data2 is the virtual key code (data1 contains the scan-code one) // NOTE: data2 is the virtual key code (data1 contains the scan-code one)

View File

@ -284,11 +284,9 @@ def configure(conf):
] ]
if conf.env.DEST_CPU == 'arm': if conf.env.DEST_CPU == 'arm':
flags += ['-fsigned-char', '-mfpu=neon'] flags += ['-fsigned-char']
if conf.env.DEST_OS == 'android': if conf.env.DEST_OS != 'android':
flags += ['-mcpu=cortex-a15', '-mtune=cortex-a15']
else:
flags += ['-march=native', '-mtune=native'] flags += ['-march=native', '-mtune=native']
else: else:
flags += ['-march=native','-mtune=native','-mfpmath=sse', '-msse', '-msse2'] flags += ['-march=native','-mtune=native','-mfpmath=sse', '-msse', '-msse2']