Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F126051
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
7 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/util/nacl/module.cpp b/util/nacl/module.cpp
index 6ff54e22..b4adc507 100644
--- a/util/nacl/module.cpp
+++ b/util/nacl/module.cpp
@@ -1,99 +1,101 @@
#ifdef NACL
/* talks to chrome via the nacl stuff */
#include <ppapi/cpp/instance.h>
#include <ppapi/cpp/module.h>
#include <ppapi/cpp/var.h>
#include <ppapi/cpp/dev/scriptable_object_deprecated.h>
#include <SDL/SDL_nacl.h>
#include <string>
#include "../../main.h"
+#include "../network/network-system.h"
namespace nacl{
class PaintownScript: public pp::deprecated::ScriptableObject {
public:
virtual bool HasMethod(const pp::Var& method, pp::Var* exception);
virtual pp::Var Call(const pp::Var& method, const std::vector<pp::Var>& args,pp::Var* exception);
};
class PaintownInstance : public pp::Instance {
public:
explicit PaintownInstance(PP_Instance instance) : pp::Instance(instance) {
the_instance = this;
}
virtual ~PaintownInstance() {}
static PaintownInstance * the_instance;
/* set up the viewport and run the game as usual */
void run(){
SDL_NACL_SetInstance(pp_instance(), 640, 480);
int argc = 1;
char * argv[1] = {"paintown"};
+ Storage::setInstance(new Storage::NetworkSystem());
paintown_main(argc, argv);
}
virtual pp::Var GetInstanceObject(){
PaintownScript * object = new PaintownScript();
return pp::Var(this, object);
}
/* when the browser does paintownModule.postMessage('run') this will
* get executed.
*/
virtual void HandleMessage(const pp::Var& var_message){
if (!var_message.is_string()){
return;
}
std::string message = var_message.AsString();
if (message == "run"){
run();
}
}
};
PaintownInstance * PaintownInstance::the_instance;
bool PaintownScript::HasMethod(const pp::Var& method, pp::Var* exception){
if (!method.is_string()){
return false;
}
std::string name = method.AsString();
if (name == "run"){
return true;
}
return false;
}
pp::Var PaintownScript::Call(const pp::Var& method, const std::vector<pp::Var>& args,pp::Var* exception){
if (!method.is_string()){
return false;
}
std::string name = method.AsString();
if (name == "run"){
PaintownInstance::the_instance->run();
}
return pp::Var();
}
class PaintownModule : public pp::Module {
public:
PaintownModule() : pp::Module() {}
virtual ~PaintownModule() {}
virtual pp::Instance* CreateInstance(PP_Instance instance) {
return new PaintownInstance(instance);
}
};
}
namespace pp{
Module * CreateModule(){
return new nacl::PaintownModule();
}
}
#endif
diff --git a/util/nacl/network-system.cpp b/util/nacl/network-system.cpp
new file mode 100644
index 00000000..071c7964
--- /dev/null
+++ b/util/nacl/network-system.cpp
@@ -0,0 +1,77 @@
+#ifdef NACL
+
+#include "../network/network-system.h"
+
+namespace Storage{
+
+typedef Path::AbsolutePath AbsolutePath;
+typedef Path::RelativePath RelativePath;
+
+/* TODO */
+NetworkSystem::NetworkSystem(){
+}
+
+/* TODO */
+NetworkSystem::~NetworkSystem(){
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::find(const RelativePath & path){
+ return AbsolutePath();
+}
+
+/* TODO */
+RelativePath NetworkSystem::cleanse(const AbsolutePath & path){
+ return RelativePath();
+}
+
+/* TODO */
+bool NetworkSystem::exists(const RelativePath & path){
+ return false;
+}
+
+/* TODO */
+bool NetworkSystem::exists(const AbsolutePath & path){
+ return false;
+}
+
+/* TODO */
+std::vector<AbsolutePath> NetworkSystem::getFilesRecursive(const AbsolutePath & dataPath, const std::string & find, bool caseInsensitive){
+ std::vector<AbsolutePath> paths;
+ return paths;
+}
+
+/* TODO */
+std::vector<AbsolutePath> NetworkSystem::getFiles(const AbsolutePath & dataPath, const std::string & find, bool caseInsensitive){
+ std::vector<AbsolutePath> paths;
+ return paths;
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::configFile(){
+ return AbsolutePath();
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::userDirectory(){
+ return AbsolutePath();
+}
+
+/* TODO */
+std::vector<AbsolutePath> NetworkSystem::findDirectories(const RelativePath & path){
+ return std::vector<AbsolutePath>();
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::findInsensitive(const RelativePath & path){
+ return AbsolutePath();
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::lookupInsensitive(const AbsolutePath & directory, const RelativePath & path){
+ return AbsolutePath();
+}
+
+}
+
+#endif
diff --git a/util/network/network-system.cpp b/util/network/network-system.cpp
new file mode 100644
index 00000000..a9ad2b72
--- /dev/null
+++ b/util/network/network-system.cpp
@@ -0,0 +1,77 @@
+#ifdef HAVE_NETWORKING
+
+#include "network-system.h"
+
+namespace Storage{
+
+typedef Path::AbsolutePath AbsolutePath;
+typedef Path::RelativePath RelativePath;
+
+/* TODO */
+NetworkSystem::NetworkSystem(){
+}
+
+/* TODO */
+NetworkSystem::~NetworkSystem(){
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::find(const RelativePath & path){
+ return AbsolutePath();
+}
+
+/* TODO */
+RelativePath NetworkSystem::cleanse(const AbsolutePath & path){
+ return RelativePath();
+}
+
+/* TODO */
+bool NetworkSystem::exists(const RelativePath & path){
+ return false;
+}
+
+/* TODO */
+bool NetworkSystem::exists(const AbsolutePath & path){
+ return false;
+}
+
+/* TODO */
+std::vector<AbsolutePath> NetworkSystem::getFilesRecursive(const AbsolutePath & dataPath, const std::string & find, bool caseInsensitive){
+ std::vector<AbsolutePath> paths;
+ return paths;
+}
+
+/* TODO */
+std::vector<AbsolutePath> NetworkSystem::getFiles(const AbsolutePath & dataPath, const std::string & find, bool caseInsensitive){
+ std::vector<AbsolutePath> paths;
+ return paths;
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::configFile(){
+ return AbsolutePath();
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::userDirectory(){
+ return AbsolutePath();
+}
+
+/* TODO */
+std::vector<AbsolutePath> NetworkSystem::findDirectories(const RelativePath & path){
+ return std::vector<AbsolutePath>();
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::findInsensitive(const RelativePath & path){
+ return AbsolutePath();
+}
+
+/* TODO */
+AbsolutePath NetworkSystem::lookupInsensitive(const AbsolutePath & directory, const RelativePath & path){
+ return AbsolutePath();
+}
+
+}
+
+#endif
diff --git a/util/network/network-system.h b/util/network/network-system.h
index 37f298ab..594be4e5 100644
--- a/util/network/network-system.h
+++ b/util/network/network-system.h
@@ -1,16 +1,29 @@
#ifndef _paintown_network_system_h
#define _paintown_network_system_h
-#include "file-system.h"
+#include "../file-system.h"
namespace Storage{
class NetworkSystem: public System {
public:
NetworkSystem();
virtual ~NetworkSystem();
+
+ virtual AbsolutePath find(const RelativePath & path);
+ virtual RelativePath cleanse(const AbsolutePath & path);
+ virtual bool exists(const RelativePath & path);
+ virtual bool exists(const AbsolutePath & path);
+ virtual std::vector<AbsolutePath> getFilesRecursive(const AbsolutePath & dataPath, const std::string & find, bool caseInsensitive = false);
+ virtual std::vector<AbsolutePath> getFiles(const AbsolutePath & dataPath, const std::string & find, bool caseInsensitive = false);
+ virtual AbsolutePath configFile();
+ virtual AbsolutePath userDirectory();
+ virtual std::vector<AbsolutePath> findDirectories(const RelativePath & path);
+ virtual AbsolutePath findInsensitive(const RelativePath & path);
+ virtual AbsolutePath lookupInsensitive(const AbsolutePath & directory, const RelativePath & path);
+
};
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jun 11, 10:30 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
68423
Default Alt Text
(7 KB)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline