Move common functions declarations into header

This commit is contained in:
baldurk
2016-07-12 14:04:30 +02:00
parent af3cfa8932
commit eb9a545104
7 changed files with 81 additions and 26 deletions
+60
View File
@@ -0,0 +1,60 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2016 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include "3rdparty/cmdline/cmdline.h"
struct Command
{
virtual ~Command() {}
virtual void AddOptions(cmdline::parser &parser) = 0;
virtual int Execute(cmdline::parser &parser) = 0;
virtual const char *Description() = 0;
virtual bool IsInternalOnly() = 0;
virtual bool IsCaptureCommand() = 0;
};
void add_command(const std::string &name, Command *cmd);
void add_alias(const std::string &alias, const std::string &command);
int renderdoccmd(int argc, char **argv);
int renderdoccmd(std::vector<std::string> &argv);
struct CaptureOptions;
struct TextureDisplay;
#ifdef __cplusplus
struct IReplayRenderer;
typedef IReplayRenderer ReplayRenderer;
#else
struct ReplayRenderer
#endif
void readCapOpts(const std::string &str, CaptureOptions *opts);
// these must be defined in platform .cpps
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay &displayCfg);
std::wstring GetUsername();
+3 -1
View File
@@ -179,6 +179,8 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\renderdoc\3rdparty\miniz\miniz.h" />
<ClInclude Include="3rdparty\cmdline\cmdline.h" />
<ClInclude Include="renderdoccmd.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
@@ -198,4 +200,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
@@ -20,6 +20,10 @@
<ClInclude Include="..\renderdoc\3rdparty\miniz\miniz.h">
<Filter>3rdparty</Filter>
</ClInclude>
<ClInclude Include="renderdoccmd.h" />
<ClInclude Include="3rdparty\cmdline\cmdline.h">
<Filter>3rdparty</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Resources">
+5 -8
View File
@@ -22,14 +22,12 @@
* THE SOFTWARE.
******************************************************************************/
#include <string>
#include "renderdoccmd.h"
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <replay/renderdoc_replay.h>
#include <string.h>
#include <unistd.h>
#include <string>
#include <android_native_app_glue.h>
#define ANativeActivity_onCreate __attribute__((visibility("default"))) ANativeActivity_onCreate
@@ -49,7 +47,7 @@ string GetUsername()
return string("Username");
}
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay &displayCfg)
{
ANativeWindow *connectionScreenWindow = android_state->window;
@@ -72,7 +70,6 @@ void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
}
}
int renderdoccmd(int argc, char **argv);
void handle_cmd(android_app *app, int32_t cmd)
{
switch(cmd)
+5 -9
View File
@@ -22,14 +22,12 @@
* THE SOFTWARE.
******************************************************************************/
#include <string>
#include "renderdoccmd.h"
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <replay/renderdoc_replay.h>
#include <string.h>
#include <unistd.h>
#include <string>
using std::string;
@@ -41,12 +39,10 @@ string GetUsername()
return string(buf, buf + strlen(buf));
}
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay &displayCfg)
{
}
int renderdoccmd(int argc, char **argv);
int main(int argc, char *argv[])
{
setlocale(LC_CTYPE, "");
+2 -3
View File
@@ -23,6 +23,7 @@
* THE SOFTWARE.
******************************************************************************/
#include "renderdoccmd.h"
#include <iconv.h>
#include <locale.h>
#include <replay/renderdoc_replay.h>
@@ -41,7 +42,7 @@ string GetUsername()
return string(buf, buf + strlen(buf));
}
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay &displayCfg)
{
int scr;
@@ -140,8 +141,6 @@ void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
// be resolved and libGL wouldn't link, meaning dlsym(RTLD_NEXT) would fai
extern "C" void glXWaitGL();
int renderdoccmd(int argc, char **argv);
int main(int argc, char *argv[])
{
std::setlocale(LC_CTYPE, "");
+2 -5
View File
@@ -23,6 +23,7 @@
* THE SOFTWARE.
******************************************************************************/
#include "renderdoccmd.h"
#include <app/renderdoc_app.h>
#include <renderdocshim.h>
#include <replay/renderdoc_replay.h>
@@ -221,7 +222,7 @@ wstring GetUsername()
return username;
}
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay &displayCfg)
{
HWND wnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"renderdoccmd", L"renderdoccmd", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 1280, 720, NULL, NULL, hInstance, NULL);
@@ -265,10 +266,6 @@ void DisplayRendererPreview(ReplayRenderer *renderer, TextureDisplay displayCfg)
DestroyWindow(wnd);
}
int renderdoccmd(const std::vector<std::string> &argv);
bool argequal(const std::string &a, const std::string &b);
void readCapOpts(const std::string &str, CaptureOptions *opts);
int WINAPI wWinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine,
_In_ int nShowCmd)
{