update overlay to have ps controls too
[carveJwlIkooP6JGAAIwe30JlM.git] / workshop.h
1 #pragma once
2 #include "addon_types.h"
3 #include "vg/vg_steam_remote_storage.h"
4 #include "skaterift.h"
5 #include "vg/vg_steam_auth.h"
6 #include "vg/vg_steam_ugc.h"
7 #include "vg/vg_steam_friends.h"
8 #include "steam.h"
9 #include "ent_skateshop.h"
10
11 struct async_workshop_filepath_info{
12 PublishedFileId_t id;
13 char *buf;
14 u32 len;
15 };
16
17 struct async_workshop_installed_files_info{
18 PublishedFileId_t *buffer;
19 u32 *len; /* inout */
20 };
21
22 struct async_workshop_metadata_info{
23 struct workshop_file_info *info;
24 const char *path;
25 };
26
27
28 #define WORKSHOP_VIEW_PER_PAGE 15
29
30 struct workshop_form{
31 enum workshop_op {
32 k_workshop_op_none,
33 k_workshop_op_downloading_submission,
34 k_workshop_op_publishing_update,
35 k_workshop_op_loading_model
36 }
37 op;
38
39 struct {
40 char title[80];
41 char description[512];
42 char author[32];
43 i32 submission_type_selection;
44 enum addon_type type;
45
46 PublishedFileId_t file_id; /* 0 if not published yet */
47
48 i32 visibility;
49 int submit_title, /* set if the respective controls are touched */
50 submit_description,
51 submit_file_and_image;
52 }
53 submission;
54
55 enum workshop_form_page{
56 k_workshop_form_hidden,
57 k_workshop_form_open, /* open but not looking at anything */
58 k_workshop_form_edit, /* editing a submission */
59 k_workshop_form_cclosing,
60 k_workshop_form_closing_good, /* post upload screen */
61 k_workshop_form_closing_bad,
62 }
63 page;
64
65 /* model viewer
66 * -----------------------------
67 */
68
69 char addon_folder[128];
70 struct player_board board_model;
71 struct player_model player_model;
72
73 /* what does the user want to do with the image preview? */
74 enum workshop_form_file_intent{
75 k_workshop_form_file_intent_none, /* loading probably */
76 k_workshop_form_file_intent_new, /* board_model is valid */
77 k_workshop_form_file_intent_keep_old /* just browsing */
78 }
79 file_intent;
80
81 world_instance *view_world;
82 ent_swspreview *ptr_ent;
83 v2f view_angles,
84 view_angles_begin;
85 v3f view_offset,
86 view_offset_begin;
87
88 float view_dist;
89 int view_changed;
90
91 /*
92 * published UGC request
93 * ------------------------------
94 */
95
96 struct {
97 UGCQueryHandle_t handle;
98 EResult result;
99
100 int all_item_count,
101 returned_item_count;
102 }
103 ugc_query;
104
105 /*
106 * UI information
107 * ------------------------------------------
108 */
109
110 const char *failure_or_success_string;
111 char error_msg[256];
112
113 int img_w, img_h;
114 u8 *img_buffer;
115
116 int view_published_page_count,
117 view_published_page_id;
118
119 struct published_file{
120 EResult result;
121 int result_index;
122 char title[80];
123 }
124 published_files_list[WORKSHOP_VIEW_PER_PAGE];
125 int published_files_list_length;
126 }
127 extern workshop_form;
128
129 void workshop_init(void);
130 int workshop_submit_command( int argc, const char *argv[] );
131 void async_workshop_get_filepath( void *data, u32 len );
132 void async_workshop_get_installed_files( void *data, u32 len );
133 void workshop_load_metadata( const char *path,struct workshop_file_info *info );
134 void workshop_form_gui(void);