steam sdk接入和多语言

This commit is contained in:
wuwenbo 2025-05-27 20:32:59 +08:00
parent 02dd053b94
commit 1da5b467b5
301 changed files with 147079 additions and 7 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 11bd481dedab309449d6ac6e71fd9ea9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,362 @@
1,"消息列表"
2,"建设"
3,"[我要看到血流成河!]
"
4,"阵营的普通单位如完成击杀后,将
在下回合获得攻击强化。
"
5,"排名列表(#3)"
6,"名次"
7,"玩家名"
8,"城市数"
9,"信仰"
10,"比那名居天子"
11,"带领<普鲁士帝国>"
12,"设置"
13,"排名"
14,"科技"
15,"消息"
16,"下回合"
17,"城市已升级!"
18,"请从下方选择一项奖励"
19,"工作坊"
20,"有bug别点"
21,"公园"
22,"伟人"
23,"城墙"
24,"财富"
25,"人口扩张"
26,"领土扩张"
27,"请等待其他玩家操作..."
28,"步兵"
29,"轻骑兵"
30,"弓兵"
31,"盾兵"
32,"剑士"
33,"重骑兵"
34,"炮兵"
35,"芙兰朵露"
36,"蕾米莉亚"
37,"十六夜咲夜"
38,"红美铃"
39,"帕秋莉诺蕾姬"
40,"占领城市"
41,"升级"
42,"恢复
"
43,"解雇"
44,"挖掘"
45,"采集"
46,"帆船"
47,"冲锋艇"
48,"战舰"
49,"清除树林"
50,"渔猎"
51,"狩捕"
52,"林场"
53,"采矿场"
54,"农田"
55,"港口"
56,"道路"
57,"桥梁"
58,"谷仓"
59,"加工厂"
60,"市场"
61,"冶炼厂"
62,"神庙"
63,"森林神庙"
64,"山神庙"
65,"海洋神庙"
66,"焚林垦田"
67,"植树造林"
68,"拆除"
69,"和平祭坛"
70,"智慧之塔"
71,"繁荣之殿"
72,"财富之巅"
73,"权力之门"
74,"皇家公园"
75,"世界之眼"
76,"平原"
77,"这是一片空旷的土地。"
78,"这里是提示文字
提示玩家应该怎么操作"
79,"登山"
80,"KING
职阶召唤
"
81,"BISHOP
职阶召唤
"
82,"QUEEN
职阶召唤
"
83,"KNIGHTS
职阶召唤
"
84,"CHARIOT
职阶召唤
"
85,"科技名称"
86,"该科技将会解锁以下内容:"
87,"取消"
88,"研发"
89,"[巴别之瞻妄]"
90,"帝国控制的城市越多,研发科技的费用越高。"
91,"当帝国规模愈发庞大,众声喧哗的世界便难以共鸣于同一道理。知识在各城邦间折损、误解、甚至扭曲,如同昔日攀天之塔的回音,终将自毁其基。"
92,"金币 (+2)"
93,"回合"
94,"十六夜姣夜"
95,"这里是宵夜的对话内容。
第二行。
第三行"
96,"这里是蕾米的对话内容。
第二行。
第三行。"
97,"测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文"
98,"测试标题"
99,"确认"
100,"胜利"
101,"恭喜您获得最终胜利!"
102,"拥有城市"
103,"拥有雕塑"
104,"最终得分"
105,"返回主菜单"
106,"失败"
107,"很遗憾,您已出局"
108,"新游戏"
109,"继续游戏"
110,"故事模式"
111,"图鉴"
112,"战绩"
113,"关于"
114,"地图尺寸"
115,"玩家数量"
116,"游戏难度"
117,"选择阵营
"
118,"红魔馆"
119,"难度"
120,"高傲的红魔馆大小姐抽到了<color=red>埃及</color>帝国卡。
不知为什么,她赌上了整个红魔馆押自己赢。"
121,"“无聊,我要看到血流成河!”"
122,"埃及帝国"
123,"优雅而怠惰的月之公主抽到了<color=blue>法兰西</color>帝国卡。
尚无败绩,不过好像都是她的宠物月兔代打。"
124,"“输了的话,今晚就没饭吃了哦,铃仙酱~”"
125,"永远亭"
126,"法兰西帝国"
127,"沉静而可怖的地灵殿主人抽到了<color=orange>印度</color>帝国卡。
她只是来寻找妹妹和宠物,稀里糊涂加入了对局。"
128,"“投降吧,阁下毫无胜算。我只想带她们早些回家。”"
129,"地灵殿"
130,"印度帝国"
131,"“投降吧,阁下毫无胜算。我只想带她们回家。”"
132,"开始霸业!"
133,"经典模式"
134,"征服模式"
135,"来自红魔馆的吸血鬼大小姐——蕾米莉亚·斯卡雷特,此刻伫立于金字塔之巅,宣告自己即是埃及正统的王权化身。她将率领红魔馆的将领们南征北讨,驱策妖精女仆在尼罗河的滋养下开垦荒芜之地,筑起属于斯卡雷特王朝的辉煌帝国。"
136,"斯卡雷特王朝"
137,"伟人阵营"
138,"芙兰朵露·斯卡雷特"
139,"继承<color=yellow>赛特</color>意志的恶魔之妹。"
140,"继承<color=yellow>克里欧帕特拉</color>意志的魔女。"
141,"蕾米莉亚·斯卡雷特"
142,"继承<color=yellow>奥里西斯</color>意志的吸血鬼。"
143,"继承<color=yellow>阿努比斯</color>意志的女仆长。"
144,"继承<color=yellow>荷鲁斯</color>意志的武术家。"
145,"伟人职阶:<color=yellow>马(Knights)</color>
继承<color=yellow>赛特</color>意志的红魔馆二小姐。拥有特色破局技能<color=red>四重存在</color>。"
146,"帕秋莉·诺蕾姬"
147,"伟人职阶:<color=yellow>后(Queen)</color>
继承<color=yellow>克里欧帕特拉</color>意志的魔女。拥有特色范围伤害技能<color=red>皇家烈焰</color>。"
148,"伟人职阶:<color=yellow>王(King)</color>
继承<color=yellow>奥西里斯</color>意志的吸血鬼。拥有特色反击回复技能<color=red>红色不夜城</color>。"
149,"伟人职阶:<color=yellow>相(Bishop)</color>
继承<color=yellow>阿努比斯</color>意志的女仆长。拥有特色突袭技能<color=red>银之跳跃</color>。"
150,"伟人职阶:<color=yellow>车(Rook)</color>
继承<color=yellow>荷鲁斯</color>意志的武术家。拥有特色反伤技能<color=red>虹色太极拳</color>。"
151,"士兵特性"
152,"妖精女仆"
153,"领土内未改造的<color=yellow>森林</color>可训练基础单位。
<color=#888888>妖精是森林的呼吸,是自然的化身。</color>"
154,"文明特性"
155,"尼罗河的女儿"
156,"在游戏开始时拥有<color=yellow>耕种</color>科技。
<color=#888888>埃及是尼罗河的馈赠。</color>"
157,"来自永远亭的月之公主——蓬莱山辉夜,此刻端坐于凯旋门下,优雅地宣布她将继承法兰西帝国的荣光。月光洒落枫丹白露,竹影漫过香榭丽舍。她将率领兔子军团,漫步于革命与浪漫交织的疆土上,从容地重塑法兰西的雄图霸业。"
158,"蓬莱山王朝"
159,"铃仙·优昙华院·因幡"
160,"继承<color=yellow>拉纳</color>意志的月兔。"
161,"八意永琳"
162,"继承<color=yellow>贝尔蒂埃</color>意志的月人。"
163,"蓬莱山辉夜"
164,"继承<color=yellow>拿破仑</color>意志的月之公主。"
165,"因幡帝"
166,"继承<color=yellow>红衣主教</color>意志的妖怪兔。"
167,"藤原妹红"
168,"继承<color=yellow>贝尔纳多特</color>意志的蓬莱人。"
169,"妖怪兔"
170,"永远亭阵营的单位在领土内的<color=yellow>恢复</color>量由4点提升至5点。
<color=#888888>兔子轻跳而过,好运悄然而至。</color>"
171,"田园绅士学"
172,"在游戏开始时拥有<color=yellow>采集</color>科技。
<color=#888888>文明的第一课,就在在葡萄藤与玫瑰花间。</color>"
173,"埃及"
174,"法兰西"
175,"普鲁士"
176,"普鲁士帝国
守矢王朝"
177,"八坂神奈子将扮演普鲁士帝国——守矢铁血联盟的最高领袖。她将以神权与军威并重的姿态,率守矢神社在钢铁洪流中强势登顶东方理想国大赛!"
178,"射命丸文"
179,"犬走花"
180,"泄矢诹访子"
181,"东风谷早苗"
182,"八坂神奈子"
183,"领袖特性"
184,"[神不需要奇迹]
"
185,"挖掘<遗迹>必定获得强力作战单位。"
186,"[妖怪山的天狗们]
"
187,"1范围内如有友方死亡自身获得1回合的强化效果。"
188,"[鲁尔山谷]
"
189,"初始拥有<狩猎>科技。没有矿石的山脉也能为冶炼厂提供1点城市经验。"
190,"印度帝国
古明地王朝"
191,"古明地觉将扮演印度帝国——地灵圣朝的女王。她将以深不可测的心灵操控,带领地灵殿,在恒河文明中冉冉升起,问鼎东方理想国大赛的最终冠军。"
192,"星熊勇仪"
193,"灵乌路空"
194,"古明地恋"
195,"火焰猫燐"
196,"古明地觉"
197,"[你还有一次说谎的机会]
"
198,"游戏开始时获得所有敌人位置和所有遗迹位置的提示"
199,"[旧地狱的怨灵]
"
200,"被杀死后,会对凶手附加<中毒>的负面效果。"
201,"[恒河女神]
"
202,"初始拥有<种植>科技。种树享受40%的折扣。"
203,"战绩历史"
204,"所有战绩"
205,"回合数"
206,"得分"
207,"阵营"
208,"得分系数"
209,"日期"
210,"阵营图鉴"
211,"伟人图鉴"
212,"奇观图鉴"
213,"成就图鉴"
214,"阵营图鉴
"
215,"高傲而任性的红魔馆大小姐抽到了<color=red>埃及</color>帝国卡。
不知为什么,她赌上了整个红魔馆押自己赢。"
216,"沉静而可怖的地灵殿主人抽到了<color=green>印度</color>帝国卡。
她只是来寻找妹妹和宠物,稀里糊涂加入了对局。"
217,"“投降吧,阁下毫无胜算。我只想带她们仨快点回去。”"
218,"可靠又专横的风雨之神抽到了<color=black>普鲁士</color>帝国卡。
她已经为这款游戏新成立了并购部和宣传部。"
219,"“我要这游戏的冠名权,把你们负责人叫来。”"
220,"守矢神社"
221,"普鲁士帝国"
222,"“投降吧,你没有胜算。我只想快点带家妹回去。”"
223,"帝王星收集 3 / 5
在游戏中召唤对应的伟人,点亮帝王星吧!"
224,"伟人图鉴
"
225,"角色介绍"
226," 继承了<color=red>阿努比斯</color>意志的少女,原本是在红魔馆服侍蕾米莉亚·斯卡蕾特的女仆长,拥有操纵时间/停止时间程度的能力。
"
227," 她是红魔馆中唯一的人类,冷静从容、头脑敏锐、优雅潇洒,偶尔也有些毒舌。对大小姐唯命是从,也正因此陪着任性的主人一同加入到了这款风靡幻想乡的游戏之中。"
228,"居然是……冥界守护神吗?不过大小姐那种程度,是不会死的吧。这样一来,我就变得多余了呢。"
229,"大小姐也来到冥界了吗?该说幸运还是不幸呢……反正不管在哪里,我都会侍奉好大小姐。"
230," 在意识到大小姐所扮演的<color=red>奥里西斯</color>亦有<color=red>冥王</color>的身份后,她似乎有些开心,这便是操纵命运的能力吧,她这么想。"
231,"冥界的守护神?说得倒轻松,我是不是该去向某位偷懒的死神讨教一下‘划水秘诀’了呢。"
232," 虽然招牌的道具变成了安卡和瓦斯权杖,但她仍在黑曜石神像的阴影之中擦亮了手中的银刃。一定要帮助大小姐赢下比赛,她已下决心。"
233," 获得<color=red>阿努比斯</color>扮演卡的人类少女。她本是在红魔馆服侍蕾米莉亚·斯卡蕾特的女仆长,陪着任性的大小姐一同加入游戏。
"
234,"居然是……亡者引路人吗?不过大小姐是不会死的吧。我变得多余了呢。"
235,"角色特性"
236,"三星挑战"
237,"[又见面了,大小姐]"
238,"累计召唤10次"
239,"[完美潇洒的从者]"
240,"在一回合内连续闪现到4个不同的伟人身边"
241,"[于冥河守候]"
242,"闪现到蕾米莉亚身边后蕾米莉亚在该回合内死亡"
243,"在一回合内连续闪现到4个不同的己方伟人身边"
244,"[为您指引归途]"
245,"闪现到蕾米莉亚身边后,蕾米莉亚在该回合内死亡"
246,"十六夜 夜"
247,""
248,""
249,"奇观介绍"
250," 古代世界最大、最著名的图书馆,建于托勒密王朝时期的埃及,旨在收藏天下所有知识。后因战火与政治动荡多次焚毁。
在游戏中,作为<color=red>知识类奇观</color>解锁全部科后即可获得提供3点城市经验。"
251,"众人评价"
252,"蕾米莉亚和帕秋莉正在讨论。"
253,"七十万卷!你可别让小恶魔累死哦。传出去坏了我红魔馆的名声。"
254,"小恶魔很结实,何况她是自愿的。倒是某只老鼠可能会累死吧。"
255,"听说进了亚历山大港的船只,必须把书留下来,就像打劫一样呢。"
256,"若真如此,我还真希望黑白老鼠多来几趟。"
257,"[雅典娜的居所]"
258,"累计建造10次"
259,"[船过港,书且留]"
260,"在<color=red>亚历山大港</color>建造该奇观,必须靠近<color=red>谷仓</color>、<color=red>港口</color>和<color=red>市中心</color>"
261,"[七十万卷遗梦]"
262,"伟人<color=red>帕秋莉·诺蕾姬</color>在该奇观上连续停留10回合"
263,"亚历山大图书馆"
264,"成就收集星({count}/100)"
265,"战斗成就"
266,"战斗成就(5/25)"
267,"[系统设置]"
268,"音乐音量"
269,"音效音量"
270,"显示提示"
271,"语言"
272,"简体中文"
273,"关闭"
274,"退出"
275,"关于我们"
276,"出品 蕾米莉亚指挥部"
277,"原作 上海爱丽丝幻乐团"
278,"本作品为 东方project 的二次同人创作"
279,"关注我们"
280,"@蕾米莉亚指挥部"
281,"官方网站"
282,"开发团队"
283,"版本信息"
284,"隐私政策"
285,"服务条款"
286,"少女加冕中..."
287,"卢克索神庙"
288,"孟菲斯老城"
289,"吉萨大金字塔"
290,"阿布辛贝大神庙"
291,"狮身人面像"
292,"奥里西斯神庙"
293,"枫丹白露宫"
294,"索邦大学"
295,"交易所广场"
296,"卢浮宫"
297,"凯旋门"
298,"巴黎圣母院"
299,"巴黎天文台"
300,"勃兰登堡门"
301,"海登堡大学"
302,"汉堡港口仓库城"
303,"新天鹅堡"
304,"柏林胜利纪念柱"
305,"拜罗伊特节日剧院"
306,"齐柏林飞艇基地"
307,"阿育王柱"
308,"那烂陀寺"
309,"亨比"
310,"泰姬陵"
311,"红堡"
312,"米纳克希神庙"
313,"简塔曼塔天文台"
1 1 消息列表
2 2 建设
3 3 [我要看到血流成河!]
4 4 阵营的普通单位如完成击杀后,将 在下回合获得攻击强化。
5 5 排名列表(#3)
6 6 名次
7 7 玩家名
8 8 城市数
9 9 信仰
10 10 比那名居天子
11 11 带领<普鲁士帝国>
12 12 设置
13 13 排名
14 14 科技
15 15 消息
16 16 下回合
17 17 城市已升级!
18 18 请从下方选择一项奖励
19 19 工作坊
20 20 有bug别点
21 21 公园
22 22 伟人
23 23 城墙
24 24 财富
25 25 人口扩张
26 26 领土扩张
27 27 请等待其他玩家操作...
28 28 步兵
29 29 轻骑兵
30 30 弓兵
31 31 盾兵
32 32 剑士
33 33 重骑兵
34 34 炮兵
35 35 芙兰朵露
36 36 蕾米莉亚
37 37 十六夜咲夜
38 38 红美铃
39 39 帕秋莉诺蕾姬
40 40 占领城市
41 41 升级
42 42 恢复
43 43 解雇
44 44 挖掘
45 45 采集
46 46 帆船
47 47 冲锋艇
48 48 战舰
49 49 清除树林
50 50 渔猎
51 51 狩捕
52 52 林场
53 53 采矿场
54 54 农田
55 55 港口
56 56 道路
57 57 桥梁
58 58 谷仓
59 59 加工厂
60 60 市场
61 61 冶炼厂
62 62 神庙
63 63 森林神庙
64 64 山神庙
65 65 海洋神庙
66 66 焚林垦田
67 67 植树造林
68 68 拆除
69 69 和平祭坛
70 70 智慧之塔
71 71 繁荣之殿
72 72 财富之巅
73 73 权力之门
74 74 皇家公园
75 75 世界之眼
76 76 平原
77 77 这是一片空旷的土地。
78 78 这里是提示文字 提示玩家应该怎么操作
79 79 登山
80 80 KING 职阶召唤
81 81 BISHOP 职阶召唤
82 82 QUEEN 职阶召唤
83 83 KNIGHTS 职阶召唤
84 84 CHARIOT 职阶召唤
85 85 科技名称
86 86 该科技将会解锁以下内容:
87 87 取消
88 88 研发
89 89 [巴别之瞻妄]
90 90 帝国控制的城市越多,研发科技的费用越高。
91 91 当帝国规模愈发庞大,众声喧哗的世界便难以共鸣于同一道理。知识在各城邦间折损、误解、甚至扭曲,如同昔日攀天之塔的回音,终将自毁其基。
92 92 金币 (+2)
93 93 回合
94 94 十六夜姣夜
95 95 这里是宵夜的对话内容。 第二行。 第三行
96 96 这里是蕾米的对话内容。 第二行。 第三行。
97 97 测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文
98 98 测试标题
99 99 确认
100 100 胜利
101 101 恭喜您获得最终胜利!
102 102 拥有城市
103 103 拥有雕塑
104 104 最终得分
105 105 返回主菜单
106 106 失败
107 107 很遗憾,您已出局
108 108 新游戏
109 109 继续游戏
110 110 故事模式
111 111 图鉴
112 112 战绩
113 113 关于
114 114 地图尺寸
115 115 玩家数量
116 116 游戏难度
117 117 选择阵营
118 118 红魔馆
119 119 难度
120 120 高傲的红魔馆大小姐抽到了<color=red>埃及</color>帝国卡。 不知为什么,她赌上了整个红魔馆押自己赢。
121 121 “无聊,我要看到血流成河!”
122 122 埃及帝国
123 123 优雅而怠惰的月之公主抽到了<color=blue>法兰西</color>帝国卡。 尚无败绩,不过好像都是她的宠物月兔代打。
124 124 “输了的话,今晚就没饭吃了哦,铃仙酱~”
125 125 永远亭
126 126 法兰西帝国
127 127 沉静而可怖的地灵殿主人抽到了<color=orange>印度</color>帝国卡。 她只是来寻找妹妹和宠物,稀里糊涂加入了对局。
128 128 “投降吧,阁下毫无胜算。我只想带她们早些回家。”
129 129 地灵殿
130 130 印度帝国
131 131 “投降吧,阁下毫无胜算。我只想带她们回家。”
132 132 开始霸业!
133 133 经典模式
134 134 征服模式
135 135 来自红魔馆的吸血鬼大小姐——蕾米莉亚·斯卡雷特,此刻伫立于金字塔之巅,宣告自己即是埃及正统的王权化身。她将率领红魔馆的将领们南征北讨,驱策妖精女仆在尼罗河的滋养下开垦荒芜之地,筑起属于斯卡雷特王朝的辉煌帝国。
136 136 斯卡雷特王朝
137 137 伟人阵营
138 138 芙兰朵露·斯卡雷特
139 139 继承<color=yellow>赛特</color>意志的恶魔之妹。
140 140 继承<color=yellow>克里欧帕特拉</color>意志的魔女。
141 141 蕾米莉亚·斯卡雷特
142 142 继承<color=yellow>奥里西斯</color>意志的吸血鬼。
143 143 继承<color=yellow>阿努比斯</color>意志的女仆长。
144 144 继承<color=yellow>荷鲁斯</color>意志的武术家。
145 145 伟人职阶:<color=yellow>马(Knights)</color> 继承<color=yellow>赛特</color>意志的红魔馆二小姐。拥有特色破局技能<color=red>四重存在</color>。
146 146 帕秋莉·诺蕾姬
147 147 伟人职阶:<color=yellow>后(Queen)</color> 继承<color=yellow>克里欧帕特拉</color>意志的魔女。拥有特色范围伤害技能<color=red>皇家烈焰</color>。
148 148 伟人职阶:<color=yellow>王(King)</color> 继承<color=yellow>奥西里斯</color>意志的吸血鬼。拥有特色反击回复技能<color=red>红色不夜城</color>。
149 149 伟人职阶:<color=yellow>相(Bishop)</color> 继承<color=yellow>阿努比斯</color>意志的女仆长。拥有特色突袭技能<color=red>银之跳跃</color>。
150 150 伟人职阶:<color=yellow>车(Rook)</color> 继承<color=yellow>荷鲁斯</color>意志的武术家。拥有特色反伤技能<color=red>虹色太极拳</color>。
151 151 士兵特性
152 152 妖精女仆
153 153 领土内未改造的<color=yellow>森林</color>可训练基础单位。 <color=#888888>妖精是森林的呼吸,是自然的化身。</color>
154 154 文明特性
155 155 尼罗河的女儿
156 156 在游戏开始时拥有<color=yellow>耕种</color>科技。 <color=#888888>埃及是尼罗河的馈赠。</color>
157 157 来自永远亭的月之公主——蓬莱山辉夜,此刻端坐于凯旋门下,优雅地宣布她将继承法兰西帝国的荣光。月光洒落枫丹白露,竹影漫过香榭丽舍。她将率领兔子军团,漫步于革命与浪漫交织的疆土上,从容地重塑法兰西的雄图霸业。
158 158 蓬莱山王朝
159 159 铃仙·优昙华院·因幡
160 160 继承<color=yellow>拉纳</color>意志的月兔。
161 161 八意永琳
162 162 继承<color=yellow>贝尔蒂埃</color>意志的月人。
163 163 蓬莱山辉夜
164 164 继承<color=yellow>拿破仑</color>意志的月之公主。
165 165 因幡帝
166 166 继承<color=yellow>红衣主教</color>意志的妖怪兔。
167 167 藤原妹红
168 168 继承<color=yellow>贝尔纳多特</color>意志的蓬莱人。
169 169 妖怪兔
170 170 永远亭阵营的单位在领土内的<color=yellow>恢复</color>量由4点提升至5点。 <color=#888888>兔子轻跳而过,好运悄然而至。</color>
171 171 田园绅士学
172 172 在游戏开始时拥有<color=yellow>采集</color>科技。 <color=#888888>文明的第一课,就在在葡萄藤与玫瑰花间。</color>
173 173 埃及
174 174 法兰西
175 175 普鲁士
176 176 普鲁士帝国 守矢王朝
177 177 八坂神奈子将扮演普鲁士帝国——守矢铁血联盟的最高领袖。她将以神权与军威并重的姿态,率守矢神社在钢铁洪流中强势登顶东方理想国大赛!
178 178 射命丸文
179 179 犬走花
180 180 泄矢诹访子
181 181 东风谷早苗
182 182 八坂神奈子
183 183 领袖特性
184 184 [神不需要奇迹]
185 185 挖掘<遗迹>必定获得强力作战单位。
186 186 [妖怪山的天狗们]
187 187 1范围内如有友方死亡,自身获得1回合的强化效果。
188 188 [鲁尔山谷]
189 189 初始拥有<狩猎>科技。没有矿石的山脉也能为冶炼厂提供1点城市经验。
190 190 印度帝国 古明地王朝
191 191 古明地觉将扮演印度帝国——地灵圣朝的女王。她将以深不可测的心灵操控,带领地灵殿,在恒河文明中冉冉升起,问鼎东方理想国大赛的最终冠军。
192 192 星熊勇仪
193 193 灵乌路空
194 194 古明地恋
195 195 火焰猫燐
196 196 古明地觉
197 197 [你还有一次说谎的机会]
198 198 游戏开始时获得所有敌人位置和所有遗迹位置的提示
199 199 [旧地狱的怨灵]
200 200 被杀死后,会对凶手附加<中毒>的负面效果。
201 201 [恒河女神]
202 202 初始拥有<种植>科技。种树享受40%的折扣。
203 203 战绩历史
204 204 所有战绩
205 205 回合数
206 206 得分
207 207 阵营
208 208 得分系数
209 209 日期
210 210 阵营图鉴
211 211 伟人图鉴
212 212 奇观图鉴
213 213 成就图鉴
214 214 阵营图鉴
215 215 高傲而任性的红魔馆大小姐抽到了<color=red>埃及</color>帝国卡。 不知为什么,她赌上了整个红魔馆押自己赢。
216 216 沉静而可怖的地灵殿主人抽到了<color=green>印度</color>帝国卡。 她只是来寻找妹妹和宠物,稀里糊涂加入了对局。
217 217 “投降吧,阁下毫无胜算。我只想带她们仨快点回去。”
218 218 可靠又专横的风雨之神抽到了<color=black>普鲁士</color>帝国卡。 她已经为这款游戏新成立了并购部和宣传部。
219 219 “我要这游戏的冠名权,把你们负责人叫来。”
220 220 守矢神社
221 221 普鲁士帝国
222 222 “投降吧,你没有胜算。我只想快点带家妹回去。”
223 223 帝王星收集 3 / 5 在游戏中召唤对应的伟人,点亮帝王星吧!
224 224 伟人图鉴
225 225 角色介绍
226 226 继承了<color=red>阿努比斯</color>意志的少女,原本是在红魔馆服侍蕾米莉亚·斯卡蕾特的女仆长,拥有操纵时间/停止时间程度的能力。
227 227 她是红魔馆中唯一的人类,冷静从容、头脑敏锐、优雅潇洒,偶尔也有些毒舌。对大小姐唯命是从,也正因此陪着任性的主人一同加入到了这款风靡幻想乡的游戏之中。
228 228 居然是……冥界守护神吗?不过大小姐那种程度,是不会死的吧。这样一来,我就变得多余了呢。
229 229 大小姐也来到冥界了吗?该说幸运还是不幸呢……反正不管在哪里,我都会侍奉好大小姐。
230 230 在意识到大小姐所扮演的<color=red>奥里西斯</color>亦有<color=red>冥王</color>的身份后,她似乎有些开心,这便是操纵命运的能力吧,她这么想。
231 231 冥界的守护神?说得倒轻松,我是不是该去向某位偷懒的死神讨教一下‘划水秘诀’了呢。
232 232 虽然招牌的道具变成了安卡和瓦斯权杖,但她仍在黑曜石神像的阴影之中擦亮了手中的银刃。一定要帮助大小姐赢下比赛,她已下决心。
233 233 获得<color=red>阿努比斯</color>扮演卡的人类少女。她本是在红魔馆服侍蕾米莉亚·斯卡蕾特的女仆长,陪着任性的大小姐一同加入游戏。
234 234 居然是……亡者引路人吗?不过大小姐是不会死的吧。我变得多余了呢。
235 235 角色特性
236 236 三星挑战
237 237 [又见面了,大小姐]
238 238 累计召唤10次
239 239 [完美潇洒的从者]
240 240 在一回合内连续闪现到4个不同的伟人身边
241 241 [于冥河守候]
242 242 闪现到蕾米莉亚身边后蕾米莉亚在该回合内死亡
243 243 在一回合内,连续闪现到4个不同的己方伟人身边
244 244 [为您指引归途]
245 245 闪现到蕾米莉亚身边后,蕾米莉亚在该回合内死亡
246 246 十六夜 夜
247 247
248 248
249 249 奇观介绍
250 250 古代世界最大、最著名的图书馆,建于托勒密王朝时期的埃及,旨在收藏天下所有知识。后因战火与政治动荡多次焚毁。 在游戏中,作为<color=red>知识类奇观</color>,解锁全部科后即可获得,提供3点城市经验。
251 251 众人评价
252 252 蕾米莉亚和帕秋莉正在讨论。
253 253 七十万卷!你可别让小恶魔累死哦。传出去坏了我红魔馆的名声。
254 254 小恶魔很结实,何况她是自愿的。倒是某只老鼠可能会累死吧。
255 255 听说进了亚历山大港的船只,必须把书留下来,就像打劫一样呢。
256 256 若真如此,我还真希望黑白老鼠多来几趟。
257 257 [雅典娜的居所]
258 258 累计建造10次
259 259 [船过港,书且留]
260 260 在<color=red>亚历山大港</color>建造该奇观,必须靠近<color=red>谷仓</color>、<color=red>港口</color>和<color=red>市中心</color>
261 261 [七十万卷遗梦]
262 262 伟人<color=red>帕秋莉·诺蕾姬</color>在该奇观上连续停留10回合
263 263 亚历山大图书馆
264 264 成就收集星({count}/100)
265 265 战斗成就
266 266 战斗成就(5/25)
267 267 [系统设置]
268 268 音乐音量
269 269 音效音量
270 270 显示提示
271 271 语言
272 272 简体中文
273 273 关闭
274 274 退出
275 275 关于我们
276 276 出品 蕾米莉亚指挥部
277 277 原作 上海爱丽丝幻乐团
278 278 本作品为 东方project 的二次同人创作
279 279 关注我们
280 280 @蕾米莉亚指挥部
281 281 官方网站
282 282 开发团队
283 283 版本信息
284 284 隐私政策
285 285 服务条款
286 286 少女加冕中...
287 287 卢克索神庙
288 288 孟菲斯老城
289 289 吉萨大金字塔
290 290 阿布辛贝大神庙
291 291 狮身人面像
292 292 奥里西斯神庙
293 293 枫丹白露宫
294 294 索邦大学
295 295 交易所广场
296 296 卢浮宫
297 297 凯旋门
298 298 巴黎圣母院
299 299 巴黎天文台
300 300 勃兰登堡门
301 301 海登堡大学
302 302 汉堡港口仓库城
303 303 新天鹅堡
304 304 柏林胜利纪念柱
305 305 拜罗伊特节日剧院
306 306 齐柏林飞艇基地
307 307 阿育王柱
308 308 那烂陀寺
309 309 亨比
310 310 泰姬陵
311 311 红堡
312 312 米纳克希神庙
313 313 简塔曼塔天文台

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 64c1bbe0986b866488c0ff7df56a175e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 79aa236e1c9c5fd4abc4d4c174fe54d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,89 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b40ff2b127284ad4b576403fbf9b0d95, type: 3}
m_Name: AIConfig
m_EditorClassIdentifier:
MoneyScore: 0.1
UnitScore: 1
CityScore: 5
CityDefendScore: 0.2
OneCanMoveGridMaxScore: 1
OneSightGridMaxScore: 1
UnitAttackScore: 1
UnitDefendScore: 1
UnitExploreScore: 5
UnitExploreCityCenterScore: 20
UnitExploreTreasureScore: 10
UnitExploreStarfishScore: 5
FutureScoreTransformValue: 0.5
MilitaryConstructionRatioValue: 0
TechInfoList:
- TechType: 1
Ratio: 1
- TechType: 2
Ratio: 1
- TechType: 3
Ratio: 1
- TechType: 4
Ratio: 1
- TechType: 5
Ratio: 1
- TechType: 6
Ratio: 1
- TechType: 7
Ratio: 1
- TechType: 8
Ratio: 1
- TechType: 9
Ratio: 1
- TechType: 10
Ratio: 1
- TechType: 11
Ratio: 1
- TechType: 12
Ratio: 1
- TechType: 13
Ratio: 1
- TechType: 14
Ratio: 1
- TechType: 15
Ratio: 1
- TechType: 16
Ratio: 1
- TechType: 17
Ratio: 1
- TechType: 18
Ratio: 1
- TechType: 19
Ratio: 1
- TechType: 20
Ratio: 1
- TechType: 21
Ratio: 1
- TechType: 22
Ratio: 1
- TechType: 23
Ratio: 1
- TechType: 24
Ratio: 1
- TechType: 25
Ratio: 1
- TechType: 26
Ratio: 1
- TechType: 27
Ratio: 1
- TechType: 28
Ratio: 1
- TechType: 29
Ratio: 1
- TechType: 30
Ratio: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8582602f11b29574bbc97685fd858ad0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b664cf36cbd74c59a853c45c232706b0, type: 3}
m_Name: Achievement
m_EditorClassIdentifier:
AchievementList: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 27f4bb438a10ceb4ab02dac1f478600c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 94ead1d9ef420884b8752757007e5f3d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 166f55de27df0d64e9e1565037a54aaa, type: 3}
m_Name: AnimDataAssets
m_EditorClassIdentifier:
AttackAnimTime: 0.15
AttackReturnAnimTime: 0.15
CounterAnimTime: 0.15
CounterReturnAnimTime: 0.15
BetweenAttackCounterAnimTime: 0.1
MoveAnimTime: 0.15

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6222b7477e5810544bbf3399b7c5a3bc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9630c76bba8a46c41ae17a5d8119d9a7, type: 3}
m_Name: CivDataAssets
m_EditorClassIdentifier:
CivDataList:
- CivId: 0
Civ: 0
CivName: "\u57C3\u53CA\u5E1D\u56FD"
CityList:
- CivId: 0
Civ: 1
CivName: "\u6CD5\u5170\u897F\u5E1D\u56FD"
CityList:
- CivId: 0
Civ: 2
CivName: "\u666E\u9C81\u58EB\u5E1D\u56FD"
CityList:
- CivId: 0
Civ: 3
CivName: "\u5370\u5EA6\u5E1D\u56FD"
CityList:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78fb95fe1cdf1d743a75761564e269a8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,516 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fc0ffc5c3a687734695e3393089231be, type: 3}
m_Name: GridAndResourceDataAssets
m_EditorClassIdentifier:
TerrainInfoList:
- TerrainType: 1
Sprite: {fileID: 0}
VarientSprite: 1
SpriteList:
- IgnoreCivId: 0
IgnoreForceId: 1
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 94d08b14820ccb24eb2b87e651486e99, type: 3}
SpriteGlow: {fileID: 0}
Name:
- TerrainType: 2
Sprite: {fileID: 21300000, guid: dc29ebac5875f2846b237edabd9eaeca, type: 3}
VarientSprite: 0
SpriteList: []
- TerrainType: 3
Sprite: {fileID: 21300000, guid: e82f9e6d364fb3944bb6b9b126425fe0, type: 3}
VarientSprite: 0
SpriteList: []
ResourceInfoList:
- Resource: 9
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 2
SpriteList: []
- Resource: 10
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 2
SpriteList: []
- Resource: 11
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 1
SpriteList: []
- Resource: 12
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 1
SpriteList: []
- Resource: 13
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 0
SpriteList: []
- Resource: 14
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 0
SpriteList: []
- Resource: 15
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 0
SpriteList: []
- Resource: 16
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 3
SpriteList: []
- Resource: 17
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 0
SpriteList: []
- Resource: 18
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 0
SpriteList: []
- Resource: 19
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 1
SpriteList: []
- Resource: 20
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 1
SpriteList: []
- Resource: 21
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 1
SpriteList: []
- Resource: 22
Sprite: {fileID: 0}
VarientSprite: 0
Exp: 1
SpriteList: []
WonderInfoList:
- Wonder: 0
WonderType: 1
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 9ae4068de3182e54c9c44e10b66089e6, type: 3}
Name: "\u5362\u514B\u7D22\u795E\u5E99"
Exp: 3
- Wonder: 1
WonderType: 2
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 5d2cbba21798bbf47af040f07f81ce58, type: 3}
Name: "\u4E9A\u5386\u5C71\u5927\u56FE\u4E66\u9986"
Exp: 3
- Wonder: 2
WonderType: 3
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 99f299139fee8074babe65db7c3ba2fc, type: 3}
Name: "\u5B5F\u83F2\u65AF\u8001\u57CE"
Exp: 3
- Wonder: 3
WonderType: 4
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 28481e4b4d1464f40b2463f41f7e0eb4, type: 3}
Name: "\u5409\u8428\u5927\u91D1\u5B57\u5854"
Exp: 3
- Wonder: 4
WonderType: 5
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 9654e91d69aca024c9a5f6e122007a1c, type: 3}
Name: "\u963F\u5E03\u8F9B\u8D1D\u5927\u795E\u5E99"
Exp: 3
- Wonder: 5
WonderType: 6
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: c9a566b58f2082b4a9848735e022f3e7, type: 3}
Name: "\u72EE\u8EAB\u4EBA\u9762\u50CF"
Exp: 3
- Wonder: 6
WonderType: 7
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: 6b82d407e72f5a04dad2051557c4a48c, type: 3}
Name: "\u5965\u91CC\u897F\u65AF\u795E\u5E99"
Exp: 3
- Wonder: 7
WonderType: 1
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: fd412cc9548c654409cc979745ed1d40, type: 3}
Name: "\u67AB\u4E39\u767D\u9732\u5BAB"
Exp: 3
- Wonder: 8
WonderType: 2
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: 25959da9c2209d2479802619fc828f5c, type: 3}
Name: "\u7D22\u90A6\u5927\u5B66"
Exp: 3
- Wonder: 9
WonderType: 3
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: 0f1fce644ced23c4e907dc62ff4f23be, type: 3}
Name: "\u4EA4\u6613\u6240\u5E7F\u573A"
Exp: 3
- Wonder: 10
WonderType: 4
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: 936535b388150f648a819b20d93498bb, type: 3}
Name: "\u5362\u6D6E\u5BAB"
Exp: 3
- Wonder: 11
WonderType: 5
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: e82a494ae6572eb4c8e993dbdf382f26, type: 3}
Name: "\u51EF\u65CB\u95E8"
Exp: 3
- Wonder: 12
WonderType: 6
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: 54ea1a42bea9909498e3e5b5aaadd3ff, type: 3}
Name: "\u5DF4\u9ECE\u5723\u6BCD\u9662"
Exp: 3
- Wonder: 13
WonderType: 7
CivId: 1
ForceId: 1
Sprite: {fileID: 21300000, guid: 803ed8a071ab0b0499b592b50c7f0f42, type: 3}
Name: "\u5DF4\u9ECE\u5929\u6587\u53F0"
Exp: 3
- Wonder: 14
WonderType: 1
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: 193db0ee37259d547aae9e6db2e9ff94, type: 3}
Name: "\u52C3\u5170\u767B\u5821\u95E8"
Exp: 3
- Wonder: 15
WonderType: 2
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: c32e08acd22a79443ba4de942202f32a, type: 3}
Name: "\u6D77\u767B\u5821\u5927\u5B66"
Exp: 3
- Wonder: 16
WonderType: 3
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: 3bbafdaa5d59eed4ba343507956871b8, type: 3}
Name: "\u6C49\u5821\u6E2F\u53E3\u4ED3\u5E93\u57CE"
Exp: 3
- Wonder: 10
WonderType: 4
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: ef75559cb243afb4eaaf79225304177c, type: 3}
Name: "\u65B0\u5929\u9E45\u5821"
Exp: 3
- Wonder: 11
WonderType: 5
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: 8c1cd235d851c2c40b3a229ce02781e5, type: 3}
Name: "\u67CF\u6797\u80DC\u5229\u7EAA\u5FF5\u67F1"
Exp: 3
- Wonder: 12
WonderType: 6
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: 989d2cba4eb64c04486da63a9842f061, type: 3}
Name: "\u62DC\u7F57\u4F0A\u7279\u8282\u65E5\u5267\u9662"
Exp: 3
- Wonder: 20
WonderType: 7
CivId: 2
ForceId: 2
Sprite: {fileID: 21300000, guid: f91a3b4a4a0057c4885eaaf387c1415d, type: 3}
Name: "\u9F50\u67CF\u6797\u98DE\u8247\u57FA\u5730"
Exp: 3
- Wonder: 21
WonderType: 1
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: 926d627f005830c45a4cd0a9340569a5, type: 3}
Name: "\u963F\u80B2\u738B\u67F1"
Exp: 3
- Wonder: 22
WonderType: 2
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: 638b23f0a528a6a4fa053b4c322a94ab, type: 3}
Name: "\u90A3\u70C2\u9640\u5BFA"
Exp: 3
- Wonder: 23
WonderType: 3
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: 888d8979643e94d4ea8df8d63c927f02, type: 3}
Name: "\u4EA8\u6BD4"
Exp: 3
- Wonder: 24
WonderType: 4
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: 74c37acd0d1b4fb4d8518a6d51c83258, type: 3}
Name: "\u6CF0\u59EC\u9675"
Exp: 3
- Wonder: 25
WonderType: 5
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: 4e0751845026b6346ba6859d3f42fa17, type: 3}
Name: "\u7EA2\u5821"
Exp: 3
- Wonder: 26
WonderType: 6
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: ffc907a38bd53504696e00ba1c3f464d, type: 3}
Name: "\u7C73\u7EB3\u514B\u5E0C\u795E\u5E99"
Exp: 3
- Wonder: 27
WonderType: 7
CivId: 3
ForceId: 3
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 28
WonderType: 1
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 29
WonderType: 2
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 30
WonderType: 3
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 31
WonderType: 4
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 32
WonderType: 5
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 33
WonderType: 6
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 34
WonderType: 7
CivId: 4
ForceId: 4
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 35
WonderType: 1
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 36
WonderType: 2
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 37
WonderType: 3
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 38
WonderType: 4
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 39
WonderType: 5
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 40
WonderType: 6
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 41
WonderType: 7
CivId: 5
ForceId: 5
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 42
WonderType: 1
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 43
WonderType: 2
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 44
WonderType: 3
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 45
WonderType: 4
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 46
WonderType: 5
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 47
WonderType: 6
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 48
WonderType: 7
CivId: 6
ForceId: 6
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 49
WonderType: 1
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 50
WonderType: 2
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 51
WonderType: 3
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 52
WonderType: 4
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 53
WonderType: 5
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 54
WonderType: 6
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
- Wonder: 55
WonderType: 7
CivId: 7
ForceId: 7
Sprite: {fileID: 21300000, guid: b85e184e11cedba42b422bf7fb971ec6, type: 3}
Name: "\u7B80\u5854\u66FC\u5854\u5929\u6587\u53F0"
Exp: 3
MountainInfo:
SpriteList:
- IgnoreCivId: 0
IgnoreForceId: 1
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: b68c20c19ee51ac418164b94e7019787, type: 3}
SpriteGlow: {fileID: 0}
Name:
VegetationInfo:
SpriteList:
- IgnoreCivId: 0
IgnoreForceId: 1
CivId: 0
ForceId: 0
Sprite: {fileID: 21300000, guid: cb0267035ec3ed44d8c74b79c550f5ec, type: 3}
SpriteGlow: {fileID: 0}
Name:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5c11ac7aa51414a428e81362c470f4d2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6e289c7fba3b438986c71305e15708a1, type: 3}
m_Name: Multilingual
m_EditorClassIdentifier:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8bd9188ad5a97c24ba7301b4e9d07658
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,79 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 17f0807fe6351374dbcf9d6e3309d3cb, type: 3}
m_Name: PlayerDataAssets
m_EditorClassIdentifier:
PlayerDataList:
- ForceId: 0
CivId: 0
CivName: "\u57C3\u53CA\u5E1D\u56FD"
ForceName: "\u857E\u7C73\u8389\u4E9A"
LeaderName: "\u857E\u7C73\u8389\u4E9A"
LeaderIllustration: {fileID: 21300000, guid: d4661e5af1f33b94ea56ac7d7b30b512, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f000000100000001100000012000000130000001400000015000000160000001700000018000000190000001a0000001b0000001c0000001d0000001e000000
TechStart: 0000000008000000
- ForceId: 1
CivId: 1
CivName: "\u6CD5\u5170\u897F\u5E1D\u56FD"
ForceName: "\u84EC\u83B1\u5C71\u8F89\u591C"
LeaderName: "\u84EC\u83B1\u5C71\u8F89\u591C"
LeaderIllustration: {fileID: 21300000, guid: e1ef5c5c40488ae40bbd2ed4cf35b89e, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 0000000006000000
- ForceId: 2
CivId: 2
CivName: "\u666E\u9C81\u58EB\u5E1D\u56FD"
ForceName: "\u516B\u5742\u795E\u5948\u5B50"
LeaderName: "\u516B\u5742\u795E\u5948\u5B50"
LeaderIllustration: {fileID: 21300000, guid: 3756265d254e8e542b0c198d11bf75d4, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 0000000010000000
- ForceId: 3
CivId: 3
CivName: "\u5370\u5EA6\u5E1D\u56FD"
ForceName: "\u53E4\u660E\u5730\u89C9"
LeaderName: "\u53E4\u660E\u5730\u89C9"
LeaderIllustration: {fileID: 21300000, guid: c31b7225b784dca488b6376ef5fe77d5, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 0000000014000000
- ForceId: 4
CivId: 4
CivName: "\u5317\u6D77\u5E1D\u56FD"
ForceName: "\u535A\u4E3D\u7075\u68A6"
LeaderName: "\u535A\u4E3D\u7075\u68A6"
LeaderIllustration: {fileID: 21300000, guid: 7827e23a317aaac4c8d5131a85e63094, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 00000000
- ForceId: 5
CivId: 5
CivName: "\u4E0D\u5217\u98A0\u5E1D\u56FD"
ForceName: "\u5723\u767D\u83B2"
LeaderName: "\u5723\u767D\u83B2"
LeaderIllustration: {fileID: 21300000, guid: 41bf66abdaa83a74e9a9b6cff7cda10f, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 00000000
- ForceId: 6
CivId: 6
CivName: "\u8428\u73CA\u5E1D\u56FD"
ForceName: "\u4E30\u806A\u8033\u795E\u5B50"
LeaderName: "\u4E30\u806A\u8033\u795E\u5B50"
LeaderIllustration: {fileID: 21300000, guid: 031b6571f7cb19549a2f0f97b386481f, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 00000000
- ForceId: 7
CivId: 7
CivName: "\u62DC\u5360\u5EAD\u5E1D\u56FD"
ForceName: "\u65E5\u767D\u6B8B\u65E0"
LeaderName: "\u65E5\u767D\u6B8B\u65E0"
LeaderIllustration: {fileID: 21300000, guid: c5feb7e3a8bc4384e955e9fa2218fc25, type: 3}
TechPool: 000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000010000000110000001200000013000000140000001500000016000000170000001800000019000000
TechStart: 00000000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 31f15e99e6e4e0d41982384fff6b674d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b81b94a68d068c49a4d0f3e3f259784
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,100 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d63a7493de6142c48a7d620ce81ddfc5, type: 3}
m_Name: UICenterMessageDataAssets
m_EditorClassIdentifier:
UICenterMessageInfoList:
- Id: 1
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u5F00\u542F\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u4FDD\u63015\u56DE\u5408\u4E0D\u4E3B\u52A8\u653B\u51FB\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 1
- Id: 2
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u7814\u53D1\u6240\u6709\u57FA\u7840\u79D1\u6280(\u4E0D\u5305\u62EC\u4F1F\u4EBA\u804C\u9636\u79D1\u6280)\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 2
- Id: 3
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u62E5\u67095\u5EA7\u4E0E\u9996\u90FD\u8054\u901A\u7684\u57CE\u5E02\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 3
- Id: 4
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u5728\u56DE\u5408\u7ED3\u675F\u65F6\u62E5\u6709\u8D85\u8FC7100\u679A\u91D1\u5E01\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 4
- Id: 5
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u51FB\u674010\u540D\u654C\u4EBA\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 5
- Id: 6
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u62E5\u6709\u4E00\u5EA76\u7EA7\u53CA\u4EE5\u4E0A\u7684\u57CE\u5E02\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 6
- Id: 7
Type: 1
Title: "\u5F00\u542F\u5947\u89C2\u84DD\u56FE!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}\u7684\u84DD\u56FE\u3002\u62E5\u6709\u5730\u56FE\u5168\u90E8\u56DB\u4E2A\u89D2\u843D\u7684\u89C6\u91CE\uFF0C\u4ECE\u800C\u83B7\u5F97\u8BE5\u5947\u89C2!"
WonderType: 7
- Id: 8
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 1
- Id: 9
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 2
- Id: 10
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 3
- Id: 11
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 4
- Id: 12
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 5
- Id: 13
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 6
- Id: 14
Type: 2
Title: "\u83B7\u5F97\u5947\u89C2!"
Message: "\u60A8\u5DF2\u83B7\u5F97\u4E86\u5947\u89C2:{name}!\u5728\u5E73\u539F\u6216\u8005\u6D45\u6D77\u5730\u533A\u5EFA\u9020\u60A8\u7684\u5947\u89C2\u5427!"
WonderType: 7
- Id: 15
Type: 3
Title: "\u9047\u5230\u65B0\u7684\u6587\u660E!"
Message: "{civName}-{forceName}\u7684\u9886\u8896{leaderName}\u5411\u60A8\u548C\u60A8\u7684\u4F1F\u5927\u6587\u660E\u81F4\u4EE5\u8BDA\u631A\u7684\u95EE\u5019\u3002\u60A8\u83B7\u5F97\u4E86{money}\u91D1\u5E01\u7684\u4E00\u6B21\u6027\u8D38\u6613\u5956\u52B1\u3002"
WonderType: 0
- Id: 16
Type: 4
Title: "\u80A9\u8D1F\u91CD\u4EFB!"
Message: "\u60A8\u5DF2\u88AB\u59D4\u4EFB\u7BA1\u7406\u57C3\u53CA\u5E1D\u56FD\u65AF\u5361\u96F7\u7279\u738B\u671D\u3002\u8FD0\u7528\u60A8\u7684\u667A\u6167\u3001\u52C7\u6C14\u548C\u8FD0\u6C14\uFF0C\u5E26\u9886\u56FD\u5BB6\u8D70\u5411\u7E41\u8363\uFF01"
WonderType: 0
- Id: 17
Type: 5
Title: "\u5E1D\u56FD\u9668\u843D!"
Message: "\u6614\u65E5\u8F89\u714C\u5982\u671D\u9633\u521D\u5347\uFF0C\u4ECA\u671D\u5374\u968F\u98CE\u5C18\u6E6E\u6CA1\u3002{name}\u672A\u80FD\u7ECF\u53D7\u65F6\u5149\u7684\u8003\u9A8C\uFF0C\u7EC8\u7A76\u6E6E\u6CA1\u4E8E\u5386\u53F2\u957F\u6CB3\u7684\u6D9B\u58F0\u4E4B\u4E2D\u3002"
WonderType: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2946577c0524a2f4690e88c277934394
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8266b710a198c864bb1b14405df1834d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Logic.Multilingual;
using UnityEngine;
using RuntimeData;
@ -192,6 +193,7 @@ public class WonderInfo
public uint CivId;
public uint ForceId;
public Sprite Sprite;
[MultilingualField]
public string Name;
public int Exp;

View File

@ -7,10 +7,7 @@
using System.Collections.Generic;
using System.Linq;
using Logic.Achievement;
using Logic.AI;
using RuntimeData;
using UnityEditor;
using UnityEngine;

View File

@ -96,19 +96,19 @@ namespace Logic.Editor
{
var recordColor = GUI.contentColor;
GUI.contentColor = color;
var textWidth = GUI.skin.toggle.CalcSize(new GUIContent(text)).x;
EditorGUILayout.LabelField(text, GUILayout.Width(textWidth));
var size = GUI.skin.toggle.CalcSize(new GUIContent(text));
EditorGUILayout.LabelField(text, GUILayout.Width(size.x), GUILayout.Height(size.y));
GUI.contentColor = recordColor;
}
// 固化 Text 宽度并支持 rich text
public static void InspectorTextWidthRich(string text)
{
var textWidth = GUI.skin.toggle.CalcSize(new GUIContent(text)).x;
var size = GUI.skin.toggle.CalcSize(new GUIContent(text));
GUIStyle richTextStyle = new GUIStyle(GUI.skin.label);
richTextStyle.richText = true;
EditorGUILayout.LabelField(text, richTextStyle, GUILayout.Width(textWidth));
EditorGUILayout.LabelField(text, richTextStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
}
// 固化 Text 宽度并支持 rich text

View File

@ -0,0 +1,281 @@
/*
* @Author:
* @Description:
* @Date: 20250526 17:05:14
* @Modify:
*/
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using Logic.Multilingual;
using TMPro;
using UnityEditor;
using UnityEngine;
namespace Logic.Editor
{
public class MultilingualEditorWindow : EditorWindow
{
// 滑条
private Vector2 _barPosition;
// 背景
private GUIStyle _redBoxStyle;
private GUIStyle _whiteBoxStyle;
private MultilingualData _asset;
private Dictionary<string, uint> _zhStrDict = new Dictionary<string, uint>();
private uint _idIndex;
[MenuItem("Tools/多语言编辑器")]
private static void ShowWindow()
{
var window = CreateWindow<MultilingualEditorWindow>();
window.titleContent = new GUIContent("多语言编辑器");
window.Show();
window.minSize = new Vector2(500, 600);
}
protected virtual void OnEnable()
{
}
private void OnDisable()
{
}
private void OnGUI()
{
if (!_asset)
{
var path = $"Assets/Resources/Export/Multilingual.asset";
_asset = AssetDatabase.LoadAssetAtPath<MultilingualData>(path);
if (!_asset)
{
_asset = CreateInstance<MultilingualData>();
AssetDatabase.CreateAsset(_asset, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
}
if (_redBoxStyle == null)
{
_redBoxStyle = InspectorUtils.GetHelpBoxStyle();
InspectorUtils.AddBorder(_redBoxStyle, new Color(0.5f, 0.4f, 0.4f, 0.6f));
}
if (_whiteBoxStyle == null)
{
_whiteBoxStyle = InspectorUtils.GetHelpBoxStyle();
InspectorUtils.AddBorder(_whiteBoxStyle, new Color(1f, 1f, 1f, 0.2f));
}
GUI.skin.button.wordWrap = true;
_barPosition = EditorGUILayout.BeginScrollView(_barPosition);
EditorGUILayout.BeginHorizontal();
if (InspectorUtils.InspectorButtonWithTextWidth("保存"))
{
EditorUtility.SetDirty(_asset);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
if (InspectorUtils.InspectorButtonWithTextWidth("导出 Excel"))
{
AssetExportToExcel();
}
if (InspectorUtils.InspectorButtonWithTextWidth("Excel 导回"))
{
ExcelExportToAsset();
}
EditorGUILayout.EndHorizontal();
foreach (var item in _asset.Items) ShowMultilingualItem(item);
EditorGUILayout.EndScrollView();
}
private void ShowMultilingualItem(MultilingualItem item)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
InspectorUtils.InspectorTextWidthRich($"<b>{item.ID} : </b>");
InspectorUtils.InspectorTextWidthRich($" <b>中文:{item.ZH} </b>");
if (!string.IsNullOrEmpty(item.EN))
InspectorUtils.InspectorTextWidthRich($" <b>英语:{item.EN} </b>");
if (!string.IsNullOrEmpty(item.JP))
InspectorUtils.InspectorTextWidthRich($" <b>日语:{item.JP} </b>");
if (!string.IsNullOrEmpty(item.KR))
InspectorUtils.InspectorTextWidthRich($" <b>韩语:{item.KR} </b>");
EditorGUILayout.EndVertical();
EditorGUILayout.Space();
}
private void ExcelExportToAsset()
{
_asset.Items.Clear();
// 读取整个文件(而不是按行)
string csvContent = File.ReadAllText("Assets/CSV/Multilingual.csv");
List<string> lines = new List<string>();
StringBuilder currentLine = new StringBuilder();
bool inQuotes = false;
foreach (char c in csvContent)
{
if (c == '"') inQuotes = !inQuotes; // 进入/退出引号模式
if (c == '\n' && !inQuotes) // 换行符且不在引号内
{
lines.Add(currentLine.ToString());
currentLine.Clear();
}
else currentLine.Append(c);
}
if (currentLine.Length > 0) lines.Add(currentLine.ToString());
foreach (string line in lines)
{
if (string.IsNullOrWhiteSpace(line)) continue; // 跳过空行
string[] cells = line.Split(','); // 按逗号分割
if (cells.Length == 0) continue;
var item = new MultilingualItem();
item.ID = uint.Parse(cells[0]);
if (cells.Length >= 2) item.ZH = cells[1];
if (cells.Length >= 3) item.EN = cells[2];
if (cells.Length >= 4) item.JP = cells[3];
if (cells.Length >= 5) item.KR = cells[4];
_asset.Items.Add(item);
}
}
private void AssetExportToExcel()
{
_zhStrDict.Clear();
_idIndex = 1;
var uiObj = GameObject.Find("UICanvas");
if (!uiObj)
{
Debug.LogError($"找不到UI根节点");
return;
}
var coms = uiObj.GetComponentsInChildren<TextMeshProUGUI>(true).ToList();
foreach (var com in coms)
{
if (!Regex.IsMatch(com.text, @"[\u4E00-\u9FFF\u3400-\u4DBF]")) continue;
var textCom = com.gameObject.GetComponent<MultilingualTextMono>();
if (!textCom) textCom = com.gameObject.AddComponent<MultilingualTextMono>();
if (_zhStrDict.ContainsKey(com.text))
{
textCom.ID = _zhStrDict[com.text];
}
else
{
textCom.ID = _idIndex;
_zhStrDict[com.text] = _idIndex;
_idIndex++;
}
}
var path = $"Assets/Resources/DataAssets/";
string[] assetPaths = Directory.GetFiles(path, "*.asset", SearchOption.AllDirectories);
foreach (var assetPath in assetPaths)
{
var asset = AssetDatabase.LoadAssetAtPath<ScriptableObject>(assetPath);
if (!asset) continue;
var targetAsset = GetExportAsset(asset);
TraverseObject(targetAsset);
}
string dirPath = Path.Combine(Application.dataPath, "CSV");
string filePath = Path.Combine(dirPath, "Multilingual.csv");
if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
if (!File.Exists(filePath))
{
using (File.Create(filePath)) { } // 立即释放句柄
}
using (StreamWriter sw = new StreamWriter(filePath, false, Encoding.UTF8))
{
foreach (var kv in _zhStrDict)
{
var text = $"\"{kv.Key.Replace("\"", "\"\"")}\"";
sw.WriteLine($"{kv.Value.ToString()},{text}");
}
}
}
private ScriptableObject GetExportAsset(ScriptableObject origin)
{
var target = $"Assets/Resources/Export/{origin.name}.asset";
if (File.Exists(target)) AssetDatabase.DeleteAsset(target);
bool success = AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(origin), target);
if (!success)
{
Debug.LogError($"拷贝失败!!!");
return null;
}
return AssetDatabase.LoadAssetAtPath<ScriptableObject>(target);
}
private void TraverseObject(object asset)
{
if (asset == null) return;
var fields = asset.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach (var field in fields)
{
var attr = field.GetCustomAttribute<MultilingualFieldAttribute>();
if (attr != null)
{
var str = (string)field.GetValue(asset);
if (str != null)
{
if (_zhStrDict.ContainsKey(str))
{
field.SetValue(asset, _zhStrDict[str].ToString());
}
else
{
_zhStrDict[str] = _idIndex;
field.SetValue(asset, _zhStrDict[str].ToString());
_idIndex++;
}
}
}
var son = field.GetValue(asset);
if (son == null) continue;
// 如果是集合(如 List<T>),遍历元素
if (son is IEnumerable enumerable && !(son is string))
{
foreach (object item in enumerable)
{
TraverseObject(item); // 递归处理集合项
}
}
// 如果是自定义对象(非基础类型),递归处理
else if (!son.GetType().IsPrimitive && son.GetType() != typeof(string))
{
TraverseObject(son);
}
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a56ccdc761c744868140905781ad040f
timeCreated: 1748250370

View File

@ -9,6 +9,7 @@
using System;
using Logic.AI;
using Logic.Audio;
using Logic.Multilingual;
using UnityEngine;
using RuntimeData;
using Unity.VisualScripting;
@ -91,6 +92,7 @@ namespace Logic
UIManager.Init();
AchievementDataManager.Instance.Init();
AudioManager.Instance.Init();
MultilingualManager.Instance.Init();
//StartGame(height,width,0,0);
// ContinueGame();
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 907a3279633d429782dc50bb682d2891
timeCreated: 1748228910

View File

@ -0,0 +1,64 @@
/*
* @Author:
* @Description:
* @Date: 20250526 11:05:13
* @Modify:
*/
using System.Collections.Generic;
using UnityEngine;
namespace Logic.Multilingual
{
public enum MultilingualType
{
ZH,
EN,
JP,
KR,
}
public class MultilingualData : ScriptableObject
{
public List<MultilingualItem> Items = new List<MultilingualItem>();
private Dictionary<uint, MultilingualItem> _itemDict;
public string GetMultilingualStr(uint id, MultilingualType type)
{
if (_itemDict == null) RefreshDict();
if (_itemDict == null) return string.Empty;
if (!_itemDict.TryGetValue(id, out var item)) return string.Empty;
return type switch
{
MultilingualType.ZH => item.ZH,
MultilingualType.EN => item.EN,
MultilingualType.JP => item.JP,
MultilingualType.KR => item.KR,
_ => string.Empty,
};
}
public void RefreshDict()
{
if (_itemDict == null) _itemDict = new Dictionary<uint, MultilingualItem>();
if (_itemDict.Count == Items.Count) return;
_itemDict.Clear();
foreach (var item in Items) _itemDict[item.ID] = item;
}
}
public class MultilingualItem
{
public uint ID;
public string ZH;
public string EN;
public string JP;
public string KR;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6e289c7fba3b438986c71305e15708a1
timeCreated: 1748228934

View File

@ -0,0 +1,19 @@
/*
* @Author:
* @Description:
* @Date: 20250526 16:05:17
* @Modify:
*/
using UnityEngine;
namespace Logic.Multilingual
{
[System.AttributeUsage(System.AttributeTargets.Field)]
public class MultilingualFieldAttribute : PropertyAttribute
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 10df0406f1b14e8cb5bda01644cc2b6b
timeCreated: 1748249593

View File

@ -0,0 +1,65 @@
/*
* @Author:
* @Description:
* @Date: 20250526 14:05:31
* @Modify:
*/
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
namespace Logic.Multilingual
{
public class MultilingualManager
{
public static MultilingualManager Instance = new MultilingualManager();
private MultilingualData _multilingualData;
private MultilingualType _currentType;
private List<MultilingualTextMono> _textComs;
public void Init()
{
_currentType = (MultilingualType)PlayerPrefs.GetInt("Multilingual", 0);
ChangedMultilingual(_currentType);
}
public string GetMultilingualText(uint id)
{
return _multilingualData.GetMultilingualStr(id, _currentType);
}
public void ChangedMultilingual(MultilingualType type)
{
RefreshTextComs();
_currentType = type;
foreach (var textCom in _textComs) textCom.OnMultilingualChanged();
}
public void SetUIText(TextMeshPro textCom, string id)
{
if (!textCom) return;
var multilingual = textCom.gameObject.GetComponent<MultilingualTextMono>();
if (!multilingual) multilingual = textCom.gameObject.AddComponent<MultilingualTextMono>();
multilingual.ID = uint.Parse(id);
multilingual.OnMultilingualChanged();
}
private void RefreshTextComs()
{
var uiObj = GameObject.Find("UICanvas");
if (!uiObj)
{
Debug.LogError($"找不到UI根节点");
return;
}
_textComs = uiObj.GetComponentsInChildren<MultilingualTextMono>(true).ToList();
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f989a0e085d3414da2d3073fc51a1f03
timeCreated: 1748241627

View File

@ -0,0 +1,34 @@
/*
* @Author:
* @Description:
* @Date: 20250526 14:05:50
* @Modify:
*/
using TMPro;
using UnityEngine;
namespace Logic.Multilingual
{
public class MultilingualTextMono : MonoBehaviour
{
public uint ID = 0;
private void OnEnable()
{
if (ID == 0) return;
OnMultilingualChanged();
}
public void OnMultilingualChanged()
{
if (ID == 0) return;
var text = GetComponent<TextMeshProUGUI>();
if (!text) return;
text.text = MultilingualManager.Instance.GetMultilingualText(ID);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6b27f832d22e4a8d916272b644937774
timeCreated: 1748241401

1303
My project/sdk/Readme.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,367 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmbuffer.cpp
//
//===============================================================================
#include "glmgr.h"
#include "glmdisplay.h"
#include "cglmbuffer.h"
#ifdef OSX
// Debugger - 10.8
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
// void BindBufferARB(enum target, uint buffer);
// void DeleteBuffersARB(sizei n, const uint *buffers);
// void GenBuffersARB(sizei n, uint *buffers);
// boolean IsBufferARB(uint buffer);
//
// void BufferDataARB(enum target, sizeiptrARB size, const void *data,
// enum usage);
// void BufferSubDataARB(enum target, intptrARB offset, sizeiptrARB size,
// const void *data);
// void GetBufferSubDataARB(enum target, intptrARB offset,
// sizeiptrARB size, void *data);
//
// void *MapBufferARB(enum target, enum access);
// boolean UnmapBufferARB(enum target);
//
// void GetBufferParameterivARB(enum target, enum pname, int *params);
// void GetBufferPointervARB(enum target, enum pname, void **params);
//
//New Tokens
//
// Accepted by the <target> parameters of BindBufferARB, BufferDataARB,
// BufferSubDataARB, MapBufferARB, UnmapBufferARB,
// GetBufferSubDataARB, GetBufferParameterivARB, and
// GetBufferPointervARB:
//
// ARRAY_BUFFER_ARB 0x8892
// ELEMENT_ARRAY_BUFFER_ARB 0x8893
//
// Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
// GetFloatv, and GetDoublev:
//
// ARRAY_BUFFER_BINDING_ARB 0x8894
// ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
// VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
// NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
// COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
// INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
// TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
// EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
// SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
// FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
// WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
//
// Accepted by the <pname> parameter of GetVertexAttribivARB:
//
// VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
//
// Accepted by the <usage> parameter of BufferDataARB:
//
// STREAM_DRAW_ARB 0x88E0
// STREAM_READ_ARB 0x88E1
// STREAM_COPY_ARB 0x88E2
// STATIC_DRAW_ARB 0x88E4
// STATIC_READ_ARB 0x88E5
// STATIC_COPY_ARB 0x88E6
// DYNAMIC_DRAW_ARB 0x88E8
// DYNAMIC_READ_ARB 0x88E9
// DYNAMIC_COPY_ARB 0x88EA
//
// Accepted by the <access> parameter of MapBufferARB:
//
// READ_ONLY_ARB 0x88B8
// WRITE_ONLY_ARB 0x88B9
// READ_WRITE_ARB 0x88BA
//
// Accepted by the <pname> parameter of GetBufferParameterivARB:
//
// BUFFER_SIZE_ARB 0x8764
// BUFFER_USAGE_ARB 0x8765
// BUFFER_ACCESS_ARB 0x88BB
// BUFFER_MAPPED_ARB 0x88BC
//
// Accepted by the <pname> parameter of GetBufferPointervARB:
//
// BUFFER_MAP_POINTER_ARB 0x88BD
// http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt
// Accepted by the <target> parameters of BindBuffer, BufferData,
// BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData,
// GetBufferParameteriv, and GetBufferPointerv:
// PIXEL_PACK_BUFFER_ARB 0x88EB
// PIXEL_UNPACK_BUFFER_ARB 0x88EC
// gl_bufmode: zero means we mark all vertex/index buffers static
// non zero means buffers are initially marked static..
// ->but can shift to dynamic upon first 'discard' (orphaning)
//ConVar gl_bufmode( "gl_bufmode", "1" );
int gl_bufmode = 1;
CGLMBuffer::CGLMBuffer( GLMContext *ctx, EGLMBufferType type, uint size, uint options )
{
m_ctx = ctx;
m_type = type;
switch(m_type)
{
case kGLMVertexBuffer: m_buffGLTarget = GL_ARRAY_BUFFER_ARB; break;
case kGLMIndexBuffer: m_buffGLTarget = GL_ELEMENT_ARRAY_BUFFER_ARB; break;
case kGLMUniformBuffer: m_buffGLTarget = GL_UNIFORM_BUFFER_EXT; break;
case kGLMPixelBuffer: m_buffGLTarget = GL_PIXEL_UNPACK_BUFFER_ARB; break;
default: //Assert(!"Unknown buffer type" );
break;
}
m_size = size;
m_bound = false;
m_mapped = false;
m_lastMappedAddress = NULL;
m_enableAsyncMap = false;
m_enableExplicitFlush = false;
m_dirtyMinOffset = m_dirtyMaxOffset = 0; // adjust/grow on lock, clear on unlock
m_ctx->CheckCurrent();
m_revision = rand();
// make a decision about pseudo mode
// this looked like it didn't help much or was actually slower, so leave it available but only as opt-in.
// a more clever implementation would be able to select pseudo buf storage for small batches only..
m_pseudo = false; // (m_type==kGLMIndexBuffer) && (CommandLine()->FindParm("-gl_enable_pseudobufs"));
if (m_pseudo)
{
m_name = 0;
m_pseudoBuf = (char*)malloc( size );
m_ctx->BindBufferToCtx( m_type, NULL ); // exit with no buffer bound
}
else
{
glGenBuffersARB( 1, &m_name );
GLMCheckError();
m_ctx->BindBufferToCtx( m_type, this ); // causes glBindBufferARB
// buffers start out static, but if they get orphaned and gl_bufmode is non zero,
// then they will get flipped to dynamic.
GLenum hint = GL_STATIC_DRAW_ARB;
switch(m_type)
{
case kGLMVertexBuffer: hint = (options & GLMBufferOptionDynamic) ? GL_DYNAMIC_DRAW_ARB : GL_STATIC_DRAW_ARB; break;
case kGLMIndexBuffer: hint = (options & GLMBufferOptionDynamic) ? GL_DYNAMIC_DRAW_ARB : GL_STATIC_DRAW_ARB; break;
case kGLMUniformBuffer: hint = GL_DYNAMIC_DRAW_ARB; break; // "fwiw" - shrug
case kGLMPixelBuffer: hint = (options & GLMBufferOptionDynamic) ? GL_DYNAMIC_DRAW_ARB : GL_STATIC_DRAW_ARB; break;
default: //Assert(!"Unknown buffer type" );
break;
}
glBufferDataARB( m_buffGLTarget, m_size, NULL, hint ); // may ultimately need more hints to set the usage correctly (esp for streaming)
this->SetModes( false, true, true );
m_ctx->BindBufferToCtx( m_type, NULL ); // unbind me
}
}
CGLMBuffer::~CGLMBuffer( )
{
m_ctx->CheckCurrent();
if (m_pseudo)
{
free (m_pseudoBuf);
m_pseudoBuf = NULL;
}
else
{
glDeleteBuffersARB( 1, &m_name );
GLMCheckError();
}
m_ctx = NULL;
m_name = 0;
m_bound = 0;
m_lastMappedAddress = NULL;
}
void CGLMBuffer::SetModes ( bool asyncMap, bool explicitFlush, bool force )
{
// assumes buffer is bound. called by constructor and by Lock.
if (m_pseudo)
{
// ignore it...
}
else
{
if (force || (m_enableAsyncMap != asyncMap) )
{
// note the sense of the parameter, it's TRUE if you *want* serialization, so for async you turn it to false.
glBufferParameteriAPPLE( this->m_buffGLTarget, GL_BUFFER_SERIALIZED_MODIFY_APPLE, asyncMap==false );
m_enableAsyncMap = asyncMap;
}
if (force || (m_enableExplicitFlush != explicitFlush) )
{
// note the sense of the parameter, it's TRUE if you *want* auto-flush-on-unmap, so for explicit-flush, you turn it to false.
glBufferParameteriAPPLE( this->m_buffGLTarget, GL_BUFFER_FLUSHING_UNMAP_APPLE, explicitFlush==false );
m_enableExplicitFlush = explicitFlush;
}
}
}
void CGLMBuffer::FlushRange ( uint offset, uint size )
{
if (m_pseudo)
{
// nothing to do
}
else
{
// assumes buffer is bound.
glFlushMappedBufferRangeAPPLE(this->m_buffGLTarget, (GLintptr)offset, (GLsizeiptr)size);
}
}
//ConVar gl_buffer_alignment_quantum ( "gl_buffer_alignment_quantum", "32" ); // the alignment we use pre-SLGU
//ConVar gl_buffer_alignment_quantum_slgu( "gl_buffer_alignment_quantum_slgu", "2" ); // alignment used post-SLGU
int gl_buffer_alignment_quantum = 32;
int gl_buffer_alignment_quantum_slgu = 2;
void CGLMBuffer::Lock( GLMBuffLockParams *params, char **addressOut )
{
char *resultPtr = NULL;
//Assert( !m_mapped);
m_ctx->CheckCurrent();
GLMCheckError();
if (params->m_offset >= m_size)
Debugger();
if (params->m_offset + params->m_size > m_size)
Debugger();
// bind (yes, even for pseudo - this binds name 0)
m_ctx->BindBufferToCtx( this->m_type, this );
if (m_pseudo)
{
// discard is a no-op
// async map modes are a no-op
// latch last mapped address (silly..)
m_lastMappedAddress = (float*)m_pseudoBuf;
// calc lock address
resultPtr = m_pseudoBuf + params->m_offset;
// dirty range is a no-op
}
else
{
// perform discard if requested
if (params->m_discard)
{
// observe gl_bufmode on any orphan event.
// if orphaned and bufmode is nonzero, flip it to dynamic.
GLenum hint = gl_bufmode /*.GetInt()*/ ? GL_DYNAMIC_DRAW_ARB : GL_STATIC_DRAW_ARB;
glBufferDataARB( m_buffGLTarget, m_size, NULL, hint );
m_lastMappedAddress = NULL;
m_revision++; // revision grows on orphan event
}
// adjust async map option appropriately, leave explicit flush unchanged
this->SetModes( params->m_nonblocking, m_enableExplicitFlush );
// map
char *mapPtr = (char*)glMapBufferARB( this->m_buffGLTarget, GL_READ_WRITE_ARB );
if (!mapPtr)
{
Debugger();
}
if (m_lastMappedAddress)
{
// just check if it moved
//Assert (m_lastMappedAddress == (float*)mapPtr);
}
m_lastMappedAddress = (float*)mapPtr;
// calculate offset location
resultPtr = mapPtr + params->m_offset;
// adjust dirty range
if (m_dirtyMinOffset != m_dirtyMaxOffset)
{
// grow range
m_dirtyMinOffset = std::min( m_dirtyMinOffset, params->m_offset );
m_dirtyMaxOffset = std::min( m_dirtyMaxOffset, params->m_offset+params->m_size );
}
else
{
// set range
m_dirtyMinOffset = params->m_offset;
m_dirtyMaxOffset = params->m_offset+params->m_size;
}
// pad and clamp dirty range to choice of boundary
uint quantum = (m_ctx->Caps().m_hasPerfPackage1) ? gl_buffer_alignment_quantum_slgu /*.GetInt()*/ : gl_buffer_alignment_quantum /*.GetInt()*/ ;
uint quantum_mask = quantum - 1;
m_dirtyMinOffset = m_dirtyMinOffset & (~quantum_mask);
m_dirtyMaxOffset = (m_dirtyMaxOffset + quantum_mask) & (~quantum_mask);
m_dirtyMaxOffset = std::min( m_dirtyMaxOffset, m_size );
}
m_mapped = true;
*addressOut = resultPtr;
}
void CGLMBuffer::Unlock( void )
{
m_ctx->CheckCurrent();
//Assert (m_mapped);
if (m_pseudo)
{
// nothing to do actually
}
else
{
m_ctx->BindBufferToCtx( this->m_type, this );
// time to do explicit flush
if (m_enableExplicitFlush)
{
this->FlushRange( m_dirtyMinOffset, m_dirtyMaxOffset - m_dirtyMinOffset );
}
// clear dirty range no matter what
m_dirtyMinOffset = m_dirtyMaxOffset = 0; // adjust/grow on lock, clear on unlock
glUnmapBuffer( this->m_buffGLTarget );
}
m_mapped = false;
}

View File

@ -0,0 +1,91 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmprogram.h
// GLMgr buffers (index / vertex)
// ... maybe add PBO later as well
//===============================================================================
#ifndef CGLMBUFFER_H
#define CGLMBUFFER_H
#pragma once
// ext links
// http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt
//===============================================================================
// forward declarations
class GLMContext;
enum EGLMBufferType
{
kGLMVertexBuffer,
kGLMIndexBuffer,
kGLMUniformBuffer, // for bindable uniform
kGLMPixelBuffer, // for PBO
kGLMNumBufferTypes
};
// pass this in "options" to constructor to make a dynamic buffer
#define GLMBufferOptionDynamic 0x00000001
struct GLMBuffLockParams
{
uint m_offset;
uint m_size;
bool m_nonblocking;
bool m_discard;
};
class CGLMBuffer
{
public:
void Lock( GLMBuffLockParams *params, char **addressOut );
void Unlock( void );
//protected:
friend class GLMContext; // only GLMContext can make CGLMBuffer objects
friend class GLMTester;
friend struct IDirect3D9;
friend struct IDirect3DDevice9;
CGLMBuffer ( GLMContext *ctx, EGLMBufferType type, uint size, uint options );
~CGLMBuffer ( );
void SetModes ( bool asyncMap, bool explicitFlush, bool force = false );
void FlushRange ( uint offset, uint size );
GLMContext *m_ctx; // link back to parent context
EGLMBufferType m_type;
uint m_size;
GLenum m_buffGLTarget; // GL_ARRAY_BUFFER_ARB / GL_ELEMENT_BUFFER_ARB
GLuint m_name; // name of this program in the context
uint m_revision; // bump anytime the size changes or buffer is orphaned
bool m_enableAsyncMap; // mirror of the buffer state
bool m_enableExplicitFlush; // mirror of the buffer state
bool m_bound; // true if bound to context
bool m_mapped; // is it currently mapped
uint m_dirtyMinOffset; // when equal, range is empty
uint m_dirtyMaxOffset;
float *m_lastMappedAddress;
// --------------------- pseudo-VBO support below here (explicitly for dynamic index buffers)
bool m_pseudo; // true if the m_name is 0, and the backing is plain RAM
// in pseudo mode, there is just one RAM buffer that acts as the backing.
// expectation is that this mode would only be used for dynamic indices.
// since indices have to be consumed (copied to command stream) prior to return from a drawing call,
// there's no need to do any fencing or multibuffering. orphaning in particular becomes a no-op.
char *m_pseudoBuf; // storage for pseudo buffer
};
#endif

View File

@ -0,0 +1,356 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmfbo.cpp
//
//===============================================================================
#include "glmgr.h"
#include "cglmfbo.h"
// #include "../shaderapidx9/dxabstract.h"
#ifdef OSX
// Debugger - 10.8
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
CGLMFBO::CGLMFBO( GLMContext *ctx )
{
m_ctx = ctx;
m_ctx->CheckCurrent();
glGenFramebuffersEXT( 1, &m_name );
GLMCheckError();
memset( m_attach, 0, sizeof( m_attach ) );
m_sizeX = m_sizeY = 0;
}
CGLMFBO::~CGLMFBO( )
{
m_ctx->CheckCurrent();
// detach all known attached textures first... necessary ?
for( int index = 0; index < kAttCount; index++)
{
if (m_attach[ index ].m_tex)
{
TexDetach( (EGLMFBOAttachment)index );
GLMCheckError();
}
}
glDeleteFramebuffersEXT( 1, &m_name );
GLMCheckError();
m_name = 0;
m_ctx = NULL;
}
// the tex attach path should also select a specific slice of the texture...
// and we need a way to make renderbuffers..
static GLenum EncodeAttachmentFBO( EGLMFBOAttachment index )
{
if (index < kAttDepth)
{
return GL_COLOR_ATTACHMENT0_EXT + (int) index;
}
else
{
switch( index )
{
case kAttDepth:
return GL_DEPTH_ATTACHMENT_EXT;
break;
case kAttStencil:
return GL_STENCIL_ATTACHMENT_EXT;
break;
case kAttDepthStencil:
return GL_DEPTH_STENCIL_ATTACHMENT_EXT;
break;
default:
GLMStop(); // bad news
return 0;
break;
}
}
}
void CGLMFBO::TexAttach( GLMFBOTexAttachParams *params, EGLMFBOAttachment attachIndex, GLenum fboBindPoint )
{
// force our parent context to be current
m_ctx->MakeCurrent();
// bind to context (will cause FBO object creation on first use)
m_ctx->BindFBOToCtx( this, fboBindPoint );
// it's either a plain 2D, a 2D face of a cube map, or a slice of a 3D.
CGLMTex *tex = params->m_tex;
// always detach what is currently there, if anything
this->TexDetach( attachIndex, fboBindPoint );
if (!tex)
{
// andif they pass NULL to us, then we are done.
return;
}
GLMTexLayout *layout = tex->m_layout;
GLenum target = tex->m_layout->m_key.m_texGLTarget;
GLenum attachIndexGL = EncodeAttachmentFBO( attachIndex );
switch( target )
{
case GL_TEXTURE_2D:
{
// we will attach the underlying RBO on a multisampled tex, iff the tex hasone, **and** we're not being asked to attach it to the read buffer.
// if we get a req to attach an MSAA tex to the read buffer, chances are it's BlitTex calling, andit has already resolved the tex, so in those
// cases you really do want to attach the texture and not the RBO to the FBO in question.
bool useRBO = false; // initial state
if (layout->m_key.m_texFlags & kGLMTexMultisampled)
{
// it is an MSAA tex
if (fboBindPoint == GL_READ_FRAMEBUFFER_EXT)
{
// I think you just want to read a resolved tex.
// But I will check that it is resolved first..
Assert( tex->m_rboDirty == false );
}
else
{
// you want to draw into it. You get the RBO bound instead of the tex.
useRBO = true;
}
}
if (useRBO)
{
// MSAA path - attach the RBO, not the texture, and mark the RBO dirty
if (attachIndexGL==GL_DEPTH_STENCIL_ATTACHMENT_EXT)
{
// you have to attach it both places...
// http://www.opengl.org/wiki/GL_EXT_framebuffer_object
// bind the RBO to the GL_RENDERBUFFER_EXT target
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, tex->m_rboName );
GLMCheckError();
// attach the GL_RENDERBUFFER_EXT target to the depth and stencil attach points
glFramebufferRenderbufferEXT( fboBindPoint, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, tex->m_rboName);
GLMCheckError();
glFramebufferRenderbufferEXT( fboBindPoint, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, tex->m_rboName);
GLMCheckError();
// no need to leave the RBO hanging on
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 );
GLMCheckError();
}
else
{
// color attachment (likely 0)
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, tex->m_rboName );
GLMCheckError();
glFramebufferRenderbufferEXT( fboBindPoint, attachIndexGL, GL_RENDERBUFFER_EXT, tex->m_rboName);
GLMCheckError();
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 );
GLMCheckError();
}
tex->m_rboDirty = true;
}
else
{
// regular path - attaching a texture2d
if (attachIndexGL==GL_DEPTH_STENCIL_ATTACHMENT_EXT)
{
// you have to attach it both places...
// http://www.opengl.org/wiki/GL_EXT_framebuffer_object
glFramebufferTexture2DEXT( fboBindPoint, GL_DEPTH_ATTACHMENT_EXT, target, tex->m_texName, params->m_mip );
GLMCheckError();
glFramebufferTexture2DEXT( fboBindPoint, GL_STENCIL_ATTACHMENT_EXT, target, tex->m_texName, params->m_mip );
GLMCheckError();
}
else
{
glFramebufferTexture2DEXT( fboBindPoint, attachIndexGL, target, tex->m_texName, params->m_mip );
GLMCheckError();
}
}
}
break;
case GL_TEXTURE_3D:
{
glFramebufferTexture3DEXT( fboBindPoint, attachIndexGL, target, tex->m_texName, params->m_mip, params->m_zslice );
GLMCheckError();
}
break;
case GL_TEXTURE_CUBE_MAP:
{
// adjust target to steer to the proper face of the cube map
target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + params->m_face;
glFramebufferTexture2DEXT( fboBindPoint, attachIndexGL, target, tex->m_texName, params->m_mip );
GLMCheckError();
}
break;
}
// log the attached tex
m_attach[ attachIndex ] = *params;
// indicate that the tex has been bound to an RT
tex->m_rtAttachCount++;
}
void CGLMFBO::TexDetach( EGLMFBOAttachment attachIndex, GLenum fboBindPoint )
{
// force our parent context to be current
m_ctx->MakeCurrent();
// bind to context (will cause FBO object creation on first use)
m_ctx->BindFBOToCtx( this, fboBindPoint );
if (m_attach[ attachIndex ].m_tex)
{
CGLMTex *tex = m_attach[ attachIndex ].m_tex;
GLMTexLayout *layout = tex->m_layout;
GLenum target = tex->m_layout->m_key.m_texGLTarget;
GLenum attachIndexGL = EncodeAttachmentFBO( attachIndex );
switch( target )
{
case GL_TEXTURE_2D:
{
if (layout->m_key.m_texFlags & kGLMTexMultisampled)
{
// MSAA path - detach the RBO, not the texture
// (is this the right time to resolve? probably better to wait until someone tries to sample the texture)
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 );
GLMCheckError();
if (attachIndexGL==GL_DEPTH_STENCIL_ATTACHMENT_EXT)
{
// detach the GL_RENDERBUFFER_EXT target at depth and stencil attach points
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0);
GLMCheckError();
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0);
GLMCheckError();
}
else
{
// color attachment (likely 0)
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, attachIndexGL, GL_RENDERBUFFER_EXT, 0);
GLMCheckError();
}
}
else
{
// plain tex detach
if (attachIndexGL==GL_DEPTH_STENCIL_ATTACHMENT_EXT)
{
// you have to detach it both places...
// http://www.opengl.org/wiki/GL_EXT_framebuffer_object
glFramebufferTexture2DEXT( fboBindPoint, GL_DEPTH_ATTACHMENT_EXT, 0,0,0 );
glFramebufferTexture2DEXT( fboBindPoint, GL_STENCIL_ATTACHMENT_EXT, 0,0,0 );
}
else
{
glFramebufferTexture2DEXT( fboBindPoint, attachIndexGL, 0, 0, 0 );
}
}
}
break;
case GL_TEXTURE_3D:
{
glFramebufferTexture3DEXT( fboBindPoint, attachIndexGL, 0, 0, 0, 0 );
GLMCheckError();
}
break;
case GL_TEXTURE_CUBE_MAP:
{
glFramebufferTexture2DEXT( fboBindPoint, attachIndexGL, 0, 0, 0 );
GLMCheckError();
}
break;
}
// un-log the attached tex
memset( &m_attach[ attachIndex ], 0, sizeof( m_attach[0] ) );
// drop the RT attach count
tex->m_rtAttachCount--;
}
else
{
//Debugger(); // odd, but not harmful - typ comes from D3D code passing NULL into SetRenderTarget
}
}
void CGLMFBO::TexScrub( CGLMTex *tex )
{
// see if it's attached anywhere
for( int attachIndex = 0; attachIndex < kAttCount; attachIndex++ )
{
if (m_attach[ attachIndex ].m_tex == tex)
{
// blammo
TexDetach( (EGLMFBOAttachment)attachIndex, GL_DRAW_FRAMEBUFFER_EXT );
}
}
}
bool CGLMFBO::IsReady( void )
{
bool result = false;
// ensure our parent context is current
m_ctx->CheckCurrent();
// bind to context (will cause FBO object creation on first use)
m_ctx->BindFBOToCtx( this );
GLenum status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
switch(status)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
result = true;
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
result = false;
Debugger();
/* choose different formats */
break;
default:
result = false;
Debugger();
/* programming error; will fail on all hardware */
break;
}
return result;
}

View File

@ -0,0 +1,91 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmfbo.h
// GLMgr FBO's (render targets)
//
//===============================================================================
#ifndef CGLMFBO_H
#define CGLMFBO_H
#pragma once
#include "cglmtex.h"
// good FBO references / recaps
// http://www.songho.ca/opengl/gl_fbo.html
// http://www.gamedev.net/reference/articles/article2331.asp
// ext links
// http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt
// http://www.opengl.org/registry/specs/EXT/framebuffer_multisample.txt
//===============================================================================
// tokens not in the SDK headers
#ifndef GL_DEPTH_STENCIL_ATTACHMENT_EXT
#define GL_DEPTH_STENCIL_ATTACHMENT_EXT 0x84F9
#endif
//===============================================================================
// forward declarations
class GLMContext;
// implicitly 16 maximum color attachments possible
enum EGLMFBOAttachment {
kAttColor0, kAttColor1, kAttColor2, kAttColor3,
kAttColor4, kAttColor5, kAttColor6, kAttColor7,
kAttColor8, kAttColor9, kAttColor10, kAttColor11,
kAttColor12, kAttColor13, kAttColor14, kAttColor15,
kAttDepth, kAttStencil, kAttDepthStencil,
kAttCount
};
struct GLMFBOTexAttachParams
{
CGLMTex *m_tex;
int m_face; // keep zero if not cube map
int m_mip; // keep zero if notmip mapped
int m_zslice; // keep zero if not a 3D tex
};
class CGLMFBO
{
public:
protected:
friend class GLMContext; // only GLMContext can make CGLMFBO objects
friend class GLMTester;
friend class CGLMTex;
friend struct IDirect3D9;
friend struct IDirect3DDevice9;
CGLMFBO( GLMContext *ctx );
~CGLMFBO( );
void TexAttach( GLMFBOTexAttachParams *params, EGLMFBOAttachment attachIndex, GLenum fboBindPoint = GL_FRAMEBUFFER_EXT );
void TexDetach( EGLMFBOAttachment attachIndex, GLenum fboBindPoint = GL_FRAMEBUFFER_EXT );
// you can also pass GL_READ_FRAMEBUFFER_EXT or GL_DRAW_FRAMEBUFFER_EXT to selectively bind the receiving FBO to one or the other.
void TexScrub( CGLMTex *tex );
// search and destroy any attachment for the named texture
bool IsReady( void ); // aka FBO completeness check - ready to draw
GLMContext *m_ctx; // link back to parent context
GLuint m_name; // name of this FBO in the context
GLMFBOTexAttachParams m_attach[ kAttCount ]; // indexed by EGLMFBOAttachment
int m_sizeX,m_sizeY;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,291 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmprogram.h
// GLMgr programs (ARBVP/ARBfp)
//
//===============================================================================
#ifndef CGLMPROGRAM_H
#define CGLMPROGRAM_H
#include <sys/stat.h>
#pragma once
// good ARB program references
// http://petewarden.com/notes/archives/2005/05/fragment_progra_2.html
// http://petewarden.com/notes/archives/2005/06/fragment_progra_3.html
// ext links
// http://www.opengl.org/registry/specs/ARB/vertex_program.txt
// http://www.opengl.org/registry/specs/ARB/fragment_program.txt
// http://www.opengl.org/registry/specs/EXT/gpu_program_parameters.txt
//===============================================================================
// tokens not in the SDK headers
//#ifndef GL_DEPTH_STENCIL_ATTACHMENT_EXT
// #define GL_DEPTH_STENCIL_ATTACHMENT_EXT 0x84F9
//#endif
//===============================================================================
// forward declarations
class GLMContext;
class CGLMShaderPair;
class CGLMShaderPairCache;
// CGLMProgram can contain two flavors of the same program, one in assembler, one in GLSL.
// these flavors are pretty different in terms of the API's that are used to activate them -
// for example, assembler programs can just get bound to the context, whereas GLSL programs
// have to be linked. To some extent we try to hide that detail inside GLM.
// for now, make CGLMProgram a container, it does not set policy or hold a preference as to which
// flavor you want to use. GLMContext has to handle that.
enum EGLMProgramType
{
kGLMVertexProgram,
kGLMFragmentProgram,
kGLMNumProgramTypes
};
enum EGLMProgramLang
{
kGLMARB,
kGLMGLSL,
kGLMNumProgramLangs
};
struct GLMShaderDesc
{
union
{
GLuint arb; // ARB program object name
GLhandleARB glsl; // GLSL shader object handle (void*)
} m_object;
// these can change if shader text is edited
bool m_textPresent; // is this flavor(lang) of text present in the buffer?
int m_textOffset; // where is it
int m_textLength; // how big
bool m_compiled; // has this text been through a compile attempt
bool m_valid; // and if so, was the compile successful
int m_slowMark; // has it been flagged during a non native draw batch before. increment every time it's slow.
int m_highWater; // vount of vec4's in the major uniform array ("vc" on vs, "pc" on ps)
// written by dxabstract.... gross!
};
GLenum GLMProgTypeToARBEnum( EGLMProgramType type ); // map vert/frag to ARB asm bind target
GLenum GLMProgTypeToGLSLEnum( EGLMProgramType type ); // map vert/frag to ARB asm bind target
class CGLMProgram
{
public:
friend class CGLMShaderPairCache;
friend class CGLMShaderPair;
friend class GLMContext; // only GLMContext can make CGLMProgram objects
friend class GLMTester;
friend struct IDirect3D9;
friend struct IDirect3DDevice9;
//===============================
// constructor is very light, it just makes one empty program object per flavor.
CGLMProgram( GLMContext *ctx, EGLMProgramType type );
~CGLMProgram( );
void SetProgramText ( char *text ); // import text to GLM object - invalidate any prev compiled program
bool CompileActiveSources ( void ); // compile only the flavors that were provided.
bool Compile ( EGLMProgramLang lang );
bool CheckValidity ( EGLMProgramLang lang );
void LogSlow ( EGLMProgramLang lang ); // detailed spew when called for first time; one liner or perhaps silence after that
void GetLabelIndexCombo ( char *labelOut, int labelOutMaxChars, int *indexOut, int *comboOut );
void GetComboIndexNameString ( char *stringOut, int stringOutMaxChars ); // mmmmmmmm-nnnnnnnn-filename
#if GLMDEBUG
bool PollForChanges( void ); // check mirror for changes.
void ReloadStringFromEditable( void ); // populate m_string from editable item (react to change)
bool SyncWithEditable( void );
#endif
//===============================
// common stuff
GLMContext *m_ctx; // link back to parent context
EGLMProgramType m_type; // vertex or pixel
uint m_serial; // serial number for hashing
char *m_text; // copy of text passed into constructor. Can change if editable shaders is enabled.
// note - it can contain multiple flavors, so use CGLMTextSectioner to scan it and locate them
#if GLMDEBUG
CGLMEditableTextItem *m_editable; // editable text item for debugging
#endif
GLMShaderDesc m_descs[ kGLMNumProgramLangs ];
uint m_samplerMask; // (1<<n) mask of sampler active locs, if this is a fragment shader (dxabstract sets this field)
};
//===============================================================================
struct GLMShaderPairInfo
{
int m_status; // -1 means req'd index was out of bounds (loop stop..) 0 means not present. 1 means present/active.
char m_vsName[ 128 ];
int m_vsStaticIndex;
int m_vsDynamicIndex;
char m_psName[ 128 ];
int m_psStaticIndex;
int m_psDynamicIndex;
};
class CGLMShaderPair // a container for a linked GLSL shader pair, and metadata obtained post-link
{
public:
friend class CGLMProgram;
friend class GLMContext;
friend class CGLMShaderPairCache;
//===============================
// constructor just sets up a GLSL program object and leaves it empty.
CGLMShaderPair( GLMContext *ctx );
~CGLMShaderPair( );
bool SetProgramPair ( CGLMProgram *vp, CGLMProgram *fp );
// true result means successful link and query
bool RefreshProgramPair ( void );
// re-link and re-query the uniforms
//===============================
// common stuff
GLMContext *m_ctx; // link back to parent context
CGLMProgram *m_vertexProg;
CGLMProgram *m_fragmentProg;
GLhandleARB m_program; // linked program object
// need meta data for attribs / samplers / params
// actually we only need it for samplers and params.
// attributes are hardwired.
// vertex stage uniforms
GLint m_locVertexParams; // "vc" per dx9asmtogl2 convention
GLint m_locVertexInteger0; // "i0"
GLint m_locVertexBool0; // "b0"
GLint m_locVertexBool1; // "b1"
GLint m_locVertexBool2; // "b2"
GLint m_locVertexBool3; // "b3"
// fragment stage uniforms
GLint m_locFragmentParams; // "pc" per dx9asmtogl2 convention
GLint m_locFragmentFakeSRGBEnable; // "flSRGBWrite" - set to 1.0 to effect sRGB encoding on output
float m_fakeSRGBEnableValue; // shadow to avoid redundant sets of the m_locFragmentFakeSRGBEnable uniform
// init it to -1.0 at link or relink, so it will trip on any legit incoming value (0.0 or 1.0)
GLint m_locSamplers[ 16 ]; // "sampler0 ... sampler1..."
// other stuff
bool m_valid; // true on successful link
bool m_samplersFixed; // set on first draw (can't write the uniforms until the program is in use, and we don't want to mess with cur program inside cglmprogram)
uint m_revision; // if this pair is relinked, bump this number.
};
//===============================================================================
// N-row, M-way associative cache with LRU per row.
// still needs some metric dump ability and some parameter tuning.
// extra credit would be to make an auto-tuner.
struct CGLMPairCacheEntry
{
long long m_lastMark; // a mark of zero means an empty entry
CGLMProgram *m_vertexProg;
CGLMProgram *m_fragmentProg;
uint m_extraKeyBits;
CGLMShaderPair *m_pair;
};
class CGLMShaderPairCache // cache for linked GLSL shader pairs
{
public:
protected:
friend class CGLMShaderPair;
friend class CGLMProgram;
friend class GLMContext;
//===============================
CGLMShaderPairCache( GLMContext *ctx );
~CGLMShaderPairCache( );
CGLMShaderPair *SelectShaderPair ( CGLMProgram *vp, CGLMProgram *fp, uint extraKeyBits );
void QueryShaderPair ( int index, GLMShaderPairInfo *infoOut );
// shoot down linked pairs that use the program in the arg
// return true if any had to be skipped due to conflict with currently bound pair
bool PurgePairsWithShader( CGLMProgram *prog );
// purge everything (when would GLM know how to do this ? at context destroy time, but any other times?)
// return true if any had to be skipped due to conflict with currently bound pair
bool Purge ( void );
// stats
void DumpStats ( void );
//===============================
uint HashRowIndex ( CGLMProgram *vp, CGLMProgram *fp, uint extraKeyBits );
CGLMPairCacheEntry* HashRowPtr ( uint hashRowIndex );
void HashRowProbe ( CGLMPairCacheEntry *row, CGLMProgram *vp, CGLMProgram *fp, uint extraKeyBits, int *hitwayOut, int *emptywayOut, int *oldestwayOut );
//===============================
// common stuff
GLMContext *m_ctx; // link back to parent context
long long m_mark;
uint m_rowsLg2;
uint m_rows;
uint m_waysLg2;
uint m_ways;
uint m_entryCount;
CGLMPairCacheEntry *m_entries; // array[ m_rows ][ m_ways ]
uint *m_evictions; // array[ m_rows ];
uint *m_hits; // array[ m_rows ];
};
#endif

View File

@ -0,0 +1,436 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmquery.cpp
//
//===============================================================================
#include "glmgr.h"
#include "cglmquery.h"
#include "dxabstract.h"
#include <unistd.h>
//===============================================================================
extern int gl_errorcheckall;
extern int gl_errorcheckqueries;
extern int gl_errorchecknone;
// how many microseconds to wait after a failed query-available test
// presently on MTGL this doesn't happen, but it could change, keep this handy
//ConVar gl_nullqueries( "gl_nullqueries", "0" );
int gl_nullqueries = 0;
GLenum GetQueryError( void )
{
if ( ( GLMDEBUG || (gl_errorcheckall != 0) || (gl_errorcheckqueries != 0) ) && (gl_errorchecknone == 0) )
{
return glGetError();
}
else
{
return (GLenum) 0; // whistle past graveyard
}
}
//===============================================================================
CGLMQuery::CGLMQuery( GLMContext *ctx, GLMQueryParams *params )
{
// make sure context is current
// get the type of query requested
// generate name(s) needed
// set initial state appropriately
ctx->MakeCurrent();
m_ctx = ctx;
m_params = *params;
m_name = 0;
m_started = m_stopped = m_done = false;
m_nullQuery = false;
// assume value of convar at start time
// does not change during individual query lifetime
// started null = stays null
// started live = stays live
switch(m_params.m_type)
{
case EOcclusion:
{
//make an occlusion query (and a fence to go with it)
glGenQueriesARB( 1, &m_name );
GLMPRINTF(("-A- CGLMQuery(OQ) created name %d", m_name));
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::CGLMQuery (OQ) saw %s error (%d) from glGenQueriesARB", decodedStr, errorcode );
m_name = 0;
}
}
break;
case EFence:
{
//make a fence - no aux fence needed
glGenFencesAPPLE(1, &m_name );
GLMPRINTF(("-A- CGLMQuery(fence) created name %d", m_name));
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::CGLMQuery (fence) saw %s error (%d) from glGenFencesAPPLE", decodedStr, errorcode );
m_name = 0;
}
}
break;
default:
break;
}
}
CGLMQuery::~CGLMQuery()
{
GLMPRINTF(("-A-> ~CGLMQuery"));
// make sure query has completed (might not be necessary)
// delete the name(s)
m_ctx->MakeCurrent();
switch(m_params.m_type)
{
case EOcclusion:
{
// do a finish occlusion query ?
GLMPRINTF(("-A- ~CGLMQuery(OQ) deleting name %d", m_name));
glDeleteQueries(1, &m_name );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::~CGLMQuery (OQ) saw %s error (%d) from glDeleteQueries", decodedStr, errorcode );
}
}
break;
case EFence:
{
// do a finish fence ?
GLMPRINTF(("-A- ~CGLMQuery(fence) deleting name %d", m_name));
glDeleteFencesAPPLE(1, &m_name );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::~CGLMQuery (fence) saw %s error (%d) from glDeleteFencesAPPLE", decodedStr, errorcode );
}
}
break;
default:
break;
}
m_name = 0;
GLMPRINTF(("-A-< ~CGLMQuery"));
}
void CGLMQuery::Start( void ) // "start counting"
{
m_ctx->MakeCurrent();
// on occlusion query:
// glBeginQueryARB on the OQ name. counting starts.
// on fence: glSetFence on m_name.
// note, fences finish themselves via command progress - OQ's do not.
Assert(!m_started);
Assert(!m_stopped);
Assert(!m_done);
m_nullQuery = (gl_nullqueries != 0); // latch value for remainder of query life
switch(m_params.m_type)
{
case EOcclusion:
{
if (m_nullQuery)
{
// do nothing..
}
else
{
glBeginQueryARB( GL_SAMPLES_PASSED_ARB, m_name );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::Start(OQ) saw %s error (%d) from glBeginQueryARB (GL_SAMPLES_PASSED_ARB) name=%d", decodedStr, errorcode, m_name );
}
}
}
break;
case EFence:
{
glSetFenceAPPLE( m_name );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::Start(fence) saw %s error (%d) from glSetFenceAPPLE name=%d", decodedStr, errorcode, m_name );
}
m_stopped = true; // caller should not call Stop on a fence, it self-stops
}
break;
default:
break;
}
m_started = true;
}
void CGLMQuery::Stop( void ) // "stop counting"
{
m_ctx->MakeCurrent();
Assert(m_started);
Assert(!m_stopped); // this will assert if you try to call Stop on a fence that is started
Assert(!m_done);
switch(m_params.m_type)
{
case EOcclusion:
{
if (m_nullQuery)
{
// do nothing..
}
else
{
glEndQueryARB( GL_SAMPLES_PASSED_ARB ); // we are only putting the request-to-stop-counting into the cmd stream.
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::Stop(OQ) saw %s error (%d) from glEndQueryARB( GL_SAMPLES_PASSED_ARB ) name=%d", decodedStr, errorcode, m_name );
}
}
}
break;
case EFence:
{
// nop - you don't "end" a fence, you just test it and/or finish it out in Complete
}
break;
default:
break;
}
m_stopped = true;
}
bool CGLMQuery::IsDone( void )
{
m_ctx->MakeCurrent();
Assert(m_started);
Assert(m_stopped);
if(!m_done) // you can ask more than once, but we only check until it comes back as done.
{
// on occlusion: glGetQueryObjectivARB - large cost on pre SLGU, cheap after
// on fence: glTestFenceAPPLE on the fence
switch(m_params.m_type)
{
case EOcclusion: // just test the fence that was set after the query begin
{
if (m_nullQuery)
{
// do almost nothing.. but claim work is complete
m_done = true;
}
else
{
// prepare to pay a big price on drivers prior to 10.6.4+SLGU
GLint available = 0;
glGetQueryObjectivARB(m_name, GL_QUERY_RESULT_AVAILABLE_ARB, &available );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::IsDone saw %s error (%d) from glGetQueryObjectivARB(a2) name=%d", decodedStr, errorcode, m_name );
}
m_done = (available != 0);
}
}
break;
case EFence:
{
m_done = glTestFenceAPPLE( m_name );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::IsDone saw %s error (%d) from glTestFenceAPPLE(b) name=%d", decodedStr, errorcode, m_name );
}
if (m_done)
{
glFinishFenceAPPLE( m_name ); // no set fence goes un-finished
errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::IsDone saw %s error (%d) from glFinishFenceAPPLE(b) name=%d", decodedStr, errorcode, m_name );
}
}
}
break;
default:
break;
}
}
return m_done;
}
void CGLMQuery::Complete( uint *result )
{
m_ctx->MakeCurrent();
uint resultval = 0;
GLint available = 0;
// blocking call if not done
Assert(m_started);
Assert(m_stopped);
switch(m_params.m_type)
{
case EOcclusion:
{
if (m_nullQuery)
{
m_done = true;
resultval = 0; // we did say "null queries..."
}
else
{
// accept that the query is going to drain pipe in 10.6.4 and prior.
// check the error on the spot.
glGetQueryObjectivARB(m_name, GL_QUERY_RESULT_AVAILABLE_ARB, &available );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::Complete saw %s error (%d) from glGetQueryObjectivARB GL_QUERY_RESULT_AVAILABLE_ARB name=%d", decodedStr, errorcode, m_name );
resultval=0;
}
else
{
if (!available)
{
// this does happen with some very modest frequency.
if (!m_ctx->Caps().m_hasPerfPackage1)
{
glFlush(); // ISTR some deadlock cases on pre-SLGU drivers if you didn't do this to kick the queue along..
}
}
glGetQueryObjectuivARB( m_name, GL_QUERY_RESULT_ARB, &resultval);
errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::Complete saw %s error (%d) from glGetQueryObjectivARB GL_QUERY_RESULT_ARB name=%d", decodedStr, errorcode, m_name );
resultval=0;
}
else
{
// resultval is legit
}
}
m_done = true;
}
}
break;
case EFence:
{
if(!m_done)
{
glFinishFenceAPPLE( m_name );
GLenum errorcode = GetQueryError();
if (errorcode)
{
const char *decodedStr = GLMDecode( eGL_ERROR, errorcode );
printf( "\nCGLMQuery::Complete saw %s error (%d) from glFinishFenceAPPLE (EFence) name=%d", decodedStr, errorcode, m_name );
}
m_done = true; // for clarity or if they try to Complete twice
}
}
break;
default:
break;
}
Assert( m_done );
// reset state for re-use - i.e. you have to call Complete if you want to re-use the object
m_started = m_stopped = m_done = false;
if (result) // caller may pass NULL if not interested in result, for example to clear a fence
{
*result = resultval;
}
}
// accessors for the started/stopped state
bool CGLMQuery::IsStarted ( void )
{
return m_started;
}
bool CGLMQuery::IsStopped ( void )
{
return m_stopped;
}

View File

@ -0,0 +1,84 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmquery.h
// GLMgr queries
//
//===============================================================================
#ifndef CGLMQUERY_H
#define CGLMQUERY_H
#pragma once
#ifdef OSX
#include "glmgrbasics.h"
#endif
//===============================================================================
// forward declarations
class GLMContext;
class CGLMQuery;
//===============================================================================
enum EGLMQueryType
{
EOcclusion,
EFence,
EGLMQueryCount
};
struct GLMQueryParams
{
EGLMQueryType m_type;
};
class CGLMQuery
{
// leave everything public til it's running
public:
friend class GLMContext; // only GLMContext can make CGLMTex objects
friend struct IDirect3DDevice9;
friend struct IDirect3DQuery9;
GLMContext *m_ctx; // link back to parent context
GLMQueryParams m_params; // params created with
GLuint m_name; // name of the query object per se - could be fence, could be query object
bool m_started;
bool m_stopped;
bool m_done;
bool m_nullQuery; // was gl_nullqueries true at Start time - if so, continue to act like a null query through Stop/IsDone/Complete time
// restated - only Start should examine the convar.
CGLMQuery( GLMContext *ctx, GLMQueryParams *params );
~CGLMQuery( );
// for an occlusion query:
// Start = BeginQuery query-start goes into stream
// Stop = EndQuery query-end goes into stream - a fence is also set so we can probe for completion
// IsDone = TestFence use the added fence to ask if query-end has passed (i.e. will Complete block?)
// Complete = GetQueryObjectuivARB(uint id, enum pname, uint *params) - extract the sample count
// for a fence query:
// Start = SetFence fence goes into command stream
// Stop = NOP fences are self finishing - no need to call Stop on a fence
// IsDone = TestFence ask if fence passed
// Complete = FinishFence
void Start ( void );
void Stop ( void );
bool IsDone ( void );
void Complete ( uint *result );
// accessors for the started/stopped state
bool IsStarted ( void );
bool IsStopped ( void );
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,291 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// cglmtex.h
// GLMgr textures
//
//===============================================================================
#ifndef CGLMTEX_H
#define CGLMTEX_H
#pragma once
#ifdef OSX
#include "glmgrbasics.h"
#endif
//===============================================================================
// forward declarations
class GLMContext;
class GLMTester;
class CGLMTexLayoutTable;
class CGLMTex;
class CGLMFBO;
struct IDirect3DSurface9;
//===============================================================================
struct GLMTexFormatDesc
{
const char *m_formatSummary; // for debug visibility
D3DFORMAT m_d3dFormat; // what D3D knows it as; see public/bitmap/imageformat.h
GLenum m_glIntFormat; // GL internal format
GLenum m_glIntFormatSRGB; // internal format if SRGB flavor
GLenum m_glDataFormat; // GL data format
GLenum m_glDataType; // GL data type
int m_chunkSize; // 1 or 4 - 4 is used for compressed textures
int m_bytesPerSquareChunk; // how many bytes for the smallest quantum (m_chunkSize x m_chunkSize)
// this description lets us calculate size cleanly without conditional logic for compression
};
const GLMTexFormatDesc *GetFormatDesc( D3DFORMAT format );
//===============================================================================
// utility function for generating slabs of texels. mostly for test.
typedef struct
{
// in
D3DFORMAT m_format;
void *m_dest; // dest address
int m_chunkCount; // square chunk count (single texels or compressed blocks)
int m_byteCountLimit; // caller expectation of max number of bytes to write out
float r,g,b,a; // color desired
// out
int m_bytesWritten;
} GLMGenTexelParams;
// return true if successful
bool GLMGenTexels( GLMGenTexelParams *params );
//===============================================================================
struct GLMTexLayoutSlice
{
int m_xSize,m_ySize,m_zSize; //texel dimensions of this slice
int m_storageOffset; //where in the storage slab does this slice live
int m_storageSize; //how much storage does this slice occupy
};
enum EGLMTexFlags
{
kGLMTexMipped = 0x01,
kGLMTexMippedAuto = 0x02,
kGLMTexRenderable = 0x04,
kGLMTexIsStencil = 0x08,
kGLMTexIsDepth = 0x10,
kGLMTexSRGB = 0x20,
kGLMTexMultisampled = 0x40, // has an RBO backing it. Cannot combine with Mipped, MippedAuto. One slice maximum, only targeting GL_TEXTURE_2D.
// actually not 100% positive on the mipmapping, the RBO itself can't be mipped, but the resulting texture could
// have mipmaps generated.
};
//===============================================================================
struct GLMTexLayoutKey
{
// input values: held const, these are the hash key for the form map
GLenum m_texGLTarget; // flavor of texture: GL_TEXTURE_2D, GL_TEXTURE_3D, GLTEXTURE_CUBE_MAP
D3DFORMAT m_texFormat; // D3D texel format
unsigned long m_texFlags; // mipped, autogen mips, render target, ... ?
unsigned long m_texSamples; // zero for a plain tex, 2/4/6/8 for "MSAA tex" (RBO backed)
int m_xSize,m_ySize,m_zSize; // size of base mip
};
struct LessThan_GLMTexLayoutKey
{
bool operator()(const GLMTexLayoutKey &a, const GLMTexLayoutKey &b) const
{
#define DO_LESS(fff) if (a.fff != b.fff) { return (a.fff< b.fff); }
DO_LESS(m_texGLTarget);
DO_LESS(m_texFormat);
DO_LESS(m_texFlags);
DO_LESS(m_xSize);
DO_LESS(m_ySize)
DO_LESS(m_zSize);
#undef DO_LESS
return false; // they are equal
}
};
#define GLM_TEX_MAX_MIPS 14
#define GLM_TEX_MAX_FACES 6
#define GLM_TEX_MAX_SLICES (GLM_TEX_MAX_MIPS * GLM_TEX_MAX_FACES)
struct GLMTexLayout
{
char *m_layoutSummary; // for debug visibility
// const inputs used for hashing
GLMTexLayoutKey m_key;
// refcount
int m_refCount;
// derived values:
GLMTexFormatDesc *m_format; // format specific info
int m_mipCount; // derived by starying at base size and working down towards 1x1
int m_faceCount; // 1 for 2d/3d, 6 for cubemap
int m_sliceCount; // product of faces and mips
int m_storageTotalSize; // size of storage slab required
// slice array
GLMTexLayoutSlice m_slices[0]; // dynamically allocated 2-d array [faces][mips]
};
typedef std::map< GLMTexLayoutKey, GLMTexLayout*, LessThan_GLMTexLayoutKey > GLMTexLayoutKeyMap;
class CGLMTexLayoutTable
{
public:
CGLMTexLayoutTable();
GLMTexLayout *NewLayoutRef( GLMTexLayoutKey *key ); // pass in a pointer to layout key - receive ptr to completed layout
void DelLayoutRef( GLMTexLayout *layout ); // pass in pointer to completed layout. refcount is dropped.
void DumpStats( void );
protected:
GLMTexLayoutKeyMap m_layoutMap;
};
//===============================================================================
// a sampler specifies desired state for drawing on a given sampler index
// this is the combination of a texture choice and a set of sampler parameters
// see http://msdn.microsoft.com/en-us/library/bb172602(VS.85).aspx
struct GLMTexSamplingParams
{
GLenum m_addressModes[3]; // S, T, R
GLfloat m_borderColor[4]; // R,G,B,A
GLenum m_magFilter;
GLenum m_minFilter;
GLfloat m_mipmapBias;
GLint m_minMipLevel;
GLint m_maxMipLevel;
GLint m_maxAniso;
GLenum m_compareMode; // only used for depth and stencil type textures
bool m_srgb; // srgb texture read...
};
struct GLMTexLockParams
{
// input params which identify the slice of interest
CGLMTex *m_tex;
int m_face;
int m_mip;
// identifies the region of the slice
GLMRegion m_region;
// tells GLM to force re-read of the texels back from GL
// i.e. "I know I stepped on those texels with a draw or blit - the GLM copy is stale"
bool m_readback;
};
struct GLMTexLockDesc
{
GLMTexLockParams m_req; // form of the lock request
bool m_active; // set true at lock time. cleared at unlock time.
int m_sliceIndex; // which slice in the layout
int m_sliceBaseOffset; // where is that in the texture data
int m_sliceRegionOffset; // offset to the start (lowest address corner) of the region requested
};
//===============================================================================
#define GLM_SAMPLER_COUNT 16
typedef unsigned short CTexBindMask; // 16 bits, who needs bitvec...
enum EGLMTexSliceFlag
{
kSliceValid = 0x01, // slice has been teximage'd in whole at least once - set to 0 initially
kSliceStorageValid = 0x02, // if backing store is available, this slice's data is a valid copy - set to 0 initially
kSliceLocked = 0x04, // are one or more locks outstanding on this slice
kSliceFullyDirty = 0x08, // does the slice need to be fully downloaded at unlock time (disregard dirty rects)
};
class CGLMTex
{
public:
void Lock( GLMTexLockParams *params, char** addressOut, int* yStrideOut, int *zStrideOut );
void Unlock( GLMTexLockParams *params );
protected:
friend class GLMContext; // only GLMContext can make CGLMTex objects
friend class GLMTester;
friend class CGLMFBO;
friend struct IDirect3DDevice9;
friend struct IDirect3DBaseTexture9;
friend struct IDirect3DTexture9;
friend struct IDirect3DSurface9;
friend struct IDirect3DCubeTexture9;
friend struct IDirect3DVolumeTexture9;
CGLMTex( GLMContext *ctx, GLMTexLayout *layout, GLMTexSamplingParams *sampling, const char *debugLabel = NULL );
~CGLMTex( );
int CalcSliceIndex( int face, int mip );
void CalcTexelDataOffsetAndStrides( int sliceIndex, int x, int y, int z, int *offsetOut, int *yStrideOut, int *zStrideOut );
void ApplySamplingParams( GLMTexSamplingParams *params, bool noCheck=FALSE );
void ReadTexels( GLMTexLockDesc *desc, bool readWholeSlice=true );
void WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice=true, bool noDataWrite=false );
// last param lets us send NULL data ptr (only legal with uncompressed formats, beware)
// this helps out ResetSRGB.
void ResetSRGB( bool srgb, bool noDataWrite );
// re-specify texture format to match desired sRGB form
// noWrite means send NULL for texel source addresses instead of actual data - ideal for RT's
GLMTexLayout *m_layout; // layout of texture (shared across all tex with same layout)
int m_minActiveMip;//index of lowest mip that has been written. used to drive setting of GL_TEXTURE_MAX_LEVEL.
int m_maxActiveMip;//index of highest mip that has been written. used to drive setting of GL_TEXTURE_MAX_LEVEL.
GLMTexSamplingParams m_sampling; // mirror of sampling params currently embodied in the texture
// (consult this at draw time, in order to know if changes need to be made)
GLMContext *m_ctx; // link back to parent context
GLuint m_texName; // name of this texture in the context
bool m_texClientStorage; // was CS selecetd for texture
bool m_texPreloaded; // has it been kicked into VRAM with GLMContext::PreloadTex yet
GLuint m_rboName; // name of MSAA RBO backing the tex if MSAA enabled (or zero)
bool m_rboDirty; // has RBO been drawn on - i.e. needs to be blitted back to texture if texture is going to be sampled from
CTexBindMask m_bindPoints; // true for each place in the parent ctx where currently
// bound (indexed via EGLMTexCtxBindingIndex)
int m_rtAttachCount; // how many RT's have this texture attached somewhere
char *m_backing; // backing storage if available
int m_lockCount; // lock reqs are stored in the GLMContext for tracking
std::vector<unsigned char> m_sliceFlags;
char *m_debugLabel; // strdup() of debugLabel passed in, or NULL
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,233 @@
//------------------------------------------------------------------------------
// DX9AsmToGL2.h
//------------------------------------------------------------------------------
#ifndef DX9_ASM_TO_GL_2_H
#define DX9_ASM_TO_GL_2_H
#include "glmgr.h"
//==============================================================================
#define DISASM_OK 0
#define DISASM_ERROR 1
#define MAX_SHADER_CONSTANTS 512
#define MAX_DECLARED_OUTPUTS 32
#define HEXCODE_HEADER "// Hex: "
// Option bits
#define D3DToGL_OptionUseEnvParams 0x001
#define D3DToGL_OptionDoFixupZ 0x002 // Add instructions to put Z in the right interval for GL
#define D3DToGL_OptionDoFixupY 0x004 // Add instructions to flip the Y over for GL
#define D3DToGL_OptionDoUserClipPlanes 0x008 // ARB mode: Include OPTION vertex_program_2 and append DP4's to write into oCLP[0] and oCLP[1]
// GLSL mode: generate code to write gl_ClipVertex
#define D3DToGL_OptionGLSL 0x010 // Output GLSL, rather than ASM
#define D3DToGL_AddHexComments 0x020 // Include hex comments in the code for debugging
#define D3DToGL_PutHexCommentsAfterLines 0x040 // If D3DToGL_AddHexComments is set, this puts the codes to the right, rather than on separate lines
#define D3DToGL_GeneratingDebugText 0x080 // This tells it that we're just getting info for debugging so go easy on asserts and errors
#define D3DToGL_OptionAllowStaticControlFlow 0x100
#define D3DToGL_OptionUseBindableUniforms 0x200 // add "bindable" in front of "vc" / "pc" constant arrays (GLSL only)
#define D3DToGL_OptionSRGBWriteSuffix 0x400 // Tack sRGB conversion suffix on to pixel shaders
#define D3DToGL_OptionSpew 0x80000000
// Code for which component of the "dummy" address register is needed by an instruction
#define ARL_DEST_NONE -1
#define ARL_DEST_X 0
#define ARL_DEST_Y 1
#define ARL_DEST_Z 2
#define ARL_DEST_W 3
class D3DToGL
{
private:
// Pointers for dwToken stream management
uint32* m_pdwBaseToken;
uint32* m_pdwNextToken;
// Vertex shader or pixel shader, and version (necessary because some opcodes alias)
bool m_bVertexShader;
uint32 m_dwMinorVersion;
uint32 m_dwMajorVersion;
// Option flags
bool m_bUseEnvParams; // set D3DToGL_OptionUseEnvParams in 'options' to use
bool m_bDoFixupZ; // set D3DToGL_OptionDoFixupZ
bool m_bDoFixupY; // set D3DToGL_OptionDoFixupZ
bool m_bDoUserClipPlanes; // set D3DToGL_OptionDoUserClipPlanes
bool m_bSpew; // set D3DToGL_OptionSpew
bool m_bUseBindableUniforms; // set D3DToGL_OptionUseBindableUniforms
bool m_bGenerateSRGBWriteSuffix; // set D3DToGL_OptionSRGBWriteSuffix
// Default: false
// If you set this to true, it'll convert to GLSL instead of GL ASM.
bool m_bGLSL; // set D3DToGL_OptionGLSL
// Default: false
bool m_bAllowStaticControlFlow; // set D3DToGL_OptionAllowStaticControlFlow
// Counter for dealing with nested loops
int m_nLoopDepth;
// Add "// Hex: 0xFFEEF00"-type statements after each instruction is parsed.
bool m_bAddHexCodeComments; // set D3DToGL_AddHexComments
// Only applicable if m_bAddHexCodeComments is true.
// If this is true, then it puts the hex code comments to the right of the instructions in a comment
// rather than preceding the instructions.
// Defaults to FALSE.
bool m_bPutHexCodesAfterLines; // set D3DToGL_PutHexCommentsAtEnd
// This tells it that we're just getting info for debugging so go easy on asserts and errors.
// Defaults to FALSE.
bool m_bGeneratingDebugText;
// Various scratch temps needed to handle mis-matches in instruction sets between D3D and OpenGL
bool m_bNeedsD2AddTemp;
bool m_bNeedsNRMTemp;
bool m_bDeclareAddressReg;
bool m_bNeedsLerpTemp;
bool m_bNeedsSinCosDeclarations;
// Keep track of which vs outputs are used so we can declare them
bool m_bDeclareVSOPos;
bool m_bDeclareVSOFog;
uint32 m_dwTexCoordOutMask;
// Mask of varyings which need centroid decoration
uint32 m_nCentroidMask;
// Keep track of which temps are used so they can be declared
uint32 m_dwTempUsageMask;
bool m_bOutputColorRegister[4];
bool m_bOutputDepthRegister;
// Declaration of integer and bool constants
uint32 m_dwConstIntUsageMask;
uint32 m_dwConstBoolUsageMask;
// Did we use atomic_temp_var?
bool m_bUsedAtomicTempVar;
// Track constants so we know how to declare them
bool m_bConstantRegisterDefined[MAX_SHADER_CONSTANTS];
// Track sampler types when declared so we can properly decorate TEX instructions
uint32 m_dwSamplerTypes[32];
// Track sampler usage
uint32 m_dwSamplerUsageMask;
// Track shadow sampler usage
int m_nShadowDepthSampler;
bool m_bDeclareShadowOption;
// Track attribute references
// init to 0xFFFFFFFF (unhit)
// index by (dwRegToken & D3DSP_REGNUM_MASK) in VS DCL insns
// fill with (usage<<4) | (usage index).
uint32 m_dwAttribMap[16];
// Register high water mark
uint32 m_nHighestRegister;
// GLSL does indentation for readability
int m_NumIndentTabs;
// Output buffers.
CUtlBuffer *m_pBufHeaderCode;
CUtlBuffer *m_pBufAttribCode;
CUtlBuffer *m_pBufParamCode;
CUtlBuffer *m_pBufALUCode;
char *m_pFinalAssignmentsCode;
int m_nFinalAssignmentsBufSize;
// Recorded positions for debugging.
uint32* m_pRecordedInputTokenStart;
int m_nRecordedParamCodeStrlen;
int m_nRecordedALUCodeStrlen;
int m_nRecordedAttribCodeStrlen;
// In GLSL mode, these store the semantic attached to each oN register.
// They are the values that you pass to GetUsageIndexAndString.
uint32 m_DeclaredOutputs[MAX_DECLARED_OUTPUTS];
// Have they used the tangent input semantic (i.e. is g_pTangentAttributeName declared)?
bool m_bTangentInputUsed;
private:
// Utilities to aid in decoding token stream
uint32 GetNextToken( void );
void SkipTokens( uint32 numToSkip );
uint32 Opcode( uint32 dwToken );
uint32 OpcodeSpecificData( uint32 dwToken );
uint32 TextureType ( uint32 dwToken );
uint32 GetRegType( uint32 dwRegToken );
// Write to the different buffers.
void StrcatToHeaderCode( const char *pBuf );
void StrcatToALUCode( const char *pBuf );
void StrcatToParamCode( const char *pBuf );
void StrcatToAttribCode( const char *pBuf );
// This helps write the token hex codes into the output stream for debugging.
void AddTokenHexCodeToBuffer( char *pBuffer, int nSize, int nLastStrlen );
void RecordInputAndOutputPositions();
void AddTokenHexCode();
// Utilities for decoding tokens in to strings according to ASM syntax
void PrintOpcode( uint32 inst, char* buff, int nBufLen );
// fSemanticFlags is SEMANTIC_INPUT or SEMANTIC_OUTPUT.
void PrintUsageAndIndexToString( uint32 dwToken, char* strUsageUsageIndexName, int nBufLen, int fSemanticFlags );
CUtlString GetUsageAndIndexString( uint32 dwToken, int fSemanticFlags );
CUtlString GetParameterString( uint32 dwToken, uint32 dwSourceOrDest, bool bForceScalarSource, int *pARLDestReg );
const char* GetGLSLOperatorString( uint32 inst );
void PrintParameterToString ( uint32 dwToken, uint32 dwSourceOrDest, char *pRegisterName, int nBufLen, bool bForceScalarSource, int *pARLDestReg );
void InsertMoveFromAddressRegister( CUtlBuffer *pCode, int nARLComp0, int nARLComp1, int nARLComp2 = ARL_DEST_NONE );
void InsertMoveInstruction( CUtlBuffer *pCode, int nARLComponent );
void FlagIndirectRegister( uint32 dwToken, int *pARLDestReg );
// Utilities for decoding tokens in to strings according to GLSL syntax
bool OpenIntrinsic( uint32 inst, char* buff, int nBufLen, uint32 destDimension, uint32 nArgumentDimension );
void PrintIndentation( char *pBuf, int nBufLen );
uint32 MaintainAttributeMap( uint32 dwToken, uint32 dwRegToken );
CUtlString FixGLSLSwizzle( const char *pDestRegisterName, const char *pSrcRegisterName );
void WriteGLSLCmp( const char *pDestReg, const char *pSrc0Reg, const char *pSrc1Reg, const char *pSrc2Reg );
void WriteGLSLSamplerDefinitions();
void WriteGLSLOutputVariableAssignments();
void NoteTangentInputUsed();
void Handle_DCL();
void Handle_DEF();
void Handle_MAD( uint32 nInstruction );
void Handle_DP2ADD();
void Handle_SINCOS();
void Handle_LRP( uint32 nInstruction );
void Handle_TEX( uint32 dwToken, bool bIsTexLDL );
void Handle_TexLDD( uint32 nInstruction );
void Handle_TexCoord();
void Handle_UnaryOp( uint32 nInstruction );
void HandleBinaryOp_GLSL( uint32 nInstruction );
void HandleBinaryOp_ASM( uint32 nInstruction );
void Handle_CMP();
void Handle_NRM();
void Handle_DeclarativeNonDclOp( uint32 nInstruction );
public:
D3DToGL();
int TranslateShader( uint32* code, CUtlBuffer *pBufDisassembledCode, bool *bVertexShader, uint32 options, int32 nShadowDepthSampler, uint32 nCentroidMask, char *debugLabel );
};
#endif // DX9_ASM_TO_GL_2_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
#ifndef GLMDEBUG_H
#define GLMDEBUG_H
// include this anywhere you need to be able to compile-out code related specifically to GLM debugging.
// we expect DEBUG to be driven by the build system so you can include this header anywhere.
// when we come out, GLMDEBUG will be defined to a value - 0, 1, or 2
// 0 means no GLM debugging is possible
// 1 means it's possible and resulted from being a debug build
// 2 means it's possible and resulted from being manually forced on for a release build
#ifdef POSIX
#ifndef GLMDEBUG
#ifdef DEBUG
#define GLMDEBUG 1 // normally 1 here, testing
#else
// #define GLMDEBUG 2 // don't check this in enabled..
#endif
#ifndef GLMDEBUG
#define GLMDEBUG 0
#endif
#endif
#else
#ifndef GLMDEBUG
#define GLMDEBUG 0
#endif
#endif
// helpful macro if you are in a position to call GLM functions directly (i.e. you live in materialsystem / shaderapidx9)
#if GLMDEBUG
#define GLMPRINTF(args) GLMPrintf args
#define GLMPRINTSTR(args) GLMPrintStr args
#define GLMPRINTTEXT(args) GLMPrintText args
#define GLMBEGINPIXEVENT(args) GLMBeginPIXEvent args
#define GLMENDPIXEVENT(args) GLMEndPIXEvent args
#else
#define GLMPRINTF(args)
#define GLMPRINTSTR(args)
#define GLMPRINTTEXT(args)
#define GLMBEGINPIXEVENT(args)
#define GLMENDPIXEVENT(args)
#endif
#endif

View File

@ -0,0 +1,275 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// glmdisplay.h
// display related stuff - used by both GLMgr and the CocoaMgr
//
//===============================================================================
#ifndef GLMDISPLAY_H
#define GLMDISPLAY_H
#pragma once
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#include <OpenGL/CGLTypes.h>
#include <OpenGL/CGLRenderers.h>
#include <OpenGL/CGLCurrent.h>
#include <ApplicationServices/ApplicationServices.h>
#include "glmgrbasics.h"
typedef void _PseudoNSGLContext; // aka NSOpenGLContext
typedef _PseudoNSGLContext *PseudoNSGLContextPtr;
struct GLMDisplayModeInfoFields
{
uint m_modePixelWidth;
uint m_modePixelHeight;
uint m_modeRefreshHz;
// are we even going to talk about bit depth... not yet
};
struct GLMDisplayInfoFields
{
CGDirectDisplayID m_cgDisplayID;
CGOpenGLDisplayMask m_glDisplayMask; // result of CGDisplayIDToOpenGLDisplayMask on the cg_displayID.
uint m_displayPixelWidth;
uint m_displayPixelHeight;
};
struct GLMRendererInfoFields
{
/*properties of interest and their desired values.
kCGLRPFullScreen = 54, true
kCGLRPAccelerated = 73, true
kCGLRPWindow = 80, true
kCGLRPRendererID = 70, informational
kCGLRPDisplayMask = 84, informational
kCGLRPBufferModes = 100, informational
kCGLRPColorModes = 103, informational
kCGLRPAccumModes = 104, informational
kCGLRPDepthModes = 105, informational
kCGLRPStencilModes = 106, informational
kCGLRPMaxAuxBuffers = 107, informational
kCGLRPMaxSampleBuffers = 108, informational
kCGLRPMaxSamples = 109, informational
kCGLRPSampleModes = 110, informational
kCGLRPSampleAlpha = 111, informational
kCGLRPVideoMemory = 120, informational
kCGLRPTextureMemory = 121, informational
kCGLRPRendererCount = 128 number of renderers in the CGLRendererInfoObj under examination
kCGLRPOffScreen = 53, D/C
kCGLRPRobust = 75, FALSE or D/C - aka we're asking for no-fallback
kCGLRPBackingStore = 76, D/C
kCGLRPMPSafe = 78, D/C
kCGLRPMultiScreen = 81, D/C
kCGLRPCompliant = 83, D/C
*/
//--------------------------- info we have from CGL renderer queries, IOKit, Gestalt
//--------------------------- these are set up in the displayDB by CocoaMgr
GLint m_fullscreen;
GLint m_accelerated;
GLint m_windowed;
GLint m_rendererID;
GLint m_displayMask;
GLint m_bufferModes;
GLint m_colorModes;
GLint m_accumModes;
GLint m_depthModes;
GLint m_stencilModes;
GLint m_maxAuxBuffers;
GLint m_maxSampleBuffers;
GLint m_maxSamples;
GLint m_sampleModes;
GLint m_sampleAlpha;
GLint m_vidMemory;
GLint m_texMemory;
uint m_pciVendorID;
uint m_pciDeviceID;
char m_pciModelString[64];
char m_driverInfoString[64];
//--------------------------- OS version related - set up by CocoaMgr
// OS version found
uint m_osComboVersion; // 0x00XXYYZZ : XX major, YY minor, ZZ minor minor : 10.6.3 --> 0x000A0603. 10.5.8 --> 0x000A0508.
//--------------------------- shorthands - also set up by CocoaMgr - driven by vendorid / deviceid
bool m_ati;
bool m_atiR5xx;
bool m_atiR6xx;
bool m_atiR7xx;
bool m_atiR8xx;
bool m_atiNewer;
bool m_intel;
bool m_intel95x;
bool m_intel3100;
bool m_intelNewer;
bool m_nv;
bool m_nvG7x;
bool m_nvG8x;
bool m_nvNewer;
//--------------------------- context query results - left blank in the display DB - but valid in a GLMContext (call ctx->Caps() to get a const ref)
// booleans
bool m_hasGammaWrites; // aka glGetBooleanv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT) / glEnable(GL_FRAMEBUFFER_SRGB_EXT)
bool m_hasMixedAttachmentSizes; // aka ARB_fbo in 10.6.3 - test for min OS vers, then exported ext string
bool m_hasBGRA; // aka GL_BGRA vertex attribs in 10.6.3 - - test for min OS vers, then exported ext string
bool m_hasNewFullscreenMode; // aka 10.6.x "big window" fullscreen mode
bool m_hasNativeClipVertexMode; // aka GLSL gl_ClipVertex does not fall back to SW- OS version and folklore-based
bool m_hasOcclusionQuery; // occlusion query: do you speak it ?!
bool m_hasFramebufferBlit; // framebuffer blit: know what I'm sayin?!
bool m_hasPerfPackage1; // means new MTGL, fast OQ, fast uniform upload, NV can resolve flipped (late summer 2010 post 10.6.4 update)
// counts
int m_maxAniso; // aniso limit - context query
// other exts
bool m_hasBindableUniforms;
bool m_hasUniformBuffers;
// runtime options that aren't negotiable once set
bool m_hasDualShaders; // must supply CLI arg "-glmdualshaders" or we go GLSL only
//--------------------------- " can'ts " - specific problems that need to be worked around
bool m_cantBlitReliably; // Intel chipsets have problems blitting sRGB sometimes
bool m_cantAttachSRGB; // NV G8x on 10.5.8 can't have srgb tex on FBO color - separate issue from hasGammaWrites
bool m_cantResolveFlipped; // happens on NV in 10.6.4 and prior - console variable "gl_can_resolve_flipped" can overrule
bool m_cantResolveScaled; // happens everywhere per GL spec but may be relaxed some day - console variable "gl_can_resolve_scaled" can overrule
bool m_costlyGammaFlips; // this means that sRGB sampling state affects shader code gen, resulting in state-dependent code regen
//--------------------------- " bads " - known bad drivers
bool m_badDriver1064NV; // this is the bad NVIDIA driver on 10.6.4 - stutter, tex corruption, black screen issues
};
////////////////////////////////////////////////////////////////////////////////////////
// this stuff is all sitting in glmgrcocoa.mm since it needs to make ObjC calls.
//===============================================================================
// modes, displays, and renderers
// think of renderers as being at the top of a tree.
// each renderer has displays hanging off of it.
// each display has modes hanging off of it.
// the tree is populated on demand and then queried as needed.
//===============================================================================
// GLMDisplayModeInfoFields is in glmdisplay.h
class GLMDisplayMode
{
public:
GLMDisplayModeInfoFields m_info;
GLMDisplayMode( uint width, uint height, uint refreshHz );
~GLMDisplayMode( void );
void Dump( int which );
};
//===============================================================================
// GLMDisplayInfoFields is in glmdisplay.h
class GLMDisplayInfo
{
public:
GLMDisplayInfoFields m_info;
std::vector< GLMDisplayMode* > *m_modes; // starts out NULL, set by PopulateModes
GLMDisplayInfo( CGDirectDisplayID displayID, CGOpenGLDisplayMask displayMask );
~GLMDisplayInfo( void );
void PopulateModes( void );
void Dump( int which );
};
//===============================================================================
// GLMRendererInfoFields is in glmdisplay.h
class GLMRendererInfo
{
public:
GLMRendererInfoFields m_info;
std::vector< GLMDisplayInfo* > *m_displays; // starts out NULL, set by PopulateDisplays
GLMRendererInfo ( GLMRendererInfoFields *info );
~GLMRendererInfo ( void );
void PopulateDisplays( void );
void Dump( int which );
};
//===============================================================================
// this is just a tuple describing fake adapters which are really renderer/display pairings.
// dxabstract bridges the gap between the d3d adapter-centric world and the GL renderer+display world.
// this makes it straightforward to handle cases like two video cards with two displays on one, and one on the other -
// you get three fake adapters which represent each useful screen.
// the constraint that dxa will have to follow though, is that if the user wants to change their
// display selection for full screen, they would only be able to pick on that has the same underlying renderer.
// can't change fakeAdapter from one to another with different GL renderer under it. Screen hop but no card hop.
struct GLMFakeAdapter
{
int m_rendererIndex;
int m_displayIndex;
};
class GLMDisplayDB
{
public:
std::vector< GLMRendererInfo* > *m_renderers; // starts out NULL, set by PopulateRenderers
std::vector< GLMFakeAdapter > m_fakeAdapters;
GLMDisplayDB ( void );
~GLMDisplayDB ( void );
virtual void PopulateRenderers( void );
virtual void PopulateFakeAdapters( uint realRendererIndex ); // fake adapters = one real adapter times however many displays are on it
virtual void Populate( void );
// The info-get functions return false on success.
virtual int GetFakeAdapterCount( void );
virtual bool GetFakeAdapterInfo( int fakeAdapterIndex, int *rendererOut, int *displayOut, GLMRendererInfoFields *rendererInfoOut, GLMDisplayInfoFields *displayInfoOut );
virtual int GetRendererCount( void );
virtual bool GetRendererInfo( int rendererIndex, GLMRendererInfoFields *infoOut );
virtual int GetDisplayCount( int rendererIndex );
virtual bool GetDisplayInfo( int rendererIndex, int displayIndex, GLMDisplayInfoFields *infoOut );
virtual int GetModeCount( int rendererIndex, int displayIndex );
virtual bool GetModeInfo( int rendererIndex, int displayIndex, int modeIndex, GLMDisplayModeInfoFields *infoOut );
virtual void Dump( void );
};
#endif

File diff suppressed because it is too large Load Diff

1031
My project/sdk/glmgr/glmgr.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,512 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// glmgrbasics.h
// types, common headers, forward declarations, utilities
//
//===============================================================================
#ifndef GLMBASICS_H
#define GLMBASICS_H
#pragma once
#include <string>
#include <set>
#include <map>
#include <vector>
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#include <OpenGL/CGLTypes.h>
#include <OpenGL/CGLRenderers.h>
#include <OpenGL/CGLCurrent.h>
//#include <OpenGL/CGLProfiler.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ApplicationServices/ApplicationServices.h>
#include "imageformat.h"
#include "glmdebug.h"
#ifndef Assert
#define Assert(x)
#endif
//===============================================================================
// some portability shims to eliminate dependencies on partcular segments of Valve code
typedef int8_t int8;
typedef uint8_t uint8;
typedef int16_t int16;
typedef uint16_t uint16;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
class CUtlBuffer
{
public:
enum BufferFlags_t
{
TEXT_BUFFER = 0x1, // Describes how get + put work (as strings, or binary)
//EXTERNAL_GROWABLE = 0x2, // This is used w/ external buffers and causes the utlbuf to switch to reallocatable memory if an overflow happens when Putting.
//CONTAINS_CRLF = 0x4, // For text buffers only, does this contain \n or \n\r?
//READ_ONLY = 0x8, // For external buffers; prevents null termination from happening.
//AUTO_TABS_DISABLED = 0x10, // Used to disable/enable push/pop tabs
};
CUtlBuffer( int growSize = 0, int initSize = 0, int nFlags = 0 )
{
// grow size and init flags are ignored.
m_buf.reserve( initSize );
};
CUtlBuffer( const void* pBuffer, int size, int nFlags = 0 )
{
m_buf.reserve ( size );
memcpy( &m_buf[0], pBuffer, size );
}
// This one isn't actually defined so that we catch contructors that are trying to pass a bool in as the third param.
CUtlBuffer( const void *pBuffer, int size, bool crap );
~CUtlBuffer()
{
}
char* Base( void )
{
return &m_buf[0];
}
uint32 Size( void )
{
return m_buf.size();
}
void EnsureCapacity( int num )
{
m_buf.resize( num );
}
void AppendString( const char* pString )
{
int appendlen = strlen( pString ); // count of characters, null terminator not included
if (Size())
{
// append to non empty string
EnsureCapacity( Size() + appendlen + 1);
//printf("\n **(a) appending \n---\n%s\n---\n to \n---\n%s\n---\n", pString, Base() );
strcat( Base(), pString ); // gets NULL terminated
}
else
{
EnsureCapacity( Size() + appendlen + 1);
//printf("\n **(b) appending \n---\n%s\n---\n to \n---\n%s\n---\n", pString, Base() );
strcpy( Base(), pString );
}
}
private:
CUtlBuffer();
std::vector<char> m_buf;
};
class CUtlString
{
public:
CUtlString()
{
m_str = "";
}
CUtlString( const char *str )
{
m_str = std::string( str );
}
~CUtlString( )
{
}
const char* String( void )
{
return m_str.c_str();
}
operator const char * () { return m_str.c_str(); } //conversion operator
private:
std::string m_str;
};
#undef ARRAYSIZE
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
#define strcat_s(dst,lim,src) strcat(dst,src )
#define V_strcat(dst,lim,src) strcat(dst,src)
#define V_vsnprintf(a,b,c,d) vsprintf(a,c,d) // double check this
#define V_snprintf snprintf
#define V_strncpy strncpy
#define V_strcmp strcmp
#define V_strlen strlen
#define V_strstr strstr
#define __cdecl
#define V_memset(dst,count,val) memset(dst,count,val)
int V_stricmp(const char *s1, const char *s2 );
char const* V_stristr( char const* pStr, char const* pSearch );
//===============================================================================
// types
// 3-d integer box (used for texture lock/unlock etc)
struct GLMRegion
{
int xmin,xmax;
int ymin,ymax;
int zmin,zmax;
};
struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's
{
int xmin; // left
int ymin; // bottom
int xmax; // right
int ymax; // top
};
// macros
//#define GLMassert(x) assert(x)
// forward decls
class GLMgr; // singleton
class GLMContext; // GL context
class CGLMContextTester; // testing class
class CGLMTex;
class CGLMFBO;
class CGLMProgram;
class CGLMBuffer;
// utilities
typedef enum
{
// D3D codes
eD3D_DEVTYPE,
eD3D_FORMAT,
eD3D_RTYPE,
eD3D_USAGE,
eD3D_RSTATE, // render state
eD3D_SIO, // D3D shader bytecode
eD3D_VTXDECLUSAGE,
// CGL codes
eCGL_RENDID,
// OpenGL error codes
eGL_ERROR,
// OpenGL enums
eGL_ENUM,
eGL_RENDERER
} GLMThing_t;
const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const
const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask
void GLMStop( void ); // aka Debugger()
void GLMCheckError( bool noStop = false, bool noLog= false );
void GLMEnableTrace( bool on );
//===============================================================================
// debug channels
enum EGLMDebugChannel
{
ePrintf,
eDebugger,
eGLProfiler
};
#if GLMDEBUG
// make all these prototypes disappear in non GLMDEBUG
void GLMDebugInitialize( bool forceReinit=false );
bool GLMDetectOGLP( void );
bool GLMDetectGDB( void );
uint GLMDetectAvailableChannels( void );
uint GLMDebugChannelMask( uint *newValue = NULL );
// note that GDB and OGLP can both come and go during run - forceCheck will allow that to be detected.
// mask returned is in form of 1<<n, n from EGLMDebugChannel
#endif
//===============================================================================
// debug message flavors
enum EGLMDebugFlavor
{
eAllFlavors, // 0
eDebugDump, // 1 debug dump flavor -D-
eTenure, // 2 code tenures > <
eComment, // 3 one off messages ---
eMatrixData, // 4 matrix data -M-
eShaderData, // 5 shader data (params) -S-
eFrameBufData, // 6 FBO data (attachments) -F-
eDXStuff, // 7 dxabstract spew -X-
eAllocations, // 8 tracking allocs and frees -A-
eSlowness, // 9 slow things happening (srgb flips..) -Z-
eDefaultFlavor, // not specified (no marker)
eFlavorCount
};
uint GLMDebugFlavorMask( uint *newValue = NULL );
//===============================================================================
// output functions
// make all these prototypes disappear in non GLMDEBUG
#if GLMDEBUG
// these are unconditional outputs, they don't interrogate the string
void GLMStringOut( const char *string );
void GLMStringOutIndented( const char *string, int indentColumns );
// these will look at the string to guess its flavor: <, >, ---, -M-, -S-
void GLMPrintfVA( const char *fmt, va_list vargs );
void GLMPrintf( const char *fmt, ... );
// these take an explicit flavor with a default value
void GLMPrintStr( const char *str, EGLMDebugFlavor flavor = eDefaultFlavor );
#define GLMPRINTTEXT_NUMBEREDLINES 0x80000000
void GLMPrintText( const char *str, EGLMDebugFlavor flavor = eDefaultFlavor, uint options=0 ); // indent each newline
int GLMIncIndent( int indentDelta );
int GLMGetIndent( void );
void GLMSetIndent( int indent );
#endif
// expose these in release now
// Mimic PIX events so we can decorate debug spew
void GLMBeginPIXEvent( const char *str );
void GLMEndPIXEvent( void );
//===============================================================================
// other stuff
#if GLMDEBUG
inline void GLMDebugger( void )
{
if (GLMDebugChannelMask() & (1<<eDebugger))
{
#if defined( OSX ) && defined( __aarch64__ )
__builtin_debugtrap();
#else
asm ( "int $3" );
#endif
}
if (GLMDebugChannelMask() & (1<<eGLProfiler))
{
// we call an obscure GL function which we know has been breakpointed in the OGLP function list
static short nada[] = { -1, -1, -1, -1 };
glColor4sv( nada );
}
}
#else
#define GLMDebugger()
#endif
// helpers for CGLSetOption - no op if no profiler
void GLMProfilerClearTrace( void );
void GLMProfilerEnableTrace( bool enable );
// helpers for CGLSetParameter - no op if no profiler
void GLMProfilerDumpState( void );
//===============================================================================
// classes
// helper class making function tracking easier to wire up
#if GLMDEBUG
class GLMFuncLogger
{
public:
// simple function log
GLMFuncLogger( const char *funcName )
{
m_funcName = funcName;
m_earlyOut = false;
GLMPrintf( ">%s", m_funcName );
};
// more advanced version lets you pass args (i.e. called parameters or anything else of interest)
// no macro for this one, since no easy way to pass through the args as well as the funcname
GLMFuncLogger( const char *funcName, char *fmt, ... )
{
m_funcName = funcName;
m_earlyOut = false;
// this acts like GLMPrintf here
// all the indent policy is down in GLMPrintfVA
// which means we need to inject a ">" at the front of the format string to make this work... sigh.
char modifiedFmt[2000];
modifiedFmt[0] = '>';
strcpy( modifiedFmt+1, fmt );
va_list vargs;
va_start(vargs, fmt);
GLMPrintfVA( modifiedFmt, vargs );
va_end( vargs );
}
~GLMFuncLogger( )
{
if (m_earlyOut)
{
GLMPrintf( "<%s (early out)", m_funcName );
}
else
{
GLMPrintf( "<%s", m_funcName );
}
};
void EarlyOut( void )
{
m_earlyOut = true;
};
const char *m_funcName; // set at construction time
bool m_earlyOut;
};
// handy macro to go with the function tracking class
#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ )
#else
#define GLM_FUNC
#endif
// class to keep an in-memory mirror of a file which may be getting edited during run
class CGLMFileMirror
{
public:
CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read.
//if non existent it will be created with size zero
~CGLMFileMirror( );
bool HasData( void ); // see if data avail
void GetData( char **dataPtr, uint *dataSizePtr ); // read it out
void SetData( char *data, uint dataSize ); // put data in (and write it to disk)
bool PollForChanges( void ); // check disk copy. If different, read it back in and return true.
void UpdateStatInfo( void ); // make sure stat info is current for our file
void ReadFile( void );
void WriteFile( void );
void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground
/// how about a "wait for change" method..
char *m_path; // fullpath to file
bool m_exists;
struct stat m_stat; // stat results for the file (last time checked)
char *m_data; // content of file
uint m_size; // length of content
};
// class based on the file mirror, that makes it easy to edit them outside the app.
// it receives an initial block of text from the engine, and hashes it. ("orig")
// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged")
// a mirror file is activated, using a filename based on the hash from the orig text.
// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set.
// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text)
#ifndef MD5_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH 16
#endif
class CGLMEditableTextItem
{
public:
CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix
~CGLMEditableTextItem( );
bool HasData( void );
bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition
void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy)
void OpenInEditor( bool foreground=false ); // call user attention to this text
// internal methods
void GenHashOfOrigText( void );
void GenBaseNameAndFullPath( char *prefix, char *suffix );
void GenMungedText( bool fromMirror );
// members
// orig
uint m_origSize;
char *m_origText; // what was submitted
unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted
// munged
uint m_mungedSize;
char *m_mungedText; // re-processed edition, initial content submission to the file mirror
// mirror
char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix
char *m_mirrorFullPath; // base name
CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return.
};
// debug font
extern unsigned char g_glmDebugFontMap[16384];
// class for cracking multi-part text blobs
// sections are demarcated by beginning-of-line markers submitted in a table by the caller
struct GLMTextSection
{
int m_markerIndex; // based on table of markers passed in to constructor
uint m_textOffset; // where is the text - offset
int m_textLength; // how big is the section
};
class CGLMTextSectioner
{
public:
CGLMTextSectioner( const char *text, int textSize, const char **markers ); // constructor finds all the sections
~CGLMTextSectioner( );
int Count( void ); // how many sections found
void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut );
// find section, size, what marker
// note that more than one section can be marked similarly.
// so policy isn't made here, you walk the sections and decide what to do if there are dupes.
//members
//section table
std::vector< GLMTextSection > m_sectionTable;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,107 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// glmgrext.h
// helper file for extension testing and runtime importing of entry points
//
//===============================================================================
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#include <mach-o/dyld.h>
#include <stdlib.h>
#include <string.h>
#include "glmgr.h"
PFNglColorMaskIndexedEXT pfnglColorMaskIndexedEXT;
PFNglEnableIndexedEXT pfnglEnableIndexedEXT;
PFNglDisableIndexedEXT pfnglDisableIndexedEXT;
PFNglGetFramebufferAttachmentParameteriv pfnglGetFramebufferAttachmentParameteriv;
PFNglUniformBufferEXT pfnglUniformBufferEXT;
// NSSymbol was deprecated in 10.5.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
void * NSGLGetProcAddress (const char *name)
{
NSSymbol symbol;
char *symbolName = (char *)malloc (strlen (name) + 2);
strcpy(symbolName + 1, name);
symbolName[0] = '_';
symbol = NULL;
if (NSIsSymbolNameDefined (symbolName))
symbol = NSLookupAndBindSymbol (symbolName);
free (symbolName);
return symbol ? NSAddressOfSymbol (symbol) : NULL;
}
#pragma clang diagnostic pop
void GLMSetupExtensions( void )
{
pfnglColorMaskIndexedEXT = (PFNglColorMaskIndexedEXT) NSGLGetProcAddress( "glColorMaskIndexedEXT" );
pfnglEnableIndexedEXT = (PFNglEnableIndexedEXT) NSGLGetProcAddress( "glEnableIndexedEXT" );
pfnglDisableIndexedEXT = (PFNglDisableIndexedEXT) NSGLGetProcAddress( "glDisableIndexedEXT" );
pfnglGetFramebufferAttachmentParameteriv = (PFNglGetFramebufferAttachmentParameteriv) NSGLGetProcAddress( "glGetFramebufferAttachmentParameteriv" );
pfnglUniformBufferEXT = (PFNglUniformBufferEXT) NSGLGetProcAddress( "glUniformBufferEXT" );
}
/*
#define INSTANTIATE_GL_IMPORTS
#include "glmgr.h" // will include glmgrext.h
#undef INSTANTIATE_GL_IMPORTS
// helper class for looking up function names
// see http://andrewtolbert.com/svn/personal/OpenGLSuperBible/shared/gltools.cpp
// also http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_entrypts/opengl_entrypts.html
class CFunctionImporter
{
public:
CFBundleRef m_bundle;
CFunctionImporter( CFStringRef bundleID ) // for example CFSTR("com.apple.OpenGL")
{
m_bundle = CFBundleGetBundleWithIdentifier( bundleID );
if ( m_bundle )
CFRetain( m_bundle );
}
~CFunctionImporter()
{
if( m_bundle )
{
CFRelease(m_bundle);
m_bundle = NULL;
}
}
void *FindFunctionByName(CFStringRef name) // ex CFSTR("glColorMaskedIndexedEXT")
{
void *result = NULL;
if (m_bundle)
{
result = CFBundleGetFunctionPointerForName(m_bundle, name);
}
return result;
}
};
void GLMSetupExtensions( void )
{
CFunctionImporter importer( CFSTR("com.apple.OpenGL") );
#define DO_IMPORT(name) name = (name##FuncPtr)importer.FindFunctionByName( CFSTR(#name) );
#ifndef GL_EXT_draw_buffers2
// FIXME we're not checking for the extension string yet, we're just grabbing func ptrs
DO_IMPORT(glColorMaskIndexedEXT);
DO_IMPORT(glEnableIndexedEXT);
DO_IMPORT(glDisableIndexedEXT);
#endif
}
*/

View File

@ -0,0 +1,101 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// glmgrext.h
// helper file for extension testing and runtime importing of entry points
//
//===============================================================================
#pragma once
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
// #define symbol INSTANTIATE_GL_IMPORTS controls whether the following macro "GL_IMPORT" writes externs or writes decls
// normally only glmgr.cpp sets that symbol and includes this file
// to simplify usage, a function ptr type must exist for every entry point, following the name##FuncPtr convention.
#ifdef INSTANTIATE_GL_IMPORTS
#define GL_IMPORT( name ) name##FuncPtr name = 0
#else
#define GL_IMPORT( name ) extern name##FuncPtr name;
#endif
// before declaring each import, check to see if the EXT symbol is in effect,
// and if so, don't do it!
#ifndef GL_EXT_draw_buffers2
typedef void (* glColorMaskIndexedEXTFuncPtr) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef void (* glEnableIndexedEXTFuncPtr) (GLenum target, GLuint index);
typedef void (* glDisableIndexedEXTFuncPtr) (GLenum target, GLuint index);
GL_IMPORT(glColorMaskIndexedEXT);
GL_IMPORT(glEnableIndexedEXT);
GL_IMPORT(glDisableIndexedEXT);
#endif
#ifndef GL_EXT_framebuffer_sRGB
#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
#endif
#ifndef ARB_texture_rg
#define GL_COMPRESSED_RED 0x8225
#define GL_COMPRESSED_RG 0x8226
#define GL_RG 0x8227
#define GL_RG_INTEGER 0x8228
#define GL_R8 0x8229
#define GL_R16 0x822A
#define GL_RG8 0x822B
#define GL_RG16 0x822C
#define GL_R16F 0x822D
#define GL_R32F 0x822E
#define GL_RG16F 0x822F
#define GL_RG32F 0x8230
#define GL_R8I 0x8231
#define GL_R8UI 0x8232
#define GL_R16I 0x8233
#define GL_R16UI 0x8234
#define GL_R32I 0x8235
#define GL_R32UI 0x8236
#define GL_RG8I 0x8237
#define GL_RG8UI 0x8238
#define GL_RG16I 0x8239
#define GL_RG16UI 0x823A
#define GL_RG32I 0x823B
#define GL_RG32UI 0x823C
#endif
#ifndef GL_EXT_bindable_uniform
#define GL_UNIFORM_BUFFER_EXT 0x8DEE
#endif
// unpublished extension enums (thus the "X")
// from EXT_framebuffer_multisample_blit_scaled..
#define XGL_SCALED_RESOLVE_FASTEST_EXT 0x90BA
#define XGL_SCALED_RESOLVE_NICEST_EXT 0x90BB
void * NSGLGetProcAddress (const char *name);
// call this to find all the entry points.
void GLMSetupExtensions( void );
typedef void (*PFNglColorMaskIndexedEXT)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef void (*PFNglEnableIndexedEXT)(GLenum target, GLuint index);
typedef void (*PFNglDisableIndexedEXT)(GLenum target, GLuint index);
typedef void (*PFNglUniformBufferEXT)(GLuint program, GLint location, GLuint buffer);
extern PFNglColorMaskIndexedEXT pfnglColorMaskIndexedEXT;
extern PFNglEnableIndexedEXT pfnglEnableIndexedEXT;
extern PFNglDisableIndexedEXT pfnglDisableIndexedEXT;
extern PFNglUniformBufferEXT pfnglUniformBufferEXT;
typedef void (*PFNglGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
extern PFNglGetFramebufferAttachmentParameteriv pfnglGetFramebufferAttachmentParameteriv;

View File

@ -0,0 +1,523 @@
//===== Copyright 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
//===========================================================================//
#ifndef IMAGEFORMAT_H
#define IMAGEFORMAT_H
#ifdef _WIN32
#pragma once
#endif
#include <stdio.h>
enum NormalDecodeMode_t
{
NORMAL_DECODE_NONE = 0,
NORMAL_DECODE_ATI2N = 1,
NORMAL_DECODE_ATI2N_ALPHA = 2
};
// Forward declaration
#ifdef _WIN32
typedef enum _D3DFORMAT D3DFORMAT;
#endif
//-----------------------------------------------------------------------------
// The various image format types
//-----------------------------------------------------------------------------
// don't bitch that inline functions aren't used!!!!
#pragma warning(disable : 4514)
enum ImageFormat
{
IMAGE_FORMAT_UNKNOWN = -1,
IMAGE_FORMAT_RGBA8888 = 0,
IMAGE_FORMAT_ABGR8888,
IMAGE_FORMAT_RGB888,
IMAGE_FORMAT_BGR888,
IMAGE_FORMAT_RGB565,
IMAGE_FORMAT_I8,
IMAGE_FORMAT_IA88,
IMAGE_FORMAT_P8,
IMAGE_FORMAT_A8,
IMAGE_FORMAT_RGB888_BLUESCREEN,
IMAGE_FORMAT_BGR888_BLUESCREEN,
IMAGE_FORMAT_ARGB8888,
IMAGE_FORMAT_BGRA8888,
IMAGE_FORMAT_DXT1,
IMAGE_FORMAT_DXT3,
IMAGE_FORMAT_DXT5,
IMAGE_FORMAT_BGRX8888,
IMAGE_FORMAT_BGR565,
IMAGE_FORMAT_BGRX5551,
IMAGE_FORMAT_BGRA4444,
IMAGE_FORMAT_DXT1_ONEBITALPHA,
IMAGE_FORMAT_BGRA5551,
IMAGE_FORMAT_UV88,
IMAGE_FORMAT_UVWQ8888,
IMAGE_FORMAT_RGBA16161616F,
IMAGE_FORMAT_RGBA16161616,
IMAGE_FORMAT_UVLX8888,
IMAGE_FORMAT_R32F, // Single-channel 32-bit floating point
IMAGE_FORMAT_RGB323232F,
IMAGE_FORMAT_RGBA32323232F,
// Depth-stencil texture formats for shadow depth mapping
IMAGE_FORMAT_NV_DST16, //
IMAGE_FORMAT_NV_DST24, //
IMAGE_FORMAT_NV_INTZ, // Vendor-specific depth-stencil texture
IMAGE_FORMAT_NV_RAWZ, // formats for shadow depth mapping
IMAGE_FORMAT_ATI_DST16, //
IMAGE_FORMAT_ATI_DST24, //
IMAGE_FORMAT_NV_NULL, // Dummy format which takes no video memory
// Compressed normal map formats
IMAGE_FORMAT_ATI2N, // One-surface ATI2N / DXN format
IMAGE_FORMAT_ATI1N, // Two-surface ATI1N format
#if defined( _X360 )
// Depth-stencil texture formats
IMAGE_FORMAT_X360_DST16,
IMAGE_FORMAT_X360_DST24,
IMAGE_FORMAT_X360_DST24F,
// supporting these specific formats as non-tiled for procedural cpu access
IMAGE_FORMAT_LINEAR_BGRX8888,
IMAGE_FORMAT_LINEAR_RGBA8888,
IMAGE_FORMAT_LINEAR_ABGR8888,
IMAGE_FORMAT_LINEAR_ARGB8888,
IMAGE_FORMAT_LINEAR_BGRA8888,
IMAGE_FORMAT_LINEAR_RGB888,
IMAGE_FORMAT_LINEAR_BGR888,
IMAGE_FORMAT_LINEAR_BGRX5551,
IMAGE_FORMAT_LINEAR_I8,
IMAGE_FORMAT_LINEAR_RGBA16161616,
IMAGE_FORMAT_LE_BGRX8888,
IMAGE_FORMAT_LE_BGRA8888,
#endif
NUM_IMAGE_FORMATS
};
#if defined( POSIX ) || defined( DX_TO_GL_ABSTRACTION )
typedef enum _D3DFORMAT
{
D3DFMT_INDEX16,
D3DFMT_D16,
D3DFMT_D24S8,
D3DFMT_A8R8G8B8,
D3DFMT_A4R4G4B4,
D3DFMT_X8R8G8B8,
D3DFMT_R5G6R5,
D3DFMT_X1R5G5B5,
D3DFMT_A1R5G5B5,
D3DFMT_L8,
D3DFMT_A8L8,
D3DFMT_A,
D3DFMT_DXT1,
D3DFMT_DXT3,
D3DFMT_DXT5,
D3DFMT_V8U8,
D3DFMT_Q8W8V8U8,
D3DFMT_X8L8V8U8,
D3DFMT_A16B16G16R16F,
D3DFMT_A16B16G16R16,
D3DFMT_R32F,
D3DFMT_A32B32G32R32F,
D3DFMT_R8G8B8,
D3DFMT_D24X4S4,
D3DFMT_A8,
D3DFMT_R5G6B5,
D3DFMT_D15S1,
D3DFMT_D24X8,
D3DFMT_VERTEXDATA,
D3DFMT_INDEX32,
// adding fake D3D format names for the vendor specific ones (eases debugging/logging)
// NV shadow depth tex
D3DFMT_NV_INTZ = 0x5a544e49, // MAKEFOURCC('I','N','T','Z')
D3DFMT_NV_RAWZ = 0x5a574152, // MAKEFOURCC('R','A','W','Z')
// NV null tex
D3DFMT_NV_NULL = 0x4c4c554e, // MAKEFOURCC('N','U','L','L')
// ATI shadow depth tex
D3DFMT_ATI_D16 = 0x36314644, // MAKEFOURCC('D','F','1','6')
D3DFMT_ATI_D24S8 = 0x34324644, // MAKEFOURCC('D','F','2','4')
// ATI 1N and 2N compressed tex
D3DFMT_ATI_2N = 0x32495441, // MAKEFOURCC('A', 'T', 'I', '2')
D3DFMT_ATI_1N = 0x31495441, // MAKEFOURCC('A', 'T', 'I', '1')
D3DFMT_UNKNOWN
} D3DFORMAT;
#endif
//-----------------------------------------------------------------------------
// Color structures
//-----------------------------------------------------------------------------
struct BGRA8888_t
{
unsigned char b; // change the order of names to change the
unsigned char g; // order of the output ARGB or BGRA, etc...
unsigned char r; // Last one is MSB, 1st is LSB.
unsigned char a;
inline BGRA8888_t& operator=( const BGRA8888_t& in )
{
*( unsigned int * )this = *( unsigned int * )&in;
return *this;
}
};
struct RGBA8888_t
{
unsigned char r; // change the order of names to change the
unsigned char g; // order of the output ARGB or BGRA, etc...
unsigned char b; // Last one is MSB, 1st is LSB.
unsigned char a;
inline RGBA8888_t& operator=( const BGRA8888_t& in )
{
r = in.r;
g = in.g;
b = in.b;
a = in.a;
return *this;
}
};
struct RGB888_t
{
unsigned char r;
unsigned char g;
unsigned char b;
inline RGB888_t& operator=( const BGRA8888_t& in )
{
r = in.r;
g = in.g;
b = in.b;
return *this;
}
inline bool operator==( const RGB888_t& in ) const
{
return ( r == in.r ) && ( g == in.g ) && ( b == in.b );
}
inline bool operator!=( const RGB888_t& in ) const
{
return ( r != in.r ) || ( g != in.g ) || ( b != in.b );
}
};
struct BGR888_t
{
unsigned char b;
unsigned char g;
unsigned char r;
inline BGR888_t& operator=( const BGRA8888_t& in )
{
r = in.r;
g = in.g;
b = in.b;
return *this;
}
};
// 360 uses this structure for x86 dxt decoding
#if defined( _X360 )
#pragma bitfield_order( push, lsb_to_msb )
#endif
struct BGR565_t
{
unsigned short b : 5; // order of names changes
unsigned short g : 6; // byte order of output to 32 bit
unsigned short r : 5;
inline BGR565_t& operator=( const BGRA8888_t& in )
{
r = in.r >> 3;
g = in.g >> 2;
b = in.b >> 3;
return *this;
}
inline BGR565_t &Set( int red, int green, int blue )
{
r = red >> 3;
g = green >> 2;
b = blue >> 3;
return *this;
}
};
#if defined( _X360 )
#pragma bitfield_order( pop )
#endif
struct BGRA5551_t
{
unsigned short b : 5; // order of names changes
unsigned short g : 5; // byte order of output to 32 bit
unsigned short r : 5;
unsigned short a : 1;
inline BGRA5551_t& operator=( const BGRA8888_t& in )
{
r = in.r >> 3;
g = in.g >> 3;
b = in.b >> 3;
a = in.a >> 7;
return *this;
}
};
struct BGRA4444_t
{
unsigned short b : 4; // order of names changes
unsigned short g : 4; // byte order of output to 32 bit
unsigned short r : 4;
unsigned short a : 4;
inline BGRA4444_t& operator=( const BGRA8888_t& in )
{
r = in.r >> 4;
g = in.g >> 4;
b = in.b >> 4;
a = in.a >> 4;
return *this;
}
};
struct RGBX5551_t
{
unsigned short r : 5;
unsigned short g : 5;
unsigned short b : 5;
unsigned short x : 1;
inline RGBX5551_t& operator=( const BGRA8888_t& in )
{
r = in.r >> 3;
g = in.g >> 3;
b = in.b >> 3;
return *this;
}
};
//-----------------------------------------------------------------------------
// some important constants
//-----------------------------------------------------------------------------
#define ARTWORK_GAMMA ( 2.2f )
#define IMAGE_MAX_DIM ( 2048 )
//-----------------------------------------------------------------------------
// information about each image format
//-----------------------------------------------------------------------------
struct ImageFormatInfo_t
{
char* m_pName;
int m_NumBytes;
int m_NumRedBits;
int m_NumGreeBits;
int m_NumBlueBits;
int m_NumAlphaBits;
bool m_IsCompressed:1;
bool m_IsFloat:1;
};
//-----------------------------------------------------------------------------
// Various methods related to pixelmaps and color formats
//-----------------------------------------------------------------------------
namespace ImageLoader
{
bool GetInfo( const char *fileName, int *width, int *height, enum ImageFormat *imageFormat, float *sourceGamma );
int GetMemRequired( int width, int height, int depth, ImageFormat imageFormat, bool mipmap );
int GetMipMapLevelByteOffset( int width, int height, enum ImageFormat imageFormat, int skipMipLevels, int nDepth = 1 );
void GetMipMapLevelDimensions( int *width, int *height, int skipMipLevels );
int GetNumMipMapLevels( int width, int height, int depth = 1 );
bool Load( unsigned char *imageData, const char *fileName, int width, int height, enum ImageFormat imageFormat, float targetGamma, bool mipmap );
bool Load( unsigned char *imageData, FILE *fp, int width, int height,
enum ImageFormat imageFormat, float targetGamma, bool mipmap );
// convert from any image format to any other image format.
// return false if the conversion cannot be performed.
// Strides denote the number of bytes per each line,
// by default assumes width * # of bytes per pixel
bool ConvertImageFormat( const unsigned char *src, enum ImageFormat srcImageFormat,
unsigned char *dst, enum ImageFormat dstImageFormat,
int width, int height, int srcStride = 0, int dstStride = 0 );
// must be used in conjunction with ConvertImageFormat() to pre-swap and post-swap
void PreConvertSwapImageData( unsigned char *pImageData, int nImageSize, ImageFormat imageFormat, int width = 0, int stride = 0 );
void PostConvertSwapImageData( unsigned char *pImageData, int nImageSize, ImageFormat imageFormat, int width = 0, int stride = 0 );
void ByteSwapImageData( unsigned char *pImageData, int nImageSize, ImageFormat imageFormat, int width = 0, int stride = 0 );
bool IsFormatValidForConversion( ImageFormat fmt );
//-----------------------------------------------------------------------------
// convert back and forth from D3D format to ImageFormat, regardless of
// whether it's supported or not
//-----------------------------------------------------------------------------
ImageFormat D3DFormatToImageFormat( D3DFORMAT format );
D3DFORMAT ImageFormatToD3DFormat( ImageFormat format );
// Flags for ResampleRGBA8888
enum
{
RESAMPLE_NORMALMAP = 0x1,
RESAMPLE_ALPHATEST = 0x2,
RESAMPLE_NICE_FILTER = 0x4,
RESAMPLE_CLAMPS = 0x8,
RESAMPLE_CLAMPT = 0x10,
RESAMPLE_CLAMPU = 0x20,
};
struct ResampleInfo_t
{
ResampleInfo_t() : m_nFlags(0), m_flAlphaThreshhold(0.4f), m_flAlphaHiFreqThreshhold(0.4f), m_nSrcDepth(1), m_nDestDepth(1)
{
m_flColorScale[0] = 1.0f, m_flColorScale[1] = 1.0f, m_flColorScale[2] = 1.0f, m_flColorScale[3] = 1.0f;
m_flColorGoal[0] = 0.0f, m_flColorGoal[1] = 0.0f, m_flColorGoal[2] = 0.0f, m_flColorGoal[3] = 0.0f;
}
unsigned char *m_pSrc;
unsigned char *m_pDest;
int m_nSrcWidth;
int m_nSrcHeight;
int m_nSrcDepth;
int m_nDestWidth;
int m_nDestHeight;
int m_nDestDepth;
float m_flSrcGamma;
float m_flDestGamma;
float m_flColorScale[4]; // Color scale factors RGBA
float m_flColorGoal[4]; // Color goal values RGBA DestColor = ColorGoal + scale * (SrcColor - ColorGoal)
float m_flAlphaThreshhold;
float m_flAlphaHiFreqThreshhold;
int m_nFlags;
};
bool ResampleRGBA8888( const ResampleInfo_t &info );
bool ResampleRGBA16161616( const ResampleInfo_t &info );
bool ResampleRGB323232F( const ResampleInfo_t &info );
void ConvertNormalMapRGBA8888ToDUDVMapUVLX8888( const unsigned char *src, int width, int height, unsigned char *dst_ );
void ConvertNormalMapRGBA8888ToDUDVMapUVWQ8888( const unsigned char *src, int width, int height, unsigned char *dst_ );
void ConvertNormalMapRGBA8888ToDUDVMapUV88( const unsigned char *src, int width, int height, unsigned char *dst_ );
void ConvertNormalMapARGB8888ToDXT5GA( const unsigned char *src, unsigned char *dst, int width, int height );
void ConvertIA88ImageToNormalMapRGBA8888( const unsigned char *src, int width,
int height, unsigned char *dst,
float bumpScale );
void NormalizeNormalMapRGBA8888( unsigned char *src, int numTexels );
//-----------------------------------------------------------------------------
// Gamma correction
//-----------------------------------------------------------------------------
void GammaCorrectRGBA8888( unsigned char *src, unsigned char* dst,
int width, int height, int depth, float srcGamma, float dstGamma );
//-----------------------------------------------------------------------------
// Makes a gamma table
//-----------------------------------------------------------------------------
void ConstructGammaTable( unsigned char* pTable, float srcGamma, float dstGamma );
//-----------------------------------------------------------------------------
// Gamma corrects using a previously constructed gamma table
//-----------------------------------------------------------------------------
void GammaCorrectRGBA8888( unsigned char* pSrc, unsigned char* pDst,
int width, int height, int depth, unsigned char* pGammaTable );
//-----------------------------------------------------------------------------
// Generates a number of mipmap levels
//-----------------------------------------------------------------------------
void GenerateMipmapLevels( unsigned char* pSrc, unsigned char* pDst, int width,
int height, int depth, ImageFormat imageFormat, float srcGamma, float dstGamma,
int numLevels = 0 );
//-----------------------------------------------------------------------------
// operations on square images (src and dst can be the same)
//-----------------------------------------------------------------------------
bool RotateImageLeft( const unsigned char *src, unsigned char *dst,
int widthHeight, ImageFormat imageFormat );
bool RotateImage180( const unsigned char *src, unsigned char *dst,
int widthHeight, ImageFormat imageFormat );
bool FlipImageVertically( void *pSrc, void *pDst, int nWidth, int nHeight, ImageFormat imageFormat, int nDstStride = 0 );
bool FlipImageHorizontally( void *pSrc, void *pDst, int nWidth, int nHeight, ImageFormat imageFormat, int nDstStride = 0 );
bool SwapAxes( unsigned char *src,
int widthHeight, ImageFormat imageFormat );
//-----------------------------------------------------------------------------
// Returns info about each image format
//-----------------------------------------------------------------------------
ImageFormatInfo_t const& ImageFormatInfo( ImageFormat fmt );
//-----------------------------------------------------------------------------
// Gets the name of the image format
//-----------------------------------------------------------------------------
inline char const* GetName( ImageFormat fmt )
{
return ImageFormatInfo(fmt).m_pName;
}
//-----------------------------------------------------------------------------
// Gets the size of the image format in bytes
//-----------------------------------------------------------------------------
inline int SizeInBytes( ImageFormat fmt )
{
return ImageFormatInfo(fmt).m_NumBytes;
}
//-----------------------------------------------------------------------------
// Does the image format support transparency?
//-----------------------------------------------------------------------------
inline bool IsTransparent( ImageFormat fmt )
{
return ImageFormatInfo(fmt).m_NumAlphaBits > 0;
}
//-----------------------------------------------------------------------------
// Is the image format compressed?
//-----------------------------------------------------------------------------
inline bool IsCompressed( ImageFormat fmt )
{
return ImageFormatInfo(fmt).m_IsCompressed;
}
//-----------------------------------------------------------------------------
// Is any channel > 8 bits?
//-----------------------------------------------------------------------------
inline bool HasChannelLargerThan8Bits( ImageFormat fmt )
{
ImageFormatInfo_t info = ImageFormatInfo(fmt);
return ( info.m_NumRedBits > 8 || info.m_NumGreeBits > 8 || info.m_NumBlueBits > 8 || info.m_NumAlphaBits > 8 );
}
inline bool IsFloatFormat( ImageFormat fmt )
{
return ( fmt == IMAGE_FORMAT_RGBA16161616F ) ||
( fmt == IMAGE_FORMAT_R32F ) ||
( fmt == IMAGE_FORMAT_RGB323232F ) ||
( fmt == IMAGE_FORMAT_RGBA32323232F );
}
} // end namespace ImageLoader
#endif // IMAGEFORMAT_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
================================================================
Copyright © 1996-2011, Valve Corporation, All rights reserved.
================================================================
OSX DirectX to OpenGL Conversion Library
Contains all support files required to assist in converting DirectX applications to OpenGL on OSX. For reference,
this library can be enabled in the Steamworks Example by building with the compile time flag DX9MODE=1.

View File

@ -0,0 +1,201 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to app data in Steam
//
//=============================================================================
#ifndef ISTEAMAPPS_H
#define ISTEAMAPPS_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
//-----------------------------------------------------------------------------
// Purpose: interface to app data
//-----------------------------------------------------------------------------
class ISteamApps
{
public:
virtual bool BIsSubscribed() = 0;
virtual bool BIsLowViolence() = 0;
virtual bool BIsCybercafe() = 0;
virtual bool BIsVACBanned() = 0;
virtual const char *GetCurrentGameLanguage() = 0;
virtual const char *GetAvailableGameLanguages() = 0;
// only use this member if you need to check ownership of another game related to yours, a demo for example
virtual bool BIsSubscribedApp( AppId_t appID ) = 0;
// Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed
virtual bool BIsDlcInstalled( AppId_t appID ) = 0;
// returns the Unix time of the purchase of the app
virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0;
// Checks if the user is subscribed to the current app through a free weekend
// This function will return false for users who have a retail or other type of license
// Before using, please ask your Valve technical contact how to package and secure your free weekend
virtual bool BIsSubscribedFromFreeWeekend() = 0;
// Returns the number of DLC pieces for the running app
virtual int GetDLCCount() = 0;
// Returns metadata for DLC by index, of range [0, GetDLCCount()]
virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0;
// Install/Uninstall control for optional DLC
virtual void InstallDLC( AppId_t nAppID ) = 0;
virtual void UninstallDLC( AppId_t nAppID ) = 0;
// Request legacy cd-key for yourself or owned DLC. If you are interested in this
// data then make sure you provide us with a list of valid keys to be distributed
// to users when they purchase the game, before the game ships.
// You'll receive an AppProofOfPurchaseKeyResponse_t callback when
// the key is available (which may be immediately).
virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0;
virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch
virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing
virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order
// returns current app install folder for AppID, returns folder name length
virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0;
virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned)
// returns the SteamID of the original owner. If this CSteamID is different from ISteamUser::GetSteamID(),
// the user has a temporary license borrowed via Family Sharing
virtual CSteamID GetAppOwner() = 0;
// Returns the associated launch param if the game is run via steam://run/<appid>//?param1=value1&param2=value2&param3=value3 etc.
// Parameter names starting with the character '@' are reserved for internal use and will always return and empty string.
// Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,
// but it is advised that you not param names beginning with an underscore for your own features.
// Check for new launch parameters on callback NewUrlLaunchParameters_t
virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0;
// get download progress for optional DLC
virtual bool GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
// return the buildid of this app, may change at any time based on backend updates to the game
virtual int GetAppBuildId() = 0;
// Request all proof of purchase keys for the calling appid and associated DLC.
// A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with
// appropriate appid values, ending with a final callback where the m_nAppId
// member is k_uAppIdInvalid (zero).
virtual void RequestAllProofOfPurchaseKeys() = 0;
STEAM_CALL_RESULT( FileDetailsResult_t )
virtual SteamAPICall_t GetFileDetails( const char* pszFileName ) = 0;
// Get command line if game was launched via Steam URL, e.g. steam://run/<appid>//<command line>/.
// This method of passing a connect string (used when joining via rich presence, accepting an
// invite, etc) is preferable to passing the connect string on the operating system command
// line, which is a security risk. In order for rich presence joins to go through this
// path and not be placed on the OS command line, you must set a value in your app's
// configuration on Steam. Ask Valve for help with this.
//
// If game was already running and launched again, the NewUrlLaunchParameters_t will be fired.
virtual int GetLaunchCommandLine( char *pszCommandLine, int cubCommandLine ) = 0;
// Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID
virtual bool BIsSubscribedFromFamilySharing() = 0;
// check if game is a timed trial with limited playtime
virtual bool BIsTimedTrial( uint32* punSecondsAllowed, uint32* punSecondsPlayed ) = 0;
// set current DLC AppID being played (or 0 if none). Allows Steam to track usage of major DLC extensions
virtual bool SetDlcContext( AppId_t nAppID ) = 0;
// returns total number of known app branches (including default "public" branch ). nAvailable is number of available betas
virtual int GetNumBetas( int *pnAvailable, int *pnPrivate ) = 0; //
// return beta branch details, name, description, current BuildID and state flags (EBetaBranchFlags)
virtual bool GetBetaInfo( int iBetaIndex, uint32 *punFlags, uint32 *punBuildID, char *pchBetaName, int cchBetaName, char *pchDescription, int cchDescription ) = 0; // iterate through
// select this beta branch for this app as active, might need the game to restart so Steam can update to that branch
virtual bool SetActiveBeta( const char *pchBetaName ) = 0;
};
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008"
// Global interface accessor
inline ISteamApps *SteamApps();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamApps *, SteamApps, STEAMAPPS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: posted after the user gains ownership of DLC & that DLC is installed
//-----------------------------------------------------------------------------
struct DlcInstalled_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 5 };
AppId_t m_nAppID; // AppID of the DLC
};
//---------------------------------------------------------------------------------
// Purpose: posted after the user gains executes a Steam URL with command line or query parameters
// such as steam://run/<appid>//-commandline/?param1=value1&param2=value2&param3=value3 etc
// while the game is already running. The new params can be queried
// with GetLaunchQueryParam and GetLaunchCommandLine
//---------------------------------------------------------------------------------
struct NewUrlLaunchParameters_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 14 };
};
//-----------------------------------------------------------------------------
// Purpose: response to RequestAppProofOfPurchaseKey/RequestAllProofOfPurchaseKeys
// for supporting third-party CD keys, or other proof-of-purchase systems.
//-----------------------------------------------------------------------------
struct AppProofOfPurchaseKeyResponse_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 21 };
EResult m_eResult;
uint32 m_nAppID;
uint32 m_cchKeyLength;
char m_rgchKey[k_cubAppProofOfPurchaseKeyMax];
};
//-----------------------------------------------------------------------------
// Purpose: response to GetFileDetails
//-----------------------------------------------------------------------------
struct FileDetailsResult_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 23 };
EResult m_eResult;
uint64 m_ulFileSize; // original file size in bytes
uint8 m_FileSHA[20]; // original file SHA1 hash
uint32 m_unFlags; //
};
//-----------------------------------------------------------------------------
// Purpose: called for games in Timed Trial mode
//-----------------------------------------------------------------------------
struct TimedTrialStatus_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 30 };
AppId_t m_unAppID; // appID
bool m_bIsOffline; // if true, time allowed / played refers to offline time, not total time
uint32 m_unSecondsAllowed; // how many seconds the app can be played in total
uint32 m_unSecondsPlayed; // how many seconds the app was already played
};
#pragma pack( pop )
#endif // ISTEAMAPPS_H

View File

@ -0,0 +1,28 @@
//====== Copyright 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: a private, but well versioned, interface to get at critical bits
// of a steam3 appticket - consumed by the simple drm wrapper to let it
// ask about ownership with greater confidence.
//
//=============================================================================
#ifndef ISTEAMAPPTICKET_H
#define ISTEAMAPPTICKET_H
#pragma once
//-----------------------------------------------------------------------------
// Purpose: hand out a reasonable "future proof" view of an app ownership ticket
// the raw (signed) buffer, and indices into that buffer where the appid and
// steamid are located. the sizes of the appid and steamid are implicit in
// (each version of) the interface - currently uin32 appid and uint64 steamid
//-----------------------------------------------------------------------------
class ISteamAppTicket
{
public:
virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature ) = 0;
};
#define STEAMAPPTICKET_INTERFACE_VERSION "STEAMAPPTICKET_INTERFACE_VERSION001"
#endif // ISTEAMAPPTICKET_H

View File

@ -0,0 +1,173 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Internal low-level access to Steamworks interfaces.
//
// Most users of the Steamworks SDK do not need to include this file.
// You should only include this if you are doing something special.
//=============================================================================
#ifndef ISTEAMCLIENT_H
#define ISTEAMCLIENT_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Interface to creating a new steam instance, or to
// connect to an existing steam instance, whether it's in a
// different process or is local.
//
// For most scenarios this is all handled automatically via SteamAPI_Init().
// You'll only need these APIs if you have a more complex versioning scheme,
// or if you want to implement a multiplexed gameserver where a single process
// is handling multiple games at once with independent gameserver SteamIDs.
//-----------------------------------------------------------------------------
class ISteamClient
{
public:
// Creates a communication pipe to the Steam client.
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamPipe CreateSteamPipe() = 0;
// Releases a previously created communications pipe
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0;
// connects to an existing global user, failing if none exists
// used by the game to coordinate with the steamUI
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0;
// used by game servers, create a steam user that won't be shared with anyone else
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0;
// removes an allocated user
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0;
// retrieves the ISteamUser interface associated with the handle
virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// retrieves the ISteamGameServer interface associated with the handle
virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// set the local IP and Port to bind to
// this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort ) = 0;
// returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUtils interface
virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmaking interface
virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmakingServers interface
virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the a generic interface
virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUserStats interface
virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamGameServerStats interface
virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns apps interface
virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// networking
virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// remote storage
virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// user screenshots
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// game search
virtual ISteamGameSearch *GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
// control how often you do them.
virtual uint32 GetIPCCallCount() = 0;
// API warning handling
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message.
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
// Trigger global shutdown for the DLL
virtual bool BShutdownIfAllPipesClosed() = 0;
// Expose HTTP interface
virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamController interface - deprecated in favor of Steam Input
virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamUGC interface
virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Music Player
virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Music Player Remote
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
// html page display
virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
// Helper functions for internal Steam usage
STEAM_PRIVATE_API( virtual void DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0; )
// inventory
virtual ISteamInventory *GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Video
virtual ISteamVideo *GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Parental controls
virtual ISteamParentalSettings *GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the Steam Input interface for controller support
virtual ISteamInput *GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Steam Parties interface
virtual ISteamParties *GetISteamParties( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Steam Remote Play interface
virtual ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
STEAM_PRIVATE_API( virtual void DestroyAllInterfaces() = 0; )
};
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient021"
#ifndef STEAM_API_EXPORTS
// Global ISteamClient interface accessor
inline ISteamClient *SteamClient();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamClient *, SteamClient, SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION ), "global", STEAMCLIENT_INTERFACE_VERSION );
// The internal ISteamClient used for the gameserver interface.
// (This is actually the same thing. You really shouldn't need to access any of this stuff directly.)
inline ISteamClient *SteamGameServerClient() { return SteamClient(); }
#endif
#endif // ISTEAMCLIENT_H

View File

@ -0,0 +1,731 @@
//====== Copyright 1996-2018, Valve Corporation, All rights reserved. =======
// Note: The older ISteamController interface has been deprecated in favor of ISteamInput - this interface
// was updated in this SDK but will be removed from future SDK's. The Steam Client will retain
// compatibility with the older interfaces so your any existing integrations should be unaffected.
//
// Purpose: Steam Input is a flexible input API that supports over three hundred devices including all
// common variants of Xbox, Playstation, Nintendo Switch Pro, and Steam Controllers.
// For more info including a getting started guide for developers
// please visit: https://partner.steamgames.com/doc/features/steam_controller
//
//=============================================================================
#ifndef ISTEAMCONTROLLER_H
#define ISTEAMCONTROLLER_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
#include "isteaminput.h"
#define STEAM_CONTROLLER_MAX_COUNT 16
#define STEAM_CONTROLLER_MAX_ANALOG_ACTIONS 24
#define STEAM_CONTROLLER_MAX_DIGITAL_ACTIONS 256
#define STEAM_CONTROLLER_MAX_ORIGINS 8
#define STEAM_CONTROLLER_MAX_ACTIVE_LAYERS 16
// When sending an option to a specific controller handle, you can send to all controllers via this command
#define STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS UINT64_MAX
#define STEAM_CONTROLLER_MIN_ANALOG_ACTION_DATA -1.0f
#define STEAM_CONTROLLER_MAX_ANALOG_ACTION_DATA 1.0f
#ifndef ISTEAMINPUT_H
enum ESteamControllerPad
{
k_ESteamControllerPad_Left,
k_ESteamControllerPad_Right
};
#endif
// Note: Please do not use action origins as a way to identify controller types. There is no
// guarantee that they will be added in a contiguous manner - use GetInputTypeForHandle instead
// Versions of Steam that add new controller types in the future will extend this enum if you're
// using a lookup table please check the bounds of any origins returned by Steam.
enum EControllerActionOrigin
{
// Steam Controller
k_EControllerActionOrigin_None,
k_EControllerActionOrigin_A,
k_EControllerActionOrigin_B,
k_EControllerActionOrigin_X,
k_EControllerActionOrigin_Y,
k_EControllerActionOrigin_LeftBumper,
k_EControllerActionOrigin_RightBumper,
k_EControllerActionOrigin_LeftGrip,
k_EControllerActionOrigin_RightGrip,
k_EControllerActionOrigin_Start,
k_EControllerActionOrigin_Back,
k_EControllerActionOrigin_LeftPad_Touch,
k_EControllerActionOrigin_LeftPad_Swipe,
k_EControllerActionOrigin_LeftPad_Click,
k_EControllerActionOrigin_LeftPad_DPadNorth,
k_EControllerActionOrigin_LeftPad_DPadSouth,
k_EControllerActionOrigin_LeftPad_DPadWest,
k_EControllerActionOrigin_LeftPad_DPadEast,
k_EControllerActionOrigin_RightPad_Touch,
k_EControllerActionOrigin_RightPad_Swipe,
k_EControllerActionOrigin_RightPad_Click,
k_EControllerActionOrigin_RightPad_DPadNorth,
k_EControllerActionOrigin_RightPad_DPadSouth,
k_EControllerActionOrigin_RightPad_DPadWest,
k_EControllerActionOrigin_RightPad_DPadEast,
k_EControllerActionOrigin_LeftTrigger_Pull,
k_EControllerActionOrigin_LeftTrigger_Click,
k_EControllerActionOrigin_RightTrigger_Pull,
k_EControllerActionOrigin_RightTrigger_Click,
k_EControllerActionOrigin_LeftStick_Move,
k_EControllerActionOrigin_LeftStick_Click,
k_EControllerActionOrigin_LeftStick_DPadNorth,
k_EControllerActionOrigin_LeftStick_DPadSouth,
k_EControllerActionOrigin_LeftStick_DPadWest,
k_EControllerActionOrigin_LeftStick_DPadEast,
k_EControllerActionOrigin_Gyro_Move,
k_EControllerActionOrigin_Gyro_Pitch,
k_EControllerActionOrigin_Gyro_Yaw,
k_EControllerActionOrigin_Gyro_Roll,
// PS4 Dual Shock
k_EControllerActionOrigin_PS4_X,
k_EControllerActionOrigin_PS4_Circle,
k_EControllerActionOrigin_PS4_Triangle,
k_EControllerActionOrigin_PS4_Square,
k_EControllerActionOrigin_PS4_LeftBumper,
k_EControllerActionOrigin_PS4_RightBumper,
k_EControllerActionOrigin_PS4_Options, //Start
k_EControllerActionOrigin_PS4_Share, //Back
k_EControllerActionOrigin_PS4_LeftPad_Touch,
k_EControllerActionOrigin_PS4_LeftPad_Swipe,
k_EControllerActionOrigin_PS4_LeftPad_Click,
k_EControllerActionOrigin_PS4_LeftPad_DPadNorth,
k_EControllerActionOrigin_PS4_LeftPad_DPadSouth,
k_EControllerActionOrigin_PS4_LeftPad_DPadWest,
k_EControllerActionOrigin_PS4_LeftPad_DPadEast,
k_EControllerActionOrigin_PS4_RightPad_Touch,
k_EControllerActionOrigin_PS4_RightPad_Swipe,
k_EControllerActionOrigin_PS4_RightPad_Click,
k_EControllerActionOrigin_PS4_RightPad_DPadNorth,
k_EControllerActionOrigin_PS4_RightPad_DPadSouth,
k_EControllerActionOrigin_PS4_RightPad_DPadWest,
k_EControllerActionOrigin_PS4_RightPad_DPadEast,
k_EControllerActionOrigin_PS4_CenterPad_Touch,
k_EControllerActionOrigin_PS4_CenterPad_Swipe,
k_EControllerActionOrigin_PS4_CenterPad_Click,
k_EControllerActionOrigin_PS4_CenterPad_DPadNorth,
k_EControllerActionOrigin_PS4_CenterPad_DPadSouth,
k_EControllerActionOrigin_PS4_CenterPad_DPadWest,
k_EControllerActionOrigin_PS4_CenterPad_DPadEast,
k_EControllerActionOrigin_PS4_LeftTrigger_Pull,
k_EControllerActionOrigin_PS4_LeftTrigger_Click,
k_EControllerActionOrigin_PS4_RightTrigger_Pull,
k_EControllerActionOrigin_PS4_RightTrigger_Click,
k_EControllerActionOrigin_PS4_LeftStick_Move,
k_EControllerActionOrigin_PS4_LeftStick_Click,
k_EControllerActionOrigin_PS4_LeftStick_DPadNorth,
k_EControllerActionOrigin_PS4_LeftStick_DPadSouth,
k_EControllerActionOrigin_PS4_LeftStick_DPadWest,
k_EControllerActionOrigin_PS4_LeftStick_DPadEast,
k_EControllerActionOrigin_PS4_RightStick_Move,
k_EControllerActionOrigin_PS4_RightStick_Click,
k_EControllerActionOrigin_PS4_RightStick_DPadNorth,
k_EControllerActionOrigin_PS4_RightStick_DPadSouth,
k_EControllerActionOrigin_PS4_RightStick_DPadWest,
k_EControllerActionOrigin_PS4_RightStick_DPadEast,
k_EControllerActionOrigin_PS4_DPad_North,
k_EControllerActionOrigin_PS4_DPad_South,
k_EControllerActionOrigin_PS4_DPad_West,
k_EControllerActionOrigin_PS4_DPad_East,
k_EControllerActionOrigin_PS4_Gyro_Move,
k_EControllerActionOrigin_PS4_Gyro_Pitch,
k_EControllerActionOrigin_PS4_Gyro_Yaw,
k_EControllerActionOrigin_PS4_Gyro_Roll,
// XBox One
k_EControllerActionOrigin_XBoxOne_A,
k_EControllerActionOrigin_XBoxOne_B,
k_EControllerActionOrigin_XBoxOne_X,
k_EControllerActionOrigin_XBoxOne_Y,
k_EControllerActionOrigin_XBoxOne_LeftBumper,
k_EControllerActionOrigin_XBoxOne_RightBumper,
k_EControllerActionOrigin_XBoxOne_Menu, //Start
k_EControllerActionOrigin_XBoxOne_View, //Back
k_EControllerActionOrigin_XBoxOne_LeftTrigger_Pull,
k_EControllerActionOrigin_XBoxOne_LeftTrigger_Click,
k_EControllerActionOrigin_XBoxOne_RightTrigger_Pull,
k_EControllerActionOrigin_XBoxOne_RightTrigger_Click,
k_EControllerActionOrigin_XBoxOne_LeftStick_Move,
k_EControllerActionOrigin_XBoxOne_LeftStick_Click,
k_EControllerActionOrigin_XBoxOne_LeftStick_DPadNorth,
k_EControllerActionOrigin_XBoxOne_LeftStick_DPadSouth,
k_EControllerActionOrigin_XBoxOne_LeftStick_DPadWest,
k_EControllerActionOrigin_XBoxOne_LeftStick_DPadEast,
k_EControllerActionOrigin_XBoxOne_RightStick_Move,
k_EControllerActionOrigin_XBoxOne_RightStick_Click,
k_EControllerActionOrigin_XBoxOne_RightStick_DPadNorth,
k_EControllerActionOrigin_XBoxOne_RightStick_DPadSouth,
k_EControllerActionOrigin_XBoxOne_RightStick_DPadWest,
k_EControllerActionOrigin_XBoxOne_RightStick_DPadEast,
k_EControllerActionOrigin_XBoxOne_DPad_North,
k_EControllerActionOrigin_XBoxOne_DPad_South,
k_EControllerActionOrigin_XBoxOne_DPad_West,
k_EControllerActionOrigin_XBoxOne_DPad_East,
// XBox 360
k_EControllerActionOrigin_XBox360_A,
k_EControllerActionOrigin_XBox360_B,
k_EControllerActionOrigin_XBox360_X,
k_EControllerActionOrigin_XBox360_Y,
k_EControllerActionOrigin_XBox360_LeftBumper,
k_EControllerActionOrigin_XBox360_RightBumper,
k_EControllerActionOrigin_XBox360_Start, //Start
k_EControllerActionOrigin_XBox360_Back, //Back
k_EControllerActionOrigin_XBox360_LeftTrigger_Pull,
k_EControllerActionOrigin_XBox360_LeftTrigger_Click,
k_EControllerActionOrigin_XBox360_RightTrigger_Pull,
k_EControllerActionOrigin_XBox360_RightTrigger_Click,
k_EControllerActionOrigin_XBox360_LeftStick_Move,
k_EControllerActionOrigin_XBox360_LeftStick_Click,
k_EControllerActionOrigin_XBox360_LeftStick_DPadNorth,
k_EControllerActionOrigin_XBox360_LeftStick_DPadSouth,
k_EControllerActionOrigin_XBox360_LeftStick_DPadWest,
k_EControllerActionOrigin_XBox360_LeftStick_DPadEast,
k_EControllerActionOrigin_XBox360_RightStick_Move,
k_EControllerActionOrigin_XBox360_RightStick_Click,
k_EControllerActionOrigin_XBox360_RightStick_DPadNorth,
k_EControllerActionOrigin_XBox360_RightStick_DPadSouth,
k_EControllerActionOrigin_XBox360_RightStick_DPadWest,
k_EControllerActionOrigin_XBox360_RightStick_DPadEast,
k_EControllerActionOrigin_XBox360_DPad_North,
k_EControllerActionOrigin_XBox360_DPad_South,
k_EControllerActionOrigin_XBox360_DPad_West,
k_EControllerActionOrigin_XBox360_DPad_East,
// SteamController V2
k_EControllerActionOrigin_SteamV2_A,
k_EControllerActionOrigin_SteamV2_B,
k_EControllerActionOrigin_SteamV2_X,
k_EControllerActionOrigin_SteamV2_Y,
k_EControllerActionOrigin_SteamV2_LeftBumper,
k_EControllerActionOrigin_SteamV2_RightBumper,
k_EControllerActionOrigin_SteamV2_LeftGrip_Lower,
k_EControllerActionOrigin_SteamV2_LeftGrip_Upper,
k_EControllerActionOrigin_SteamV2_RightGrip_Lower,
k_EControllerActionOrigin_SteamV2_RightGrip_Upper,
k_EControllerActionOrigin_SteamV2_LeftBumper_Pressure,
k_EControllerActionOrigin_SteamV2_RightBumper_Pressure,
k_EControllerActionOrigin_SteamV2_LeftGrip_Pressure,
k_EControllerActionOrigin_SteamV2_RightGrip_Pressure,
k_EControllerActionOrigin_SteamV2_LeftGrip_Upper_Pressure,
k_EControllerActionOrigin_SteamV2_RightGrip_Upper_Pressure,
k_EControllerActionOrigin_SteamV2_Start,
k_EControllerActionOrigin_SteamV2_Back,
k_EControllerActionOrigin_SteamV2_LeftPad_Touch,
k_EControllerActionOrigin_SteamV2_LeftPad_Swipe,
k_EControllerActionOrigin_SteamV2_LeftPad_Click,
k_EControllerActionOrigin_SteamV2_LeftPad_Pressure,
k_EControllerActionOrigin_SteamV2_LeftPad_DPadNorth,
k_EControllerActionOrigin_SteamV2_LeftPad_DPadSouth,
k_EControllerActionOrigin_SteamV2_LeftPad_DPadWest,
k_EControllerActionOrigin_SteamV2_LeftPad_DPadEast,
k_EControllerActionOrigin_SteamV2_RightPad_Touch,
k_EControllerActionOrigin_SteamV2_RightPad_Swipe,
k_EControllerActionOrigin_SteamV2_RightPad_Click,
k_EControllerActionOrigin_SteamV2_RightPad_Pressure,
k_EControllerActionOrigin_SteamV2_RightPad_DPadNorth,
k_EControllerActionOrigin_SteamV2_RightPad_DPadSouth,
k_EControllerActionOrigin_SteamV2_RightPad_DPadWest,
k_EControllerActionOrigin_SteamV2_RightPad_DPadEast,
k_EControllerActionOrigin_SteamV2_LeftTrigger_Pull,
k_EControllerActionOrigin_SteamV2_LeftTrigger_Click,
k_EControllerActionOrigin_SteamV2_RightTrigger_Pull,
k_EControllerActionOrigin_SteamV2_RightTrigger_Click,
k_EControllerActionOrigin_SteamV2_LeftStick_Move,
k_EControllerActionOrigin_SteamV2_LeftStick_Click,
k_EControllerActionOrigin_SteamV2_LeftStick_DPadNorth,
k_EControllerActionOrigin_SteamV2_LeftStick_DPadSouth,
k_EControllerActionOrigin_SteamV2_LeftStick_DPadWest,
k_EControllerActionOrigin_SteamV2_LeftStick_DPadEast,
k_EControllerActionOrigin_SteamV2_Gyro_Move,
k_EControllerActionOrigin_SteamV2_Gyro_Pitch,
k_EControllerActionOrigin_SteamV2_Gyro_Yaw,
k_EControllerActionOrigin_SteamV2_Gyro_Roll,
// Switch - Pro or Joycons used as a single input device.
// This does not apply to a single joycon
k_EControllerActionOrigin_Switch_A,
k_EControllerActionOrigin_Switch_B,
k_EControllerActionOrigin_Switch_X,
k_EControllerActionOrigin_Switch_Y,
k_EControllerActionOrigin_Switch_LeftBumper,
k_EControllerActionOrigin_Switch_RightBumper,
k_EControllerActionOrigin_Switch_Plus, //Start
k_EControllerActionOrigin_Switch_Minus, //Back
k_EControllerActionOrigin_Switch_Capture,
k_EControllerActionOrigin_Switch_LeftTrigger_Pull,
k_EControllerActionOrigin_Switch_LeftTrigger_Click,
k_EControllerActionOrigin_Switch_RightTrigger_Pull,
k_EControllerActionOrigin_Switch_RightTrigger_Click,
k_EControllerActionOrigin_Switch_LeftStick_Move,
k_EControllerActionOrigin_Switch_LeftStick_Click,
k_EControllerActionOrigin_Switch_LeftStick_DPadNorth,
k_EControllerActionOrigin_Switch_LeftStick_DPadSouth,
k_EControllerActionOrigin_Switch_LeftStick_DPadWest,
k_EControllerActionOrigin_Switch_LeftStick_DPadEast,
k_EControllerActionOrigin_Switch_RightStick_Move,
k_EControllerActionOrigin_Switch_RightStick_Click,
k_EControllerActionOrigin_Switch_RightStick_DPadNorth,
k_EControllerActionOrigin_Switch_RightStick_DPadSouth,
k_EControllerActionOrigin_Switch_RightStick_DPadWest,
k_EControllerActionOrigin_Switch_RightStick_DPadEast,
k_EControllerActionOrigin_Switch_DPad_North,
k_EControllerActionOrigin_Switch_DPad_South,
k_EControllerActionOrigin_Switch_DPad_West,
k_EControllerActionOrigin_Switch_DPad_East,
k_EControllerActionOrigin_Switch_ProGyro_Move, // Primary Gyro in Pro Controller, or Right JoyCon
k_EControllerActionOrigin_Switch_ProGyro_Pitch, // Primary Gyro in Pro Controller, or Right JoyCon
k_EControllerActionOrigin_Switch_ProGyro_Yaw, // Primary Gyro in Pro Controller, or Right JoyCon
k_EControllerActionOrigin_Switch_ProGyro_Roll, // Primary Gyro in Pro Controller, or Right JoyCon
// Switch JoyCon Specific
k_EControllerActionOrigin_Switch_RightGyro_Move, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_RightGyro_Pitch, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_RightGyro_Yaw, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_RightGyro_Roll, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_LeftGyro_Move,
k_EControllerActionOrigin_Switch_LeftGyro_Pitch,
k_EControllerActionOrigin_Switch_LeftGyro_Yaw,
k_EControllerActionOrigin_Switch_LeftGyro_Roll,
k_EControllerActionOrigin_Switch_LeftGrip_Lower, // Left JoyCon SR Button
k_EControllerActionOrigin_Switch_LeftGrip_Upper, // Left JoyCon SL Button
k_EControllerActionOrigin_Switch_RightGrip_Lower, // Right JoyCon SL Button
k_EControllerActionOrigin_Switch_RightGrip_Upper, // Right JoyCon SR Button
// Added in SDK 1.45
k_EControllerActionOrigin_PS4_DPad_Move,
k_EControllerActionOrigin_XBoxOne_DPad_Move,
k_EControllerActionOrigin_XBox360_DPad_Move,
k_EControllerActionOrigin_Switch_DPad_Move,
// Added in SDK 1.51
k_EControllerActionOrigin_PS5_X,
k_EControllerActionOrigin_PS5_Circle,
k_EControllerActionOrigin_PS5_Triangle,
k_EControllerActionOrigin_PS5_Square,
k_EControllerActionOrigin_PS5_LeftBumper,
k_EControllerActionOrigin_PS5_RightBumper,
k_EControllerActionOrigin_PS5_Option, //Start
k_EControllerActionOrigin_PS5_Create, //Back
k_EControllerActionOrigin_PS5_Mute,
k_EControllerActionOrigin_PS5_LeftPad_Touch,
k_EControllerActionOrigin_PS5_LeftPad_Swipe,
k_EControllerActionOrigin_PS5_LeftPad_Click,
k_EControllerActionOrigin_PS5_LeftPad_DPadNorth,
k_EControllerActionOrigin_PS5_LeftPad_DPadSouth,
k_EControllerActionOrigin_PS5_LeftPad_DPadWest,
k_EControllerActionOrigin_PS5_LeftPad_DPadEast,
k_EControllerActionOrigin_PS5_RightPad_Touch,
k_EControllerActionOrigin_PS5_RightPad_Swipe,
k_EControllerActionOrigin_PS5_RightPad_Click,
k_EControllerActionOrigin_PS5_RightPad_DPadNorth,
k_EControllerActionOrigin_PS5_RightPad_DPadSouth,
k_EControllerActionOrigin_PS5_RightPad_DPadWest,
k_EControllerActionOrigin_PS5_RightPad_DPadEast,
k_EControllerActionOrigin_PS5_CenterPad_Touch,
k_EControllerActionOrigin_PS5_CenterPad_Swipe,
k_EControllerActionOrigin_PS5_CenterPad_Click,
k_EControllerActionOrigin_PS5_CenterPad_DPadNorth,
k_EControllerActionOrigin_PS5_CenterPad_DPadSouth,
k_EControllerActionOrigin_PS5_CenterPad_DPadWest,
k_EControllerActionOrigin_PS5_CenterPad_DPadEast,
k_EControllerActionOrigin_PS5_LeftTrigger_Pull,
k_EControllerActionOrigin_PS5_LeftTrigger_Click,
k_EControllerActionOrigin_PS5_RightTrigger_Pull,
k_EControllerActionOrigin_PS5_RightTrigger_Click,
k_EControllerActionOrigin_PS5_LeftStick_Move,
k_EControllerActionOrigin_PS5_LeftStick_Click,
k_EControllerActionOrigin_PS5_LeftStick_DPadNorth,
k_EControllerActionOrigin_PS5_LeftStick_DPadSouth,
k_EControllerActionOrigin_PS5_LeftStick_DPadWest,
k_EControllerActionOrigin_PS5_LeftStick_DPadEast,
k_EControllerActionOrigin_PS5_RightStick_Move,
k_EControllerActionOrigin_PS5_RightStick_Click,
k_EControllerActionOrigin_PS5_RightStick_DPadNorth,
k_EControllerActionOrigin_PS5_RightStick_DPadSouth,
k_EControllerActionOrigin_PS5_RightStick_DPadWest,
k_EControllerActionOrigin_PS5_RightStick_DPadEast,
k_EControllerActionOrigin_PS5_DPad_Move,
k_EControllerActionOrigin_PS5_DPad_North,
k_EControllerActionOrigin_PS5_DPad_South,
k_EControllerActionOrigin_PS5_DPad_West,
k_EControllerActionOrigin_PS5_DPad_East,
k_EControllerActionOrigin_PS5_Gyro_Move,
k_EControllerActionOrigin_PS5_Gyro_Pitch,
k_EControllerActionOrigin_PS5_Gyro_Yaw,
k_EControllerActionOrigin_PS5_Gyro_Roll,
k_EControllerActionOrigin_XBoxOne_LeftGrip_Lower,
k_EControllerActionOrigin_XBoxOne_LeftGrip_Upper,
k_EControllerActionOrigin_XBoxOne_RightGrip_Lower,
k_EControllerActionOrigin_XBoxOne_RightGrip_Upper,
k_EControllerActionOrigin_XBoxOne_Share,
// Added in SDK 1.53
k_EControllerActionOrigin_SteamDeck_A,
k_EControllerActionOrigin_SteamDeck_B,
k_EControllerActionOrigin_SteamDeck_X,
k_EControllerActionOrigin_SteamDeck_Y,
k_EControllerActionOrigin_SteamDeck_L1,
k_EControllerActionOrigin_SteamDeck_R1,
k_EControllerActionOrigin_SteamDeck_Menu,
k_EControllerActionOrigin_SteamDeck_View,
k_EControllerActionOrigin_SteamDeck_LeftPad_Touch,
k_EControllerActionOrigin_SteamDeck_LeftPad_Swipe,
k_EControllerActionOrigin_SteamDeck_LeftPad_Click,
k_EControllerActionOrigin_SteamDeck_LeftPad_DPadNorth,
k_EControllerActionOrigin_SteamDeck_LeftPad_DPadSouth,
k_EControllerActionOrigin_SteamDeck_LeftPad_DPadWest,
k_EControllerActionOrigin_SteamDeck_LeftPad_DPadEast,
k_EControllerActionOrigin_SteamDeck_RightPad_Touch,
k_EControllerActionOrigin_SteamDeck_RightPad_Swipe,
k_EControllerActionOrigin_SteamDeck_RightPad_Click,
k_EControllerActionOrigin_SteamDeck_RightPad_DPadNorth,
k_EControllerActionOrigin_SteamDeck_RightPad_DPadSouth,
k_EControllerActionOrigin_SteamDeck_RightPad_DPadWest,
k_EControllerActionOrigin_SteamDeck_RightPad_DPadEast,
k_EControllerActionOrigin_SteamDeck_L2_SoftPull,
k_EControllerActionOrigin_SteamDeck_L2,
k_EControllerActionOrigin_SteamDeck_R2_SoftPull,
k_EControllerActionOrigin_SteamDeck_R2,
k_EControllerActionOrigin_SteamDeck_LeftStick_Move,
k_EControllerActionOrigin_SteamDeck_L3,
k_EControllerActionOrigin_SteamDeck_LeftStick_DPadNorth,
k_EControllerActionOrigin_SteamDeck_LeftStick_DPadSouth,
k_EControllerActionOrigin_SteamDeck_LeftStick_DPadWest,
k_EControllerActionOrigin_SteamDeck_LeftStick_DPadEast,
k_EControllerActionOrigin_SteamDeck_LeftStick_Touch,
k_EControllerActionOrigin_SteamDeck_RightStick_Move,
k_EControllerActionOrigin_SteamDeck_R3,
k_EControllerActionOrigin_SteamDeck_RightStick_DPadNorth,
k_EControllerActionOrigin_SteamDeck_RightStick_DPadSouth,
k_EControllerActionOrigin_SteamDeck_RightStick_DPadWest,
k_EControllerActionOrigin_SteamDeck_RightStick_DPadEast,
k_EControllerActionOrigin_SteamDeck_RightStick_Touch,
k_EControllerActionOrigin_SteamDeck_L4,
k_EControllerActionOrigin_SteamDeck_R4,
k_EControllerActionOrigin_SteamDeck_L5,
k_EControllerActionOrigin_SteamDeck_R5,
k_EControllerActionOrigin_SteamDeck_DPad_Move,
k_EControllerActionOrigin_SteamDeck_DPad_North,
k_EControllerActionOrigin_SteamDeck_DPad_South,
k_EControllerActionOrigin_SteamDeck_DPad_West,
k_EControllerActionOrigin_SteamDeck_DPad_East,
k_EControllerActionOrigin_SteamDeck_Gyro_Move,
k_EControllerActionOrigin_SteamDeck_Gyro_Pitch,
k_EControllerActionOrigin_SteamDeck_Gyro_Yaw,
k_EControllerActionOrigin_SteamDeck_Gyro_Roll,
k_EControllerActionOrigin_SteamDeck_Reserved1,
k_EControllerActionOrigin_SteamDeck_Reserved2,
k_EControllerActionOrigin_SteamDeck_Reserved3,
k_EControllerActionOrigin_SteamDeck_Reserved4,
k_EControllerActionOrigin_SteamDeck_Reserved5,
k_EControllerActionOrigin_SteamDeck_Reserved6,
k_EControllerActionOrigin_SteamDeck_Reserved7,
k_EControllerActionOrigin_SteamDeck_Reserved8,
k_EControllerActionOrigin_SteamDeck_Reserved9,
k_EControllerActionOrigin_SteamDeck_Reserved10,
k_EControllerActionOrigin_SteamDeck_Reserved11,
k_EControllerActionOrigin_SteamDeck_Reserved12,
k_EControllerActionOrigin_SteamDeck_Reserved13,
k_EControllerActionOrigin_SteamDeck_Reserved14,
k_EControllerActionOrigin_SteamDeck_Reserved15,
k_EControllerActionOrigin_SteamDeck_Reserved16,
k_EControllerActionOrigin_SteamDeck_Reserved17,
k_EControllerActionOrigin_SteamDeck_Reserved18,
k_EControllerActionOrigin_SteamDeck_Reserved19,
k_EControllerActionOrigin_SteamDeck_Reserved20,
k_EControllerActionOrigin_Switch_JoyConButton_N, // With a Horizontal JoyCon this will be Y or what would be Dpad Right when vertical
k_EControllerActionOrigin_Switch_JoyConButton_E, // X
k_EControllerActionOrigin_Switch_JoyConButton_S, // A
k_EControllerActionOrigin_Switch_JoyConButton_W, // B
k_EControllerActionOrigin_PS5_LeftGrip,
k_EControllerActionOrigin_PS5_RightGrip,
k_EControllerActionOrigin_PS5_LeftFn,
k_EControllerActionOrigin_PS5_RightFn,
k_EControllerActionOrigin_Horipad_M1,
k_EControllerActionOrigin_Horipad_M2,
k_EControllerActionOrigin_Horipad_L4,
k_EControllerActionOrigin_Horipad_R4,
k_EControllerActionOrigin_Count, // If Steam has added support for new controllers origins will go here.
k_EControllerActionOrigin_MaximumPossibleValue = 32767, // Origins are currently a maximum of 16 bits.
};
#ifndef ISTEAMINPUT_H
enum EXboxOrigin
{
k_EXboxOrigin_A,
k_EXboxOrigin_B,
k_EXboxOrigin_X,
k_EXboxOrigin_Y,
k_EXboxOrigin_LeftBumper,
k_EXboxOrigin_RightBumper,
k_EXboxOrigin_Menu, //Start
k_EXboxOrigin_View, //Back
k_EXboxOrigin_LeftTrigger_Pull,
k_EXboxOrigin_LeftTrigger_Click,
k_EXboxOrigin_RightTrigger_Pull,
k_EXboxOrigin_RightTrigger_Click,
k_EXboxOrigin_LeftStick_Move,
k_EXboxOrigin_LeftStick_Click,
k_EXboxOrigin_LeftStick_DPadNorth,
k_EXboxOrigin_LeftStick_DPadSouth,
k_EXboxOrigin_LeftStick_DPadWest,
k_EXboxOrigin_LeftStick_DPadEast,
k_EXboxOrigin_RightStick_Move,
k_EXboxOrigin_RightStick_Click,
k_EXboxOrigin_RightStick_DPadNorth,
k_EXboxOrigin_RightStick_DPadSouth,
k_EXboxOrigin_RightStick_DPadWest,
k_EXboxOrigin_RightStick_DPadEast,
k_EXboxOrigin_DPad_North,
k_EXboxOrigin_DPad_South,
k_EXboxOrigin_DPad_West,
k_EXboxOrigin_DPad_East,
};
enum ESteamInputType
{
k_ESteamInputType_Unknown,
k_ESteamInputType_SteamController,
k_ESteamInputType_XBox360Controller,
k_ESteamInputType_XBoxOneController,
k_ESteamInputType_GenericGamepad, // DirectInput controllers
k_ESteamInputType_PS4Controller,
k_ESteamInputType_AppleMFiController, // Unused
k_ESteamInputType_AndroidController, // Unused
k_ESteamInputType_SwitchJoyConPair, // Unused
k_ESteamInputType_SwitchJoyConSingle, // Unused
k_ESteamInputType_SwitchProController,
k_ESteamInputType_MobileTouch, // Steam Link App On-screen Virtual Controller
k_ESteamInputType_PS3Controller, // Currently uses PS4 Origins
k_ESteamInputType_PS5Controller, // Added in SDK 151
k_ESteamInputType_Count,
k_ESteamInputType_MaximumPossibleValue = 255,
};
#endif
enum ESteamControllerLEDFlag
{
k_ESteamControllerLEDFlag_SetColor,
k_ESteamControllerLEDFlag_RestoreUserDefault
};
// ControllerHandle_t is used to refer to a specific controller.
// This handle will consistently identify a controller, even if it is disconnected and re-connected
typedef uint64 ControllerHandle_t;
// These handles are used to refer to a specific in-game action or action set
// All action handles should be queried during initialization for performance reasons
typedef uint64 ControllerActionSetHandle_t;
typedef uint64 ControllerDigitalActionHandle_t;
typedef uint64 ControllerAnalogActionHandle_t;
#pragma pack( push, 1 )
#ifdef ISTEAMINPUT_H
#define ControllerAnalogActionData_t InputAnalogActionData_t
#define ControllerDigitalActionData_t InputDigitalActionData_t
#define ControllerMotionData_t InputMotionData_t
#else
struct ControllerAnalogActionData_t
{
// Type of data coming from this action, this will match what got specified in the action set
EControllerSourceMode eMode;
// The current state of this action; will be delta updates for mouse actions
float x, y;
// Whether or not this action is currently available to be bound in the active action set
bool bActive;
};
struct ControllerDigitalActionData_t
{
// The current state of this action; will be true if currently pressed
bool bState;
// Whether or not this action is currently available to be bound in the active action set
bool bActive;
};
struct ControllerMotionData_t
{
// Sensor-fused absolute rotation; will drift in heading
float rotQuatX;
float rotQuatY;
float rotQuatZ;
float rotQuatW;
// Positional acceleration
float posAccelX;
float posAccelY;
float posAccelZ;
// Angular velocity
float rotVelX;
float rotVelY;
float rotVelZ;
};
#endif
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Steam Input API
//-----------------------------------------------------------------------------
class ISteamController
{
public:
// Init and Shutdown must be called when starting/ending use of this interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
// Synchronize API state with the latest Steam Controller inputs available. This
// is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest
// possible latency, you call this directly before reading controller state. This must
// be called from somewhere before GetConnectedControllers will return any handles
virtual void RunFrame() = 0;
// Enumerate currently connected controllers
// handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles
// Returns the number of handles written to handlesOut
virtual int GetConnectedControllers( STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_COUNT, Receives list of connected controllers ) ControllerHandle_t *handlesOut ) = 0;
//-----------------------------------------------------------------------------
// ACTION SETS
//-----------------------------------------------------------------------------
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0;
// Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')
// This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in
// your state loops, instead of trying to place it in all of your state transitions.
virtual void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0;
virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0;
// ACTION SET LAYERS
virtual void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
virtual void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
virtual void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle ) = 0;
// Enumerate currently active layers
// handlesOut should point to a STEAM_CONTROLLER_MAX_ACTIVE_LAYERS sized array of ControllerActionSetHandle_t handles.
// Returns the number of handles written to handlesOut
virtual int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ACTIVE_LAYERS, Receives list of active layers ) ControllerActionSetHandle_t *handlesOut ) = 0;
//-----------------------------------------------------------------------------
// ACTIONS
//-----------------------------------------------------------------------------
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0;
// Returns the current state of the supplied digital game action
virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0;
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles. The EControllerActionOrigin enum will get extended as support for new controller controllers gets added to
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
virtual int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ORIGINS, Receives list of aciton origins ) EControllerActionOrigin *originsOut ) = 0;
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0;
// Returns the current state of these supplied analog game action
virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0;
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles. The EControllerActionOrigin enum will get extended as support for new controller controllers gets added to
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
virtual int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ORIGINS, Receives list of action origins ) EControllerActionOrigin *originsOut ) = 0;
// Get a local path to art for on-screen glyph for a particular origin - this call is cheap
virtual const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
// Returns a localized string (from Steam's language setting) for the specified origin - this call is serialized
virtual const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 0;
// Returns raw motion data from the specified controller
virtual ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle ) = 0;
//-----------------------------------------------------------------------------
// OUTPUTS
//-----------------------------------------------------------------------------
// Trigger a haptic pulse on a controller
virtual void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0;
// Trigger a pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times.
// nFlags is currently unused and reserved for future use.
virtual void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0;
// Trigger a vibration event on supported controllers.
virtual void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0;
// Set the controller LED color on supported controllers.
virtual void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0;
//-----------------------------------------------------------------------------
// Utility functions available without using the rest of Steam Input API
//-----------------------------------------------------------------------------
// Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode
// If the user is not in Big Picture Mode it will open up the binding in a new window
virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0;
// Returns the input type for a particular handle - unlike EControllerActionOrigin which update with Steam and may return unrecognized values
// ESteamInputType will remain static and only return valid values from your SDK version
virtual ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) = 0;
// Returns the associated controller handle for the specified emulated gamepad - can be used with the above 2 functions
// to identify controllers presented to your game over Xinput. Returns 0 if the Xinput index isn't associated with Steam Input
virtual ControllerHandle_t GetControllerForGamepadIndex( int nIndex ) = 0;
// Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index
virtual int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle ) = 0;
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
// Get a local path to art for on-screen glyph for a particular Xbox controller origin.
virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0;
// Get the equivalent ActionOrigin for a given Xbox controller origin this can be chained with GetGlyphForActionOrigin to provide future proof glyphs for
// non-Steam Input API action games. Note - this only translates the buttons directly and doesn't take into account any remapping a user has made in their configuration
virtual EControllerActionOrigin GetActionOriginFromXboxOrigin( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin ) = 0;
// Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EControllerActionOrigin_None
virtual EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin ) = 0;
// Get the binding revision for a given device. Returns false if the handle was not valid or if a mapping is not yet loaded for the device
virtual bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor ) = 0;
};
#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController008"
// Global interface accessor
inline ISteamController *SteamController();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamController *, SteamController, STEAMCONTROLLER_INTERFACE_VERSION );
#endif // ISTEAMCONTROLLER_H

View File

@ -0,0 +1,169 @@
/* SIE CONFIDENTIAL
* $PSLibId$
* Copyright (C) 2019 Sony Interactive Entertainment Inc.
* All Rights Reserved.
*/
#ifndef _SCE_PAD_TRIGGER_EFFECT_H
#define _SCE_PAD_TRIGGER_EFFECT_H
#define SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_L2 0x01
#define SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_R2 0x02
#define SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_L2 0
#define SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_R2 1
#define SCE_PAD_TRIGGER_EFFECT_TRIGGER_NUM 2
/* Definition of control point num */
#define SCE_PAD_TRIGGER_EFFECT_CONTROL_POINT_NUM 10
typedef enum ScePadTriggerEffectMode{
SCE_PAD_TRIGGER_EFFECT_MODE_OFF,
SCE_PAD_TRIGGER_EFFECT_MODE_FEEDBACK,
SCE_PAD_TRIGGER_EFFECT_MODE_WEAPON,
SCE_PAD_TRIGGER_EFFECT_MODE_VIBRATION,
SCE_PAD_TRIGGER_EFFECT_MODE_MULTIPLE_POSITION_FEEDBACK,
SCE_PAD_TRIGGER_EFFECT_MODE_SLOPE_FEEDBACK,
SCE_PAD_TRIGGER_EFFECT_MODE_MULTIPLE_POSITION_VIBRATION,
} ScePadTriggerEffectMode;
/**
*E
* @brief parameter for setting the trigger effect to off mode.
* Off Mode: Stop trigger effect.
**/
typedef struct ScePadTriggerEffectOffParam{
uint8_t padding[48];
} ScePadTriggerEffectOffParam;
/**
*E
* @brief parameter for setting the trigger effect to Feedback mode.
* Feedback Mode: The motor arm pushes back trigger.
* Trigger obtains stiffness at specified position.
**/
typedef struct ScePadTriggerEffectFeedbackParam{
uint8_t position; /*E position where the strength of target trigger start changing(0~9). */
uint8_t strength; /*E strength that the motor arm pushes back target trigger(0~8 (0: Same as Off mode)). */
uint8_t padding[46];
} ScePadTriggerEffectFeedbackParam;
/**
*E
* @brief parameter for setting the trigger effect to Weapon mode.
* Weapon Mode: Emulate weapon like gun trigger.
**/
typedef struct ScePadTriggerEffectWeaponParam{
uint8_t startPosition; /*E position where the stiffness of trigger start changing(2~7). */
uint8_t endPosition; /*E position where the stiffness of trigger finish changing(startPosition+1~8). */
uint8_t strength; /*E strength of gun trigger(0~8 (0: Same as Off mode)). */
uint8_t padding[45];
} ScePadTriggerEffectWeaponParam;
/**
*E
* @brief parameter for setting the trigger effect to Vibration mode.
* Vibration Mode: Vibrates motor arm around specified position.
**/
typedef struct ScePadTriggerEffectVibrationParam{
uint8_t position; /*E position where the motor arm start vibrating(0~9). */
uint8_t amplitude; /*E vibration amplitude(0~8 (0: Same as Off mode)). */
uint8_t frequency; /*E vibration frequency(0~255[Hz] (0: Same as Off mode)). */
uint8_t padding[45];
} ScePadTriggerEffectVibrationParam;
/**
*E
* @brief parameter for setting the trigger effect to ScePadTriggerEffectMultiplePositionFeedbackParam mode.
* Multi Position Feedback Mode: The motor arm pushes back trigger.
* Trigger obtains specified stiffness at each control point.
**/
typedef struct ScePadTriggerEffectMultiplePositionFeedbackParam{
uint8_t strength[SCE_PAD_TRIGGER_EFFECT_CONTROL_POINT_NUM]; /*E strength that the motor arm pushes back target trigger at position(0~8 (0: Same as Off mode)).
* strength[0] means strength of motor arm at position0.
* strength[1] means strength of motor arm at position1.
* ...
* */
uint8_t padding[38];
} ScePadTriggerEffectMultiplePositionFeedbackParam;
/**
*E
* @brief parameter for setting the trigger effect to Feedback3 mode.
* Slope Feedback Mode: The motor arm pushes back trigger between two spedified control points.
* Stiffness of the trigger is changing depending on the set place.
**/
typedef struct ScePadTriggerEffectSlopeFeedbackParam{
uint8_t startPosition; /*E position where the strength of target trigger start changing(0~endPosition). */
uint8_t endPosition; /*E position where the strength of target trigger finish changing(startPosition+1~9). */
uint8_t startStrength; /*E strength when trigger's position is startPosition(1~8) */
uint8_t endStrength; /*E strength when trigger's position is endPosition(1~8) */
uint8_t padding[44];
} ScePadTriggerEffectSlopeFeedbackParam;
/**
*E
* @brief parameter for setting the trigger effect to Vibration2 mode.
* Multi Position Vibration Mode: Vibrates motor arm around specified control point.
* Trigger vibrates specified amplitude at each control point.
**/
typedef struct ScePadTriggerEffectMultiplePositionVibrationParam{
uint8_t frequency; /*E vibration frequency(0~255 (0: Same as Off mode)) */
uint8_t amplitude[SCE_PAD_TRIGGER_EFFECT_CONTROL_POINT_NUM]; /*E vibration amplitude at position(0~8 (0: Same as Off mode)).
* amplitude[0] means amplitude of vibration at position0.
* amplitude[1] means amplitude of vibration at position1.
* ...
* */
uint8_t padding[37];
} ScePadTriggerEffectMultiplePositionVibrationParam;
/**
*E
* @brief parameter for setting the trigger effect mode.
**/
typedef union ScePadTriggerEffectCommandData{
ScePadTriggerEffectOffParam offParam;
ScePadTriggerEffectFeedbackParam feedbackParam;
ScePadTriggerEffectWeaponParam weaponParam;
ScePadTriggerEffectVibrationParam vibrationParam;
ScePadTriggerEffectMultiplePositionFeedbackParam multiplePositionFeedbackParam;
ScePadTriggerEffectSlopeFeedbackParam slopeFeedbackParam;
ScePadTriggerEffectMultiplePositionVibrationParam multiplePositionVibrationParam;
} ScePadTriggerEffectCommandData;
/**
*E
* @brief parameter for setting the trigger effect.
**/
typedef struct ScePadTriggerEffectCommand{
ScePadTriggerEffectMode mode;
uint8_t padding[4];
ScePadTriggerEffectCommandData commandData;
} ScePadTriggerEffectCommand;
/**
*E
* @brief parameter for the scePadSetTriggerEffect function.
**/
typedef struct ScePadTriggerEffectParam{
uint8_t triggerMask; /*E Set trigger mask to activate trigger effect commands.
* SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_L2 : 0x01
* SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_R2 : 0x02
* */
uint8_t padding[7];
ScePadTriggerEffectCommand command[SCE_PAD_TRIGGER_EFFECT_TRIGGER_NUM]; /*E command[SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_L2] is for L2 trigger setting
* and param[SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_R2] is for R2 trgger setting.
* */
} ScePadTriggerEffectParam;
#if defined(__cplusplus) && __cplusplus >= 201103L
static_assert( sizeof( ScePadTriggerEffectParam ) == 120, "ScePadTriggerEffectParam has incorrect size" );
#endif
#endif /* _SCE_PAD_TRIGGER_EFFECT_H */

View File

@ -0,0 +1,714 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: interface to both friends list data and general information about users
//
//=============================================================================
#ifndef ISTEAMFRIENDS_H
#define ISTEAMFRIENDS_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: set of relationships to other users
//-----------------------------------------------------------------------------
enum EFriendRelationship
{
k_EFriendRelationshipNone = 0,
k_EFriendRelationshipBlocked = 1, // this doesn't get stored; the user has just done an Ignore on an friendship invite
k_EFriendRelationshipRequestRecipient = 2,
k_EFriendRelationshipFriend = 3,
k_EFriendRelationshipRequestInitiator = 4,
k_EFriendRelationshipIgnored = 5, // this is stored; the user has explicit blocked this other user from comments/chat/etc
k_EFriendRelationshipIgnoredFriend = 6,
k_EFriendRelationshipSuggested_DEPRECATED = 7, // was used by the original implementation of the facebook linking feature, but now unused.
// keep this updated
k_EFriendRelationshipMax = 8,
};
// maximum length of friend group name (not including terminating nul!)
const int k_cchMaxFriendsGroupName = 64;
// maximum number of groups a single user is allowed
const int k_cFriendsGroupLimit = 100;
// friends group identifier type
typedef int16 FriendsGroupID_t;
// invalid friends group identifier constant
const FriendsGroupID_t k_FriendsGroupID_Invalid = -1;
const int k_cEnumerateFollowersMax = 50;
//-----------------------------------------------------------------------------
// Purpose: list of states a friend can be in
//-----------------------------------------------------------------------------
enum EPersonaState
{
k_EPersonaStateOffline = 0, // friend is not currently logged on
k_EPersonaStateOnline = 1, // friend is logged on
k_EPersonaStateBusy = 2, // user is on, but busy
k_EPersonaStateAway = 3, // auto-away feature
k_EPersonaStateSnooze = 4, // auto-away for a long time
k_EPersonaStateLookingToTrade = 5, // Online, trading
k_EPersonaStateLookingToPlay = 6, // Online, wanting to play
k_EPersonaStateInvisible = 7, // Online, but appears offline to friends. This status is never published to clients.
k_EPersonaStateMax,
};
//-----------------------------------------------------------------------------
// Purpose: flags for enumerating friends list, or quickly checking a the relationship between users
//-----------------------------------------------------------------------------
enum EFriendFlags
{
k_EFriendFlagNone = 0x00,
k_EFriendFlagBlocked = 0x01,
k_EFriendFlagFriendshipRequested = 0x02,
k_EFriendFlagImmediate = 0x04, // "regular" friend
k_EFriendFlagClanMember = 0x08,
k_EFriendFlagOnGameServer = 0x10,
// k_EFriendFlagHasPlayedWith = 0x20, // not currently used
// k_EFriendFlagFriendOfFriend = 0x40, // not currently used
k_EFriendFlagRequestingFriendship = 0x80,
k_EFriendFlagRequestingInfo = 0x100,
k_EFriendFlagIgnored = 0x200,
k_EFriendFlagIgnoredFriend = 0x400,
// k_EFriendFlagSuggested = 0x800, // not used
k_EFriendFlagChatMember = 0x1000,
k_EFriendFlagAll = 0xFFFF,
};
// friend game played information
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct FriendGameInfo_t
{
CGameID m_gameID;
uint32 m_unGameIP;
uint16 m_usGamePort;
uint16 m_usQueryPort;
CSteamID m_steamIDLobby;
};
#pragma pack( pop )
// special values for FriendGameInfo_t::m_usQueryPort
const uint16 k_usFriendGameInfoQueryPort_NotInitialized = 0xFFFF; // We haven't asked the GS for this query port's actual value yet. Was #define QUERY_PORT_NOT_INITIALIZED in older versions of Steamworks SDK.
const uint16 k_usFriendGameInfoQueryPort_Error = 0xFFFE; // We were unable to get the query port for this server. Was #define QUERY_PORT_ERROR in older versions of Steamworks SDK.
// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16.
// The UTF-8 version has to be very generous to accomodate characters that get large when encoded
// in UTF-8.
enum
{
k_cchPersonaNameMax = 128,
k_cwchPersonaNameMax = 32,
};
// size limit on chat room or member metadata
const uint32 k_cubChatMetadataMax = 8192;
// size limits on Rich Presence data
enum { k_cchMaxRichPresenceKeys = 30 };
enum { k_cchMaxRichPresenceKeyLength = 64 };
enum { k_cchMaxRichPresenceValueLength = 256 };
// These values are passed as parameters to the store
enum EOverlayToStoreFlag
{
k_EOverlayToStoreFlag_None = 0,
k_EOverlayToStoreFlag_AddToCart = 1,
k_EOverlayToStoreFlag_AddToCartAndShow = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Tells Steam where to place the browser window inside the overlay
//-----------------------------------------------------------------------------
enum EActivateGameOverlayToWebPageMode
{
k_EActivateGameOverlayToWebPageMode_Default = 0, // Browser will open next to all other windows that the user has open in the overlay.
// The window will remain open, even if the user closes then re-opens the overlay.
k_EActivateGameOverlayToWebPageMode_Modal = 1 // Browser will be opened in a special overlay configuration which hides all other windows
// that the user has open in the overlay. When the user closes the overlay, the browser window
// will also close. When the user closes the browser window, the overlay will automatically close.
};
//-----------------------------------------------------------------------------
// Purpose: See GetProfileItemPropertyString and GetProfileItemPropertyUint
//-----------------------------------------------------------------------------
enum ECommunityProfileItemType
{
k_ECommunityProfileItemType_AnimatedAvatar = 0,
k_ECommunityProfileItemType_AvatarFrame = 1,
k_ECommunityProfileItemType_ProfileModifier = 2,
k_ECommunityProfileItemType_ProfileBackground = 3,
k_ECommunityProfileItemType_MiniProfileBackground = 4,
};
enum ECommunityProfileItemProperty
{
k_ECommunityProfileItemProperty_ImageSmall = 0, // string
k_ECommunityProfileItemProperty_ImageLarge = 1, // string
k_ECommunityProfileItemProperty_InternalName = 2, // string
k_ECommunityProfileItemProperty_Title = 3, // string
k_ECommunityProfileItemProperty_Description = 4, // string
k_ECommunityProfileItemProperty_AppID = 5, // uint32
k_ECommunityProfileItemProperty_TypeID = 6, // uint32
k_ECommunityProfileItemProperty_Class = 7, // uint32
k_ECommunityProfileItemProperty_MovieWebM = 8, // string
k_ECommunityProfileItemProperty_MovieMP4 = 9, // string
k_ECommunityProfileItemProperty_MovieWebMSmall = 10, // string
k_ECommunityProfileItemProperty_MovieMP4Small = 11, // string
};
//-----------------------------------------------------------------------------
// Purpose: interface to accessing information about individual users,
// that can be a friend, in a group, on a game server or in a lobby with the local user
//-----------------------------------------------------------------------------
class ISteamFriends
{
public:
// returns the local players name - guaranteed to not be NULL.
// this is the same name as on the users community profile page
// this is stored in UTF-8 format
// like all the other interface functions that return a char *, it's important that this pointer is not saved
// off; it will eventually be free'd or re-allocated
virtual const char *GetPersonaName() = 0;
// gets the status of the current user
virtual EPersonaState GetPersonaState() = 0;
// friend iteration
// takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria
// then GetFriendByIndex() can then be used to return the id's of each of those users
virtual int GetFriendCount( int iFriendFlags ) = 0;
// returns the steamID of a user
// iFriend is a index of range [0, GetFriendCount())
// iFriendsFlags must be the same value as used in GetFriendCount()
// the returned CSteamID can then be used by all the functions below to access details about the user
virtual CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) = 0;
// returns a relationship to a user
virtual EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) = 0;
// returns the current status of the specified user
// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0;
// returns the name another user - guaranteed to not be NULL.
// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
//
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo ) = 0;
// accesses old friends names - returns an empty string when their are no more items in the history
virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0;
// friends steam level
virtual int GetFriendSteamLevel( CSteamID steamIDFriend ) = 0;
// Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.
// DEPRECATED: GetPersonaName follows the Steam nickname preferences, so apps shouldn't need to care about nicknames explicitly.
virtual const char *GetPlayerNickname( CSteamID steamIDPlayer ) = 0;
// friend grouping (tag) apis
// returns the number of friends groups
virtual int GetFriendsGroupCount() = 0;
// returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)
virtual FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG ) = 0;
// returns the name for the given friends group (NULL in the case of invalid friends group IDs)
virtual const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID ) = 0;
// returns the number of members in a given friends group
virtual int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID ) = 0;
// gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid
virtual void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, STEAM_OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount ) = 0;
// returns true if the specified user meets any of the criteria specified in iFriendFlags
// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0;
// clan (group) iteration and access functions
virtual int GetClanCount() = 0;
virtual CSteamID GetClanByIndex( int iClan ) = 0;
virtual const char *GetClanName( CSteamID steamIDClan ) = 0;
virtual const char *GetClanTag( CSteamID steamIDClan ) = 0;
// returns the most recent information we have about what's happening in a clan
virtual bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting ) = 0;
// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
STEAM_CALL_RESULT( DownloadClanActivityCountsResult_t )
virtual SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) = 0;
// iterators for getting users in a chat room, lobby, game server or clan
// note that large clans that cannot be iterated by the local user
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
// steamIDSource can be the steamID of a group, game server, lobby or chat room
virtual int GetFriendCountFromSource( CSteamID steamIDSource ) = 0;
virtual CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) = 0;
// returns true if the local user can see that steamIDUser is a member or in steamIDSource
virtual bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource ) = 0;
// User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)
virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0;
// activates the game overlay, with an optional dialog to open
// valid options include "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements",
// "chatroomgroup/nnnn"
virtual void ActivateGameOverlay( const char *pchDialog ) = 0;
// activates game overlay to a specific place
// valid options are
// "steamid" - opens the overlay web browser to the specified user or groups profile
// "chat" - opens a chat window to the specified user, or joins the group chat
// "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API
// "stats" - opens the overlay web browser to the specified user's stats
// "achievements" - opens the overlay web browser to the specified user's achievements
// "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend
// "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend
// "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite
// "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite
virtual void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID ) = 0;
// activates game overlay web browser directly to the specified URL
// full address with protocol type is required, e.g. http://www.steamgames.com/
virtual void ActivateGameOverlayToWebPage( const char *pchURL, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default ) = 0;
// activates game overlay to store page for app
virtual void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag ) = 0;
// Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is
// in game
virtual void SetPlayedWith( CSteamID steamIDUserPlayedWith ) = 0;
// activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.
virtual void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby ) = 0;
// gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int GetSmallFriendAvatar( CSteamID steamIDFriend ) = 0;
// gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int GetMediumFriendAvatar( CSteamID steamIDFriend ) = 0;
// gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
// returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again
virtual int GetLargeFriendAvatar( CSteamID steamIDFriend ) = 0;
// requests information about a user - persona name & avatar
// if bRequireNameOnly is set, then the avatar of a user isn't downloaded
// - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them
// if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved
// if returns false, it means that we already have all the details about that user, and functions can be called immediately
virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0;
// requests information about a clan officer list
// when complete, data is returned in ClanOfficerListResponse_t call result
// this makes available the calls below
// you can only ask about clans that a user is a member of
// note that this won't download avatars automatically; if you get an officer,
// and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar
STEAM_CALL_RESULT( ClanOfficerListResponse_t )
virtual SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) = 0;
// iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed
// returns the steamID of the clan owner
virtual CSteamID GetClanOwner( CSteamID steamIDClan ) = 0;
// returns the number of officers in a clan (including the owner)
virtual int GetClanOfficerCount( CSteamID steamIDClan ) = 0;
// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
virtual CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer ) = 0;
// Rich Presence data is automatically shared between friends who are in the same game
// Each user has a set of Key/Value pairs
// Note the following limits: k_cchMaxRichPresenceKeys, k_cchMaxRichPresenceKeyLength, k_cchMaxRichPresenceValueLength
// There are five magic keys:
// "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list
// "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game
// "steam_display" - Names a rich presence localization token that will be displayed in the viewing user's selected language
// in the Steam client UI. For more info: https://partner.steamgames.com/doc/api/ISteamFriends#richpresencelocalization
// "steam_player_group" - When set, indicates to the Steam client that the player is a member of a particular group. Players in the same group
// may be organized together in various places in the Steam UI.
// "steam_player_group_size" - When set, indicates the total number of players in the steam_player_group. The Steam client may use this number to
// display additional information about a group when all of the members are not part of a user's friends list.
// GetFriendRichPresence() returns an empty string "" if no value is set
// SetRichPresence() to a NULL or an empty string deletes the key
// You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()
// and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)
virtual bool SetRichPresence( const char *pchKey, const char *pchValue ) = 0;
virtual void ClearRichPresence() = 0;
virtual const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey ) = 0;
virtual int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) = 0;
virtual const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) = 0;
// Requests rich presence for a specific user.
virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0;
// Rich invite support.
// If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.
// (Or you can configure your game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.)
virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;
// recently-played-with friends iteration
// this iterates the entire list of users recently played with, across games
// GetFriendCoplayTime() returns as a unix time
virtual int GetCoplayFriendCount() = 0;
virtual CSteamID GetCoplayFriend( int iCoplayFriend ) = 0;
virtual int GetFriendCoplayTime( CSteamID steamIDFriend ) = 0;
virtual AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) = 0;
// chat interface for games
// this allows in-game access to group (clan) chats from in the game
// the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay
// use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat
STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t )
virtual SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) = 0;
virtual bool LeaveClanChatRoom( CSteamID steamIDClan ) = 0;
virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0;
virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0;
virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0;
virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, STEAM_OUT_STRUCT() CSteamID *psteamidChatter ) = 0;
virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0;
// interact with the Steam (game overlay / desktop)
virtual bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0;
// peer-to-peer chat interception
// this is so you can show P2P chats inline in the game
virtual bool SetListenForFriendsMessages( bool bInterceptEnabled ) = 0;
virtual bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend ) = 0;
virtual int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
// following apis
STEAM_CALL_RESULT( FriendsGetFollowerCount_t )
virtual SteamAPICall_t GetFollowerCount( CSteamID steamID ) = 0;
STEAM_CALL_RESULT( FriendsIsFollowing_t )
virtual SteamAPICall_t IsFollowing( CSteamID steamID ) = 0;
STEAM_CALL_RESULT( FriendsEnumerateFollowingList_t )
virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0;
virtual bool IsClanPublic( CSteamID steamIDClan ) = 0;
virtual bool IsClanOfficialGameGroup( CSteamID steamIDClan ) = 0;
/// Return the number of chats (friends or chat rooms) with unread messages.
/// A "priority" message is one that would generate some sort of toast or
/// notification, and depends on user settings.
///
/// You can register for UnreadChatMessagesChanged_t callbacks to know when this
/// has potentially changed.
virtual int GetNumChatsWithUnreadPriorityMessages() = 0;
// activates game overlay to open the remote play together invite dialog. Invitations will be sent for remote play together
virtual void ActivateGameOverlayRemotePlayTogetherInviteDialog( CSteamID steamIDLobby ) = 0;
// Call this before calling ActivateGameOverlayToWebPage() to have the Steam Overlay Browser block navigations
// to your specified protocol (scheme) uris and instead dispatch a OverlayBrowserProtocolNavigation_t callback to your game.
// ActivateGameOverlayToWebPage() must have been called with k_EActivateGameOverlayToWebPageMode_Modal
virtual bool RegisterProtocolInOverlayBrowser( const char *pchProtocol ) = 0;
// Activates the game overlay to open an invite dialog that will send the provided Rich Presence connect string to selected friends
virtual void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString ) = 0;
// Steam Community items equipped by a user on their profile
// You can register for EquippedProfileItemsChanged_t to know when a friend has changed their equipped profile items
STEAM_CALL_RESULT( EquippedProfileItems_t )
virtual SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID ) = 0;
virtual bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType ) = 0;
virtual const char *GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop ) = 0;
virtual uint32 GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop ) = 0;
};
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends018"
// Global interface accessor
inline ISteamFriends *SteamFriends();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamFriends *, SteamFriends, STEAMFRIENDS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: called when a friends' status changes
//-----------------------------------------------------------------------------
struct PersonaStateChange_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 4 };
uint64 m_ulSteamID; // steamID of the friend who changed
int m_nChangeFlags; // what's changed
};
// used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user
// these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend
enum EPersonaChange
{
k_EPersonaChangeName = 0x0001,
k_EPersonaChangeStatus = 0x0002,
k_EPersonaChangeComeOnline = 0x0004,
k_EPersonaChangeGoneOffline = 0x0008,
k_EPersonaChangeGamePlayed = 0x0010,
k_EPersonaChangeGameServer = 0x0020,
k_EPersonaChangeAvatar = 0x0040,
k_EPersonaChangeJoinedSource= 0x0080,
k_EPersonaChangeLeftSource = 0x0100,
k_EPersonaChangeRelationshipChanged = 0x0200,
k_EPersonaChangeNameFirstSet = 0x0400,
k_EPersonaChangeBroadcast = 0x0800,
k_EPersonaChangeNickname = 0x1000,
k_EPersonaChangeSteamLevel = 0x2000,
k_EPersonaChangeRichPresence = 0x4000,
};
//-----------------------------------------------------------------------------
// Purpose: posted when game overlay activates or deactivates
// the game can use this to be pause or resume single player games
//-----------------------------------------------------------------------------
struct GameOverlayActivated_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 31 };
uint8 m_bActive; // true if it's just been activated, false otherwise
bool m_bUserInitiated; // true if the user asked for the overlay to be activated/deactivated
AppId_t m_nAppID; // the appID of the game (should always be the current game)
uint32 m_dwOverlayPID; // used internally
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a different game server from their friends list
// game client should attempt to connect to specified server when this is received
//-----------------------------------------------------------------------------
struct GameServerChangeRequested_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 32 };
char m_rgchServer[64]; // server address ("127.0.0.1:27015", "tf2.valvesoftware.com")
char m_rgchPassword[64]; // server password, if any
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a lobby from their friends list
// game client should attempt to connect to specified lobby when this is received
//-----------------------------------------------------------------------------
struct GameLobbyJoinRequested_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 33 };
CSteamID m_steamIDLobby;
// The friend they did the join via (will be invalid if not directly via a friend)
CSteamID m_steamIDFriend;
};
//-----------------------------------------------------------------------------
// Purpose: called when an avatar is loaded in from a previous GetLargeFriendAvatar() call
// if the image wasn't already available
//-----------------------------------------------------------------------------
struct AvatarImageLoaded_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 34 };
CSteamID m_steamID; // steamid the avatar has been loaded for
int m_iImage; // the image index of the now loaded image
int m_iWide; // width of the loaded image
int m_iTall; // height of the loaded image
};
//-----------------------------------------------------------------------------
// Purpose: marks the return of a request officer list call
//-----------------------------------------------------------------------------
struct ClanOfficerListResponse_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 35 };
CSteamID m_steamIDClan;
int m_cOfficers;
uint8 m_bSuccess;
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating updated data about friends rich presence information
//-----------------------------------------------------------------------------
struct FriendRichPresenceUpdate_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 36 };
CSteamID m_steamIDFriend; // friend who's rich presence has changed
AppId_t m_nAppID; // the appID of the game (should always be the current game)
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a game from their friends list
// rich presence will have been set with the "connect" key which is set here
//-----------------------------------------------------------------------------
struct GameRichPresenceJoinRequested_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 37 };
CSteamID m_steamIDFriend; // the friend they did the join via (will be invalid if not directly via a friend)
char m_rgchConnect[k_cchMaxRichPresenceValueLength];
};
//-----------------------------------------------------------------------------
// Purpose: a chat message has been received for a clan chat the game has joined
//-----------------------------------------------------------------------------
struct GameConnectedClanChatMsg_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 38 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
int m_iMessageID;
};
//-----------------------------------------------------------------------------
// Purpose: a user has joined a clan chat
//-----------------------------------------------------------------------------
struct GameConnectedChatJoin_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 39 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
};
//-----------------------------------------------------------------------------
// Purpose: a user has left the chat we're in
//-----------------------------------------------------------------------------
struct GameConnectedChatLeave_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 40 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
bool m_bKicked; // true if admin kicked
bool m_bDropped; // true if Steam connection dropped
};
//-----------------------------------------------------------------------------
// Purpose: a DownloadClanActivityCounts() call has finished
//-----------------------------------------------------------------------------
struct DownloadClanActivityCountsResult_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 41 };
bool m_bSuccess;
};
//-----------------------------------------------------------------------------
// Purpose: a JoinClanChatRoom() call has finished
//-----------------------------------------------------------------------------
struct JoinClanChatRoomCompletionResult_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 42 };
CSteamID m_steamIDClanChat;
EChatRoomEnterResponse m_eChatRoomEnterResponse;
};
//-----------------------------------------------------------------------------
// Purpose: a chat message has been received from a user
//-----------------------------------------------------------------------------
struct GameConnectedFriendChatMsg_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 43 };
CSteamID m_steamIDUser;
int m_iMessageID;
};
struct FriendsGetFollowerCount_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 44 };
EResult m_eResult;
CSteamID m_steamID;
int m_nCount;
};
struct FriendsIsFollowing_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 45 };
EResult m_eResult;
CSteamID m_steamID;
bool m_bIsFollowing;
};
struct FriendsEnumerateFollowingList_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 46 };
EResult m_eResult;
CSteamID m_rgSteamID[ k_cEnumerateFollowersMax ];
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
};
//-----------------------------------------------------------------------------
// Purpose: Invoked when the status of unread messages changes
//-----------------------------------------------------------------------------
struct UnreadChatMessagesChanged_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 48 };
};
//-----------------------------------------------------------------------------
// Purpose: Dispatched when an overlay browser instance is navigated to a protocol/scheme registered by RegisterProtocolInOverlayBrowser()
//-----------------------------------------------------------------------------
struct OverlayBrowserProtocolNavigation_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 49 };
char rgchURI[ 1024 ];
};
//-----------------------------------------------------------------------------
// Purpose: A user's equipped profile items have changed
//-----------------------------------------------------------------------------
struct EquippedProfileItemsChanged_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 50 };
CSteamID m_steamID;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
struct EquippedProfileItems_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 51 };
EResult m_eResult;
CSteamID m_steamID;
bool m_bHasAnimatedAvatar;
bool m_bHasAvatarFrame;
bool m_bHasProfileModifier;
bool m_bHasProfileBackground;
bool m_bHasMiniProfileBackground;
bool m_bFromCache;
};
#pragma pack( pop )
#endif // ISTEAMFRIENDS_H

View File

@ -0,0 +1,74 @@
//====== Copyright ©, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to the game coordinator for this application
//
//=============================================================================
#ifndef ISTEAMGAMECOORDINATOR
#define ISTEAMGAMECOORDINATOR
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
// list of possible return values from the ISteamGameCoordinator API
enum EGCResults
{
k_EGCResultOK = 0,
k_EGCResultNoMessage = 1, // There is no message in the queue
k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message
k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam
k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
};
//-----------------------------------------------------------------------------
// Purpose: Functions for sending and receiving messages from the Game Coordinator
// for this application
//-----------------------------------------------------------------------------
class ISteamGameCoordinator
{
public:
// sends a message to the Game Coordinator
virtual EGCResults SendMessage( uint32 unMsgType, const void *pubData, uint32 cubData ) = 0;
// returns true if there is a message waiting from the game coordinator
virtual bool IsMessageAvailable( uint32 *pcubMsgSize ) = 0;
// fills the provided buffer with the first message in the queue and returns k_EGCResultOK or
// returns k_EGCResultNoMessage if there is no message waiting. pcubMsgSize is filled with the message size.
// If the provided buffer is not large enough to fit the entire message, k_EGCResultBufferTooSmall is returned
// and the message remains at the head of the queue.
virtual EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
};
#define STEAMGAMECOORDINATOR_INTERFACE_VERSION "SteamGameCoordinator001"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// callback notification - A new message is available for reading from the message queue
struct GCMessageAvailable_t
{
enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 1 };
uint32 m_nMessageSize;
};
// callback notification - A message failed to make it to the GC. It may be down temporarily
struct GCMessageFailed_t
{
enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 2 };
};
#pragma pack( pop )
#endif // ISTEAMGAMECOORDINATOR

View File

@ -0,0 +1,394 @@
//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to steam for game servers
//
//=============================================================================
#ifndef ISTEAMGAMESERVER_H
#define ISTEAMGAMESERVER_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Functions for authenticating users via Steam to play on a game server
//-----------------------------------------------------------------------------
class ISteamGameServer
{
public:
//
// Basic server data. These properties, if set, must be set before before calling LogOn. They
// may not be changed after logged in.
//
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
STEAM_PRIVATE_API( virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; )
/// Game product identifier. This is currently used by the master server for version checking purposes.
/// It's a required field, but will eventually will go away, and the AppID will be used for this purpose.
virtual void SetProduct( const char *pszProduct ) = 0;
/// Description of the game. This is a required field and is displayed in the steam server browser....for now.
/// This is a required field, but it will go away eventually, as the data should be determined from the AppID.
virtual void SetGameDescription( const char *pszGameDescription ) = 0;
/// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning
/// this application is the original game, not a mod.
///
/// @see k_cbMaxGameServerGameDir
virtual void SetModDir( const char *pszModDir ) = 0;
/// Is this is a dedicated server? The default value is false.
virtual void SetDedicatedServer( bool bDedicated ) = 0;
//
// Login
//
/// Begin process to login to a persistent game server account
///
/// You need to register for callbacks to determine the result of this operation.
/// @see SteamServersConnected_t
/// @see SteamServerConnectFailure_t
/// @see SteamServersDisconnected_t
virtual void LogOn( const char *pszToken ) = 0;
/// Login to a generic, anonymous account.
///
/// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init,
/// but this is no longer the case.
virtual void LogOnAnonymous() = 0;
/// Begin process of logging game server out of steam
virtual void LogOff() = 0;
// status functions
virtual bool BLoggedOn() = 0;
virtual bool BSecure() = 0;
virtual CSteamID GetSteamID() = 0;
/// Returns true if the master server has requested a restart.
/// Only returns true once per request.
virtual bool WasRestartRequested() = 0;
//
// Server state. These properties may be changed at any time.
//
/// Max player count that will be reported to server browser and client queries
virtual void SetMaxPlayerCount( int cPlayersMax ) = 0;
/// Number of bots. Default value is zero
virtual void SetBotPlayerCount( int cBotplayers ) = 0;
/// Set the name of server as it will appear in the server browser
///
/// @see k_cbMaxGameServerName
virtual void SetServerName( const char *pszServerName ) = 0;
/// Set name of map to report in the server browser
///
/// @see k_cbMaxGameServerMapName
virtual void SetMapName( const char *pszMapName ) = 0;
/// Let people know if your server will require a password
virtual void SetPasswordProtected( bool bPasswordProtected ) = 0;
/// Spectator server port to advertise. The default value is zero, meaning the
/// service is not used. If your server receives any info requests on the LAN,
/// this is the value that will be placed into the reply for such local queries.
///
/// This is also the value that will be advertised by the master server.
/// The only exception is if your server is using a FakeIP. Then then the second
/// fake port number (index 1) assigned to your server will be listed on the master
/// server as the spectator port, if you set this value to any nonzero value.
///
/// This function merely controls the values that are advertised -- it's up to you to
/// configure the server to actually listen on this port and handle any spectator traffic
virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0;
/// Name of the spectator server. (Only used if spectator port is nonzero.)
///
/// @see k_cbMaxGameServerMapName
virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0;
/// Call this to clear the whole list of key/values that are sent in rules queries.
virtual void ClearAllKeyValues() = 0;
/// Call this to add/update a key/value pair.
virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0;
/// Sets a string defining the "gametags" for this server, this is optional, but if it is set
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
///
/// @see k_cbMaxGameServerTags
virtual void SetGameTags( const char *pchGameTags ) = 0;
/// Sets a string defining the "gamedata" for this server, this is optional, but if it is set
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
///
/// @see k_cbMaxGameServerGameData
virtual void SetGameData( const char *pchGameData ) = 0;
/// Region identifier. This is an optional field, the default value is empty, meaning the "world" region
virtual void SetRegion( const char *pszRegion ) = 0;
/// Indicate whether you wish to be listed on the master server list
/// and/or respond to server browser / LAN discovery packets.
/// The server starts with this value set to false. You should set all
/// relevant server parameters before enabling advertisement on the server.
///
/// (This function used to be named EnableHeartbeats, so if you are wondering
/// where that function went, it's right here. It does the same thing as before,
/// the old name was just confusing.)
virtual void SetAdvertiseServerActive( bool bActive ) = 0;
//
// Player list management / authentication.
//
// Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).
// pcbTicket retrieves the length of the actual ticket.
// SteamNetworkingIdentity is an optional parameter to hold the public IP address of the entity you are connecting to
// if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSnid ) = 0;
// Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
// After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
// Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t
// returns false if we're not connected to the steam servers and thus cannot ask
virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0;
// these two functions s are deprecated, and will not return results
// they will be removed in a future version of the SDK
virtual void GetGameplayStats( ) = 0;
STEAM_CALL_RESULT( GSReputation_t )
virtual SteamAPICall_t GetServerReputation() = 0;
// Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to
virtual SteamIPAddress_t GetPublicIP() = 0;
// Server browser related query packet processing for shared socket mode. These are used
// when you pass STEAMGAMESERVER_QUERY_PORT_SHARED as the query port to SteamGameServer_Init.
// IP address and port are in host order, i.e 127.0.0.1 == 0x7f000001
// These are used when you've elected to multiplex the game server's UDP socket
// rather than having the master server updater use its own sockets.
//
// Source games use this to simplify the job of the server admins, so they
// don't have to open up more ports on their firewalls.
// Call this when a packet that starts with 0xFFFFFFFF comes in. That means
// it's for us.
virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0;
// AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.
// This gets a packet that the master server updater needs to send out on UDP.
// It returns the length of the packet it wants to send, or 0 if there are no more packets to send.
// Call this each frame until it returns 0.
virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0;
//
// Server clan association
//
// associate this game server with this clan for the purposes of computing player compat
STEAM_CALL_RESULT( AssociateWithClanResult_t )
virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0;
// ask if any of the current players dont want to play with this new player - or vice versa
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0;
// Handles receiving a new connection from a Steam user. This call will ask the Steam
// servers to validate the users identity, app ownership, and VAC status. If the Steam servers
// are off-line, then it will validate the cached ticket itself which will validate app ownership
// and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection()
// and must then be sent up to the game server for authentication.
//
// Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL
// If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication
// for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
//
// DEPRECATED! This function will be removed from the SDK in an upcoming version.
// Please migrate to BeginAuthSession and related functions.
virtual bool SendUserConnectAndAuthenticate_DEPRECATED( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0;
// Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.
//
// Return Value: Returns a SteamID for the user to be tracked with, you should call EndAuthSession()
// when this user leaves the server just like you would for a real user.
virtual CSteamID CreateUnauthenticatedUserConnection() = 0;
// Should be called whenever a user leaves our game server, this lets Steam internally
// track which users are currently on which servers for the purposes of preventing a single
// account being logged into multiple servers, showing who is currently on a server, etc.
//
// DEPRECATED! This function will be removed from the SDK in an upcoming version.
// Please migrate to BeginAuthSession and related functions.
virtual void SendUserDisconnect_DEPRECATED( CSteamID steamIDUser ) = 0;
// Update the data to be displayed in the server browser and matchmaking interfaces for a user
// currently connected to the server. For regular users you must call this after you receive a
// GSUserValidationSuccess callback.
//
// Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0;
// Deprecated functions. These will be removed in a future version of the SDK.
// If you really need these, please contact us and help us understand what you are
// using them for.
STEAM_PRIVATE_API(
virtual void SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval ) = 0;
virtual void ForceMasterServerHeartbeat_DEPRECATED() = 0;
)
};
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer015"
// Global accessor
inline ISteamGameServer *SteamGameServer();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamGameServer *, SteamGameServer, STEAMGAMESERVER_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// client has been approved to connect to this game server
struct GSClientApprove_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 1 };
CSteamID m_SteamID; // SteamID of approved player
CSteamID m_OwnerSteamID; // SteamID of original owner for game license
};
// client has been denied to connection to this game server
struct GSClientDeny_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 2 };
CSteamID m_SteamID;
EDenyReason m_eDenyReason;
char m_rgchOptionalText[128];
};
// request the game server should kick the user
struct GSClientKick_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 3 };
CSteamID m_SteamID;
EDenyReason m_eDenyReason;
};
// NOTE: callback values 4 and 5 are skipped because they are used for old deprecated callbacks,
// do not reuse them here.
// client achievement info
struct GSClientAchievementStatus_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 6 };
uint64 m_SteamID;
char m_pchAchievement[128];
bool m_bUnlocked;
};
// received when the game server requests to be displayed as secure (VAC protected)
// m_bSecure is true if the game server should display itself as secure to users, false otherwise
struct GSPolicyResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 15 };
uint8 m_bSecure;
};
// GS gameplay stats info
struct GSGameplayStats_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 7 };
EResult m_eResult; // Result of the call
int32 m_nRank; // Overall rank of the server (0-based)
uint32 m_unTotalConnects; // Total number of clients who have ever connected to the server
uint32 m_unTotalMinutesPlayed; // Total number of minutes ever played on the server
};
// send as a reply to RequestUserGroupStatus()
struct GSClientGroupStatus_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 8 };
CSteamID m_SteamIDUser;
CSteamID m_SteamIDGroup;
bool m_bMember;
bool m_bOfficer;
};
// Sent as a reply to GetServerReputation()
struct GSReputation_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 9 };
EResult m_eResult; // Result of the call;
uint32 m_unReputationScore; // The reputation score for the game server
bool m_bBanned; // True if the server is banned from the Steam
// master servers
// The following members are only filled out if m_bBanned is true. They will all
// be set to zero otherwise. Master server bans are by IP so it is possible to be
// banned even when the score is good high if there is a bad server on another port.
// This information can be used to determine which server is bad.
uint32 m_unBannedIP; // The IP of the banned server
uint16 m_usBannedPort; // The port of the banned server
uint64 m_ulBannedGameID; // The game ID the banned server is serving
uint32 m_unBanExpires; // Time the ban expires, expressed in the Unix epoch (seconds since 1/1/1970)
};
// Sent as a reply to AssociateWithClan()
struct AssociateWithClanResult_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 10 };
EResult m_eResult; // Result of the call;
};
// Sent as a reply to ComputeNewPlayerCompatibility()
struct ComputeNewPlayerCompatibilityResult_t
{
enum { k_iCallback = k_iSteamGameServerCallbacks + 11 };
EResult m_eResult; // Result of the call;
int m_cPlayersThatDontLikeCandidate;
int m_cPlayersThatCandidateDoesntLike;
int m_cClanPlayersThatDontLikeCandidate;
CSteamID m_SteamIDCandidate;
};
#pragma pack( pop )
#endif // ISTEAMGAMESERVER_H

View File

@ -0,0 +1,114 @@
//====== Copyright © Valve Corporation, All rights reserved. =======
//
// Purpose: interface for game servers to steam stats and achievements
//
//=============================================================================
#ifndef ISTEAMGAMESERVERSTATS_H
#define ISTEAMGAMESERVERSTATS_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Functions for authenticating users via Steam to play on a game server
//-----------------------------------------------------------------------------
class ISteamGameServerStats
{
public:
// downloads stats for the user
// returns a GSStatsReceived_t callback when completed
// if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail
// these stats will only be auto-updated for clients playing on the server. For other
// users you'll need to call RequestUserStats() again to refresh any data
STEAM_CALL_RESULT( GSStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
// requests stat information for a user, usable after a successful call to RequestUserStats()
STEAM_FLAT_NAME( GetUserStatInt32 )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0;
STEAM_FLAT_NAME( GetUserStatFloat )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0;
virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0;
// Set / update stats and achievements.
// Note: These updates will work only on stats game servers are allowed to edit and only for
// game servers that have been declared as officially controlled by the game creators.
// Set the IP range of your official servers on the Steamworks page
STEAM_FLAT_NAME( SetUserStatInt32 )
virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData ) = 0;
STEAM_FLAT_NAME( SetUserStatFloat )
virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, float fData ) = 0;
virtual bool UpdateUserAvgRateStat( CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength ) = 0;
virtual bool SetUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0;
virtual bool ClearUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0;
// Store the current data on the server, will get a GSStatsStored_t callback when set.
//
// If the callback has a result of k_EResultInvalidParam, one or more stats
// uploaded has been rejected, either because they broke constraints
// or were out of date. In this case the server sends back updated values.
// The stats should be re-iterated to keep in sync.
STEAM_CALL_RESULT( GSStatsStored_t )
virtual SteamAPICall_t StoreUserStats( CSteamID steamIDUser ) = 0;
};
#define STEAMGAMESERVERSTATS_INTERFACE_VERSION "SteamGameServerStats001"
// Global accessor
inline ISteamGameServerStats *SteamGameServerStats();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamGameServerStats *, SteamGameServerStats, STEAMGAMESERVERSTATS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: called when the latests stats and achievements have been received
// from the server
//-----------------------------------------------------------------------------
struct GSStatsReceived_t
{
enum { k_iCallback = k_iSteamGameServerStatsCallbacks };
EResult m_eResult; // Success / error fetching the stats
CSteamID m_steamIDUser; // The user for whom the stats are retrieved for
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the user stats for a game
//-----------------------------------------------------------------------------
struct GSStatsStored_t
{
enum { k_iCallback = k_iSteamGameServerStatsCallbacks + 1 };
EResult m_eResult; // success / error
CSteamID m_steamIDUser; // The user for whom the stats were stored
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that a user's stats have been unloaded.
// Call RequestUserStats again to access stats for this user
//-----------------------------------------------------------------------------
struct GSStatsUnloaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 };
CSteamID m_steamIDUser; // User whose stats have been unloaded
};
#pragma pack( pop )
#endif // ISTEAMGAMESERVERSTATS_H

View File

@ -0,0 +1,481 @@
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to display html pages in a texture
//
//=============================================================================
#ifndef ISTEAMHTMLSURFACE_H
#define ISTEAMHTMLSURFACE_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
typedef uint32 HHTMLBrowser;
const uint32 INVALID_HTMLBROWSER = 0;
//-----------------------------------------------------------------------------
// Purpose: Functions for displaying HTML pages and interacting with them
//-----------------------------------------------------------------------------
class ISteamHTMLSurface
{
public:
virtual ~ISteamHTMLSurface() {}
// Must call init and shutdown when starting/ending use of the interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
// Create a browser object for display of a html page, when creation is complete the call handle
// will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser.
// The user agent string is a substring to be added to the general user agent string so you can
// identify your client on web servers.
// The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if
// you do not require this functionality.
//
// YOU MUST HAVE IMPLEMENTED HANDLERS FOR HTML_BrowserReady_t, HTML_StartRequest_t,
// HTML_JSAlert_t, HTML_JSConfirm_t, and HTML_FileOpenDialog_t! See the CALLBACKS
// section of this interface (AllowStartRequest, etc) for more details. If you do
// not implement these callback handlers, the browser may appear to hang instead of
// navigating to new pages or triggering javascript popups.
//
STEAM_CALL_RESULT( HTML_BrowserReady_t )
virtual SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) = 0;
// Call this when you are done with a html surface, this lets us free the resources being used by it
virtual void RemoveBrowser( HHTMLBrowser unBrowserHandle ) = 0;
// Navigate to this URL, results in a HTML_StartRequest_t as the request commences
virtual void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData ) = 0;
// Tells the surface the size in pixels to display the surface
virtual void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight ) = 0;
// Stop the load of the current html page
virtual void StopLoad( HHTMLBrowser unBrowserHandle ) = 0;
// Reload (most likely from local cache) the current page
virtual void Reload( HHTMLBrowser unBrowserHandle ) = 0;
// navigate back in the page history
virtual void GoBack( HHTMLBrowser unBrowserHandle ) = 0;
// navigate forward in the page history
virtual void GoForward( HHTMLBrowser unBrowserHandle ) = 0;
// add this header to any url requests from this browser
virtual void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue ) = 0;
// run this javascript script in the currently loaded page
virtual void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript ) = 0;
enum EHTMLMouseButton
{
eHTMLMouseButton_Left = 0,
eHTMLMouseButton_Right = 1,
eHTMLMouseButton_Middle = 2,
};
// Mouse click and mouse movement commands
virtual void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
// x and y are relative to the HTML bounds
virtual void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
// nDelta is pixels of scroll
virtual void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta ) = 0;
enum EHTMLMouseCursor
{
k_EHTMLMouseCursor_User = 0,
k_EHTMLMouseCursor_None,
k_EHTMLMouseCursor_Arrow,
k_EHTMLMouseCursor_IBeam,
k_EHTMLMouseCursor_Hourglass,
k_EHTMLMouseCursor_WaitArrow,
k_EHTMLMouseCursor_Crosshair,
k_EHTMLMouseCursor_Up,
k_EHTMLMouseCursor_SizeNW,
k_EHTMLMouseCursor_SizeSE,
k_EHTMLMouseCursor_SizeNE,
k_EHTMLMouseCursor_SizeSW,
k_EHTMLMouseCursor_SizeW,
k_EHTMLMouseCursor_SizeE,
k_EHTMLMouseCursor_SizeN,
k_EHTMLMouseCursor_SizeS,
k_EHTMLMouseCursor_SizeWE,
k_EHTMLMouseCursor_SizeNS,
k_EHTMLMouseCursor_SizeAll,
k_EHTMLMouseCursor_No,
k_EHTMLMouseCursor_Hand,
k_EHTMLMouseCursor_Blank, // don't show any custom cursor, just use your default
k_EHTMLMouseCursor_MiddlePan,
k_EHTMLMouseCursor_NorthPan,
k_EHTMLMouseCursor_NorthEastPan,
k_EHTMLMouseCursor_EastPan,
k_EHTMLMouseCursor_SouthEastPan,
k_EHTMLMouseCursor_SouthPan,
k_EHTMLMouseCursor_SouthWestPan,
k_EHTMLMouseCursor_WestPan,
k_EHTMLMouseCursor_NorthWestPan,
k_EHTMLMouseCursor_Alias,
k_EHTMLMouseCursor_Cell,
k_EHTMLMouseCursor_ColResize,
k_EHTMLMouseCursor_CopyCur,
k_EHTMLMouseCursor_VerticalText,
k_EHTMLMouseCursor_RowResize,
k_EHTMLMouseCursor_ZoomIn,
k_EHTMLMouseCursor_ZoomOut,
k_EHTMLMouseCursor_Help,
k_EHTMLMouseCursor_Custom,
k_EHTMLMouseCursor_SizeNWSE,
k_EHTMLMouseCursor_SizeNESW,
k_EHTMLMouseCursor_last, // custom cursors start from this value and up
};
enum EHTMLKeyModifiers
{
k_eHTMLKeyModifier_None = 0,
k_eHTMLKeyModifier_AltDown = 1 << 0,
k_eHTMLKeyModifier_CtrlDown = 1 << 1,
k_eHTMLKeyModifier_ShiftDown = 1 << 2,
};
// keyboard interactions, native keycode is the virtual key code value from your OS, system key flags the key to not
// be sent as a typed character as well as a key down
virtual void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false ) = 0;
virtual void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
// cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
virtual void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
// programmatically scroll this many pixels on the page
virtual void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
virtual void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
// tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
virtual void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) = 0;
// open the current pages html code in the local editor of choice, used for debugging
virtual void ViewSource( HHTMLBrowser unBrowserHandle ) = 0;
// copy the currently selected text on the html page to the local clipboard
virtual void CopyToClipboard( HHTMLBrowser unBrowserHandle ) = 0;
// paste from the local clipboard to the current html page
virtual void PasteFromClipboard( HHTMLBrowser unBrowserHandle ) = 0;
// find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
virtual void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse ) = 0;
// cancel a currently running find
virtual void StopFind( HHTMLBrowser unBrowserHandle ) = 0;
// return details about the link at position x,y on the current page
virtual void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
// set a webcookie for the hostname in question
virtual void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath = "/", RTime32 nExpires = 0, bool bSecure = false, bool bHTTPOnly = false ) = 0;
// Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
virtual void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) = 0;
// Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are
// more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled,
// all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1".
// When background mode is disabled, any video or audio objects with that property will resume with ".play()".
virtual void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) = 0;
// Scale the output display space by this factor, this is useful when displaying content on high dpi devices.
// Specifies the ratio between physical and logical pixels.
virtual void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle, float flDPIScaling ) = 0;
// Open HTML/JS developer tools
virtual void OpenDeveloperTools( HHTMLBrowser unBrowserHandle ) = 0;
// CALLBACKS
//
// These set of functions are used as responses to callback requests
//
// You MUST call this in response to a HTML_StartRequest_t callback
// Set bAllowed to true to allow this navigation, false to cancel it and stay
// on the current page. You can use this feature to limit the valid pages
// allowed in your HTML surface.
virtual void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed ) = 0;
// You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback
// Set bResult to true for the OK option of a confirm, use false otherwise
virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0;
// You MUST call this in response to a HTML_FileOpenDialog_t callback
virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0;
};
#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_005"
// Global interface accessor
inline ISteamHTMLSurface *SteamHTMLSurface();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamHTMLSurface *, SteamHTMLSurface, STEAMHTMLSURFACE_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: The browser is ready for use
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_BrowserReady_t, k_iSteamHTMLSurfaceCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this browser is now fully created and ready to navigate to pages
STEAM_CALLBACK_END(1)
//-----------------------------------------------------------------------------
// Purpose: the browser has a pending paint
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN(HTML_NeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 2)
STEAM_CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the browser that needs the paint
STEAM_CALLBACK_MEMBER(1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
STEAM_CALLBACK_MEMBER(2, uint32, unWide) // the total width of the pBGRA texture
STEAM_CALLBACK_MEMBER(3, uint32, unTall) // the total height of the pBGRA texture
STEAM_CALLBACK_MEMBER(4, uint32, unUpdateX) // the offset in X for the damage rect for this update
STEAM_CALLBACK_MEMBER(5, uint32, unUpdateY) // the offset in Y for the damage rect for this update
STEAM_CALLBACK_MEMBER(6, uint32, unUpdateWide) // the width of the damage rect for this update
STEAM_CALLBACK_MEMBER(7, uint32, unUpdateTall) // the height of the damage rect for this update
STEAM_CALLBACK_MEMBER(8, uint32, unScrollX) // the page scroll the browser was at when this texture was rendered
STEAM_CALLBACK_MEMBER(9, uint32, unScrollY) // the page scroll the browser was at when this texture was rendered
STEAM_CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this page when rendered
STEAM_CALLBACK_MEMBER(11, uint32, unPageSerial) // incremented on each new page load, you can use this to reject draws while navigating to new pages
STEAM_CALLBACK_END(12)
//-----------------------------------------------------------------------------
// Purpose: The browser wanted to navigate to a new page
// NOTE - you MUST call AllowStartRequest in response to this callback
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN(HTML_StartRequest_t, k_iSteamHTMLSurfaceCallbacks + 3)
STEAM_CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface navigating
STEAM_CALLBACK_MEMBER(1, const char *, pchURL) // the url they wish to navigate to
STEAM_CALLBACK_MEMBER(2, const char *, pchTarget) // the html link target type (i.e _blank, _self, _parent, _top )
STEAM_CALLBACK_MEMBER(3, const char *, pchPostData ) // any posted data for the request
STEAM_CALLBACK_MEMBER(4, bool, bIsRedirect) // true if this was a http/html redirect from the last load request
STEAM_CALLBACK_END(5)
//-----------------------------------------------------------------------------
// Purpose: The browser has been requested to close due to user interaction (usually from a javascript window.close() call)
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN(HTML_CloseBrowser_t, k_iSteamHTMLSurfaceCallbacks + 4)
STEAM_CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface
STEAM_CALLBACK_END(1)
//-----------------------------------------------------------------------------
// Purpose: the browser is navigating to a new url
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_URLChanged_t, k_iSteamHTMLSurfaceCallbacks + 5 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface navigating
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) // the url they wish to navigate to
STEAM_CALLBACK_MEMBER( 2, const char *, pchPostData ) // any posted data for the request
STEAM_CALLBACK_MEMBER( 3, bool, bIsRedirect ) // true if this was a http/html redirect from the last load request
STEAM_CALLBACK_MEMBER( 4, const char *, pchPageTitle ) // the title of the page
STEAM_CALLBACK_MEMBER( 5, bool, bNewNavigation ) // true if this was from a fresh tab and not a click on an existing page
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: A page is finished loading
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_FinishedRequest_t, k_iSteamHTMLSurfaceCallbacks + 6 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) //
STEAM_CALLBACK_MEMBER( 2, const char *, pchPageTitle ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: a request to load this url in a new tab
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_OpenLinkInNewTab_t, k_iSteamHTMLSurfaceCallbacks + 7 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: the page has a new title now
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_ChangedTitle_t, k_iSteamHTMLSurfaceCallbacks + 8 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchTitle ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: results from a search
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_SearchResults_t, k_iSteamHTMLSurfaceCallbacks + 9 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, unResults ) //
STEAM_CALLBACK_MEMBER( 2, uint32, unCurrentMatch ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: page history status changed on the ability to go backwards and forward
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_CanGoBackAndForward_t, k_iSteamHTMLSurfaceCallbacks + 10 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, bool, bCanGoBack ) //
STEAM_CALLBACK_MEMBER( 2, bool, bCanGoForward ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: details on the visibility and size of the horizontal scrollbar
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_HorizontalScroll_t, k_iSteamHTMLSurfaceCallbacks + 11 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
STEAM_CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
STEAM_CALLBACK_MEMBER( 3, float, flPageScale ) //
STEAM_CALLBACK_MEMBER( 4, bool , bVisible ) //
STEAM_CALLBACK_MEMBER( 5, uint32, unPageSize ) //
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: details on the visibility and size of the vertical scrollbar
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_VerticalScroll_t, k_iSteamHTMLSurfaceCallbacks + 12 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
STEAM_CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
STEAM_CALLBACK_MEMBER( 3, float, flPageScale ) //
STEAM_CALLBACK_MEMBER( 4, bool, bVisible ) //
STEAM_CALLBACK_MEMBER( 5, uint32, unPageSize ) //
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: response to GetLinkAtPosition call
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_LinkAtPosition_t, k_iSteamHTMLSurfaceCallbacks + 13 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, x ) // NOTE - Not currently set
STEAM_CALLBACK_MEMBER( 2, uint32, y ) // NOTE - Not currently set
STEAM_CALLBACK_MEMBER( 3, const char *, pchURL ) //
STEAM_CALLBACK_MEMBER( 4, bool, bInput ) //
STEAM_CALLBACK_MEMBER( 5, bool, bLiveLink ) //
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: show a Javascript alert dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_JSAlert_t, k_iSteamHTMLSurfaceCallbacks + 14 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMessage ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: show a Javascript confirmation dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_JSConfirm_t, k_iSteamHTMLSurfaceCallbacks + 15 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMessage ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: when received show a file open dialog
// then call FileLoadDialogResponse with the file(s) the user selected.
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_FileOpenDialog_t, k_iSteamHTMLSurfaceCallbacks + 16 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchTitle ) //
STEAM_CALLBACK_MEMBER( 2, const char *, pchInitialFile ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: a new html window is being created.
//
// IMPORTANT NOTE: at this time, the API does not allow you to acknowledge or
// render the contents of this new window, so the new window is always destroyed
// immediately. The URL and other parameters of the new window are passed here
// to give your application the opportunity to call CreateBrowser and set up
// a new browser in response to the attempted popup, if you wish to do so.
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_NewWindow_t, k_iSteamHTMLSurfaceCallbacks + 21 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the current surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) // the page to load
STEAM_CALLBACK_MEMBER( 2, uint32, unX ) // the x pos into the page to display the popup
STEAM_CALLBACK_MEMBER( 3, uint32, unY ) // the y pos into the page to display the popup
STEAM_CALLBACK_MEMBER( 4, uint32, unWide ) // the total width of the pBGRA texture
STEAM_CALLBACK_MEMBER( 5, uint32, unTall ) // the total height of the pBGRA texture
STEAM_CALLBACK_MEMBER( 6, HHTMLBrowser, unNewWindow_BrowserHandle_IGNORE )
STEAM_CALLBACK_END(7)
//-----------------------------------------------------------------------------
// Purpose: change the cursor to display
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_SetCursor_t, k_iSteamHTMLSurfaceCallbacks + 22 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, eMouseCursor ) // the EHTMLMouseCursor to display
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: informational message from the browser
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_StatusText_t, k_iSteamHTMLSurfaceCallbacks + 23 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMsg ) // the message text
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: show a tooltip
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_ShowToolTip_t, k_iSteamHTMLSurfaceCallbacks + 24 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMsg ) // the tooltip text
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: update the text of an existing tooltip
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_UpdateToolTip_t, k_iSteamHTMLSurfaceCallbacks + 25 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMsg ) // the new tooltip text
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: hide the tooltip you are showing
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_END(1)
//-----------------------------------------------------------------------------
// Purpose: The browser has restarted due to an internal failure, use this new handle value
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_BrowserRestarted_t, k_iSteamHTMLSurfaceCallbacks + 27 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this is the new browser handle after the restart
STEAM_CALLBACK_MEMBER( 1, HHTMLBrowser, unOldBrowserHandle ) // the handle for the browser before the restart, if your handle was this then switch to using unBrowserHandle for API calls
STEAM_CALLBACK_END(2)
#pragma pack( pop )
#endif // ISTEAMHTMLSURFACE_H

View File

@ -0,0 +1,219 @@
//====== Copyright © 1996-2009, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to http client
//
//=============================================================================
#ifndef ISTEAMHTTP_H
#define ISTEAMHTTP_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
#include "steamhttpenums.h"
// Handle to a HTTP Request handle
typedef uint32 HTTPRequestHandle;
#define INVALID_HTTPREQUEST_HANDLE 0
typedef uint32 HTTPCookieContainerHandle;
#define INVALID_HTTPCOOKIE_HANDLE 0
//-----------------------------------------------------------------------------
// Purpose: interface to http client
//-----------------------------------------------------------------------------
class ISteamHTTP
{
public:
// Initializes a new HTTP request, returning a handle to use in further operations on it. Requires
// the method (GET or POST) and the absolute URL for the request. Both http and https are supported,
// so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/
// or such.
virtual HTTPRequestHandle CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL ) = 0;
// Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after
// sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.
virtual bool SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue ) = 0;
// Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default
// timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request
// has already been sent.
virtual bool SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds ) = 0;
// Set a request header value for the request, must be called prior to sending the request. Will
// return false if the handle is invalid or the request is already sent.
virtual bool SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue ) = 0;
// Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified
// when creating the request. Must be called prior to sending the request. Will return false if the
// handle is invalid or the request is already sent.
virtual bool SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue ) = 0;
// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
// asynchronous response via callback.
//
// Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control
// header and only do a local cache lookup rather than sending any actual remote request.
virtual bool SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0;
// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
// asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and
// HTTPRequestDataReceived_t callbacks while streaming.
virtual bool SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0;
// Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move
// the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.
virtual bool DeferHTTPRequest( HTTPRequestHandle hRequest ) = 0;
// Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move
// the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.
virtual bool PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) = 0;
// Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also
// returns the size of the header value if present so the caller and allocate a correctly sized buffer for
// GetHTTPResponseHeaderValue.
virtual bool GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize ) = 0;
// Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// header is not present or if your buffer is too small to contain it's value. You should first call
// BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.
virtual bool GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize ) = 0;
// Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// handle is invalid.
virtual bool GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize ) = 0;
// Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out
// the correct buffer size to use.
virtual bool GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0;
// Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the
// handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset
// do not match the size and offset sent in HTTPRequestDataReceived_t.
virtual bool GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0;
// Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t
// callback and finishing using the response.
virtual bool ReleaseHTTPRequest( HTTPRequestHandle hRequest ) = 0;
// Gets progress on downloading the body for the request. This will be zero unless a response header has already been
// received which included a content-length field. For responses that contain no content-length it will report
// zero for the duration of the request as the size is unknown until the connection closes.
virtual bool GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut ) = 0;
// Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params
// have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType
// parameter will set the content-type header for the request so the server may know how to interpret the body.
virtual bool SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen ) = 0;
// Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true
// than any response to your requests using this cookie container may add new cookies which may be transmitted with
// future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for
// during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across
// repeat executions of your process.
virtual HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify ) = 0;
// Release a cookie container you are finished using, freeing it's memory
virtual bool ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer ) = 0;
// Adds a cookie to the specified cookie container that will be used with future requests.
virtual bool SetCookie( HTTPCookieContainerHandle hCookieContainer, const char *pchHost, const char *pchUrl, const char *pchCookie ) = 0;
// Set the cookie container to use for a HTTP request
virtual bool SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer ) = 0;
// Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end
virtual bool SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo ) = 0;
// Disable or re-enable verification of SSL/TLS certificates.
// By default, certificates are checked for all HTTPS requests.
virtual bool SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate ) = 0;
// Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout
// which can bump everytime we get more data
virtual bool SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds ) = 0;
// Check if the reason the request failed was because we timed it out (rather than some harder failure)
virtual bool GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut ) = 0;
};
#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamHTTP *SteamHTTP();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamHTTP *, SteamHTTP, STEAMHTTP_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamHTTP *SteamGameServerHTTP();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamHTTP *, SteamGameServerHTTP, STEAMHTTP_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct HTTPRequestCompleted_t
{
enum { k_iCallback = k_iSteamHTTPCallbacks + 1 };
// Handle value for the request that has completed.
HTTPRequestHandle m_hRequest;
// Context value that the user defined on the request that this callback is associated with, 0 if
// no context value was set.
uint64 m_ulContextValue;
// This will be true if we actually got any sort of response from the server (even an error).
// It will be false if we failed due to an internal error or client side network failure.
bool m_bRequestSuccessful;
// Will be the HTTP status code value returned by the server, k_EHTTPStatusCode200OK is the normal
// OK response, if you get something else you probably need to treat it as a failure.
EHTTPStatusCode m_eStatusCode;
uint32 m_unBodySize; // Same as GetHTTPResponseBodySize()
};
struct HTTPRequestHeadersReceived_t
{
enum { k_iCallback = k_iSteamHTTPCallbacks + 2 };
// Handle value for the request that has received headers.
HTTPRequestHandle m_hRequest;
// Context value that the user defined on the request that this callback is associated with, 0 if
// no context value was set.
uint64 m_ulContextValue;
};
struct HTTPRequestDataReceived_t
{
enum { k_iCallback = k_iSteamHTTPCallbacks + 3 };
// Handle value for the request that has received data.
HTTPRequestHandle m_hRequest;
// Context value that the user defined on the request that this callback is associated with, 0 if
// no context value was set.
uint64 m_ulContextValue;
// Offset to provide to GetHTTPStreamingResponseBodyData to get this chunk of data
uint32 m_cOffset;
// Size to provide to GetHTTPStreamingResponseBodyData to get this chunk of data
uint32 m_cBytesReceived;
};
#pragma pack( pop )
#endif // ISTEAMHTTP_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,435 @@
//====== Copyright © 1996-2014 Valve Corporation, All rights reserved. =======
//
// Purpose: interface to Steam Inventory
//
//=============================================================================
#ifndef ISTEAMINVENTORY_H
#define ISTEAMINVENTORY_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// Every individual instance of an item has a globally-unique ItemInstanceID.
// This ID is unique to the combination of (player, specific item instance)
// and will not be transferred to another player or re-used for another item.
typedef uint64 SteamItemInstanceID_t;
static const SteamItemInstanceID_t k_SteamItemInstanceIDInvalid = (SteamItemInstanceID_t)~0;
// Types of items in your game are identified by a 32-bit "item definition number".
// Valid definition numbers are between 1 and 999999999; numbers less than or equal to
// zero are invalid, and numbers greater than or equal to one billion (1x10^9) are
// reserved for internal Steam use.
typedef int32 SteamItemDef_t;
enum ESteamItemFlags
{
// Item status flags - these flags are permanently attached to specific item instances
k_ESteamItemNoTrade = 1 << 0, // This item is account-locked and cannot be traded or given away.
// Action confirmation flags - these flags are set one time only, as part of a result set
k_ESteamItemRemoved = 1 << 8, // The item has been destroyed, traded away, expired, or otherwise invalidated
k_ESteamItemConsumed = 1 << 9, // The item quantity has been decreased by 1 via ConsumeItem API.
// All other flag bits are currently reserved for internal Steam use at this time.
// Do not assume anything about the state of other flags which are not defined here.
};
struct SteamItemDetails_t
{
SteamItemInstanceID_t m_itemId;
SteamItemDef_t m_iDefinition;
uint16 m_unQuantity;
uint16 m_unFlags; // see ESteamItemFlags
};
typedef int32 SteamInventoryResult_t;
static const SteamInventoryResult_t k_SteamInventoryResultInvalid = -1;
typedef uint64 SteamInventoryUpdateHandle_t;
const SteamInventoryUpdateHandle_t k_SteamInventoryUpdateHandleInvalid = 0xffffffffffffffffull;
//-----------------------------------------------------------------------------
// Purpose: Steam Inventory query and manipulation API
//-----------------------------------------------------------------------------
class ISteamInventory
{
public:
// INVENTORY ASYNC RESULT MANAGEMENT
//
// Asynchronous inventory queries always output a result handle which can be used with
// GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will
// be triggered when the asynchronous result becomes ready (or fails).
//
// Find out the status of an asynchronous inventory result handle. Possible values:
// k_EResultPending - still in progress
// k_EResultOK - done, result ready
// k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult)
// k_EResultInvalidParam - ERROR: invalid API call parameters
// k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later
// k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits
// k_EResultFail - ERROR: unknown / generic error
virtual EResult GetResultStatus( SteamInventoryResult_t resultHandle ) = 0;
// Copies the contents of a result set into a flat array. The specific
// contents of the result set depend on which query which was used.
virtual bool GetResultItems( SteamInventoryResult_t resultHandle,
STEAM_OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
uint32 *punOutItemsArraySize ) = 0;
// In combination with GetResultItems, you can use GetResultItemProperty to retrieve
// dynamic string properties for a given item returned in the result set.
//
// Property names are always composed of ASCII letters, numbers, and/or underscores.
//
// Pass a NULL pointer for pchPropertyName to get a comma - separated list of available
// property names.
//
// If pchValueBuffer is NULL, *punValueBufferSize will contain the
// suggested buffer size. Otherwise it will be the number of bytes actually copied
// to pchValueBuffer. If the results do not fit in the given buffer, partial
// results may be copied.
virtual bool GetResultItemProperty( SteamInventoryResult_t resultHandle,
uint32 unItemIndex,
const char *pchPropertyName,
STEAM_OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
// Returns the server time at which the result was generated. Compare against
// the value of IClientUtils::GetServerRealTime() to determine age.
virtual uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle ) = 0;
// Returns true if the result belongs to the target steam ID, false if the
// result does not. This is important when using DeserializeResult, to verify
// that a remote player is not pretending to have a different user's inventory.
virtual bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) = 0;
// Destroys a result handle and frees all associated memory.
virtual void DestroyResult( SteamInventoryResult_t resultHandle ) = 0;
// INVENTORY ASYNC QUERY
//
// Captures the entire state of the current user's Steam inventory.
// You must call DestroyResult on this handle when you are done with it.
// Returns false and sets *pResultHandle to zero if inventory is unavailable.
// Note: calls to this function are subject to rate limits and may return
// cached results if called too frequently. It is suggested that you call
// this function only when you are about to display the user's full inventory,
// or if you expect that the inventory may have changed.
virtual bool GetAllItems( SteamInventoryResult_t *pResultHandle ) = 0;
// Captures the state of a subset of the current user's Steam inventory,
// identified by an array of item instance IDs. The results from this call
// can be serialized and passed to other players to "prove" that the current
// user owns specific items, without exposing the user's entire inventory.
// For example, you could call GetItemsByID with the IDs of the user's
// currently equipped cosmetic items and serialize this to a buffer, and
// then transmit this buffer to other players upon joining a game.
virtual bool GetItemsByID( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs ) = 0;
// RESULT SERIALIZATION AND AUTHENTICATION
//
// Serialized result sets contain a short signature which can't be forged
// or replayed across different game sessions. A result set can be serialized
// on the local client, transmitted to other players via your game networking,
// and deserialized by the remote players. This is a secure way of preventing
// hackers from lying about posessing rare/high-value items.
// Serializes a result set with signature bytes to an output buffer. Pass
// NULL as an output buffer to get the required size via punOutBufferSize.
// The size of a serialized result depends on the number items which are being
// serialized. When securely transmitting items to other players, it is
// recommended to use "GetItemsByID" first to create a minimal result set.
// Results have a built-in timestamp which will be considered "expired" after
// an hour has elapsed. See DeserializeResult for expiration handling.
virtual bool SerializeResult( SteamInventoryResult_t resultHandle, STEAM_OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize ) = 0;
// Deserializes a result set and verifies the signature bytes. Returns false
// if bRequireFullOnlineVerify is set but Steam is running in Offline mode.
// Otherwise returns true and then delivers error codes via GetResultStatus.
//
// The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not
// be set to true by your game at this time.
//
// DeserializeResult has a potential soft-failure mode where the handle status
// is set to k_EResultExpired. GetResultItems() still succeeds in this mode.
// The "expired" result could indicate that the data may be out of date - not
// just due to timed expiration (one hour), but also because one of the items
// in the result set may have been traded or consumed since the result set was
// generated. You could compare the timestamp from GetResultTimestamp() to
// ISteamUtils::GetServerRealTime() to determine how old the data is. You could
// simply ignore the "expired" result code and continue as normal, or you
// could challenge the player with expired data to send an updated result set.
virtual bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, STEAM_BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) = 0;
// INVENTORY ASYNC MODIFICATION
//
// GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t
// notification with a matching nCallbackContext parameter. This API is only intended
// for prototyping - it is only usable by Steam accounts that belong to the publisher group
// for your game.
// If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should
// describe the quantity of each item to generate.
virtual bool GenerateItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
// GrantPromoItems() checks the list of promotional items for which the user may be eligible
// and grants the items (one time only). On success, the result set will include items which
// were granted, if any. If no items were granted because the user isn't eligible for any
// promotions, this is still considered a success.
virtual bool GrantPromoItems( SteamInventoryResult_t *pResultHandle ) = 0;
// AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of
// scanning for all eligible promotional items, the check is restricted to a single item
// definition or set of item definitions. This can be useful if your game has custom UI for
// showing a specific promo item to the user.
virtual bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef ) = 0;
virtual bool AddPromoItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength ) = 0;
// ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.
// Not for the faint of heart - if your game implements item removal at all, a high-friction
// UI confirmation process is highly recommended.
virtual bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity ) = 0;
// ExchangeItems() is an atomic combination of item generation and consumption.
// It can be used to implement crafting recipes or transmutations, or items which unpack
// themselves into other items (e.g., a chest).
// Exchange recipes are defined in the ItemDef, and explicitly list the required item
// types and resulting generated type.
// Exchange recipes are evaluated atomically by the Inventory Service; if the supplied
// components do not match the recipe, or do not contain sufficient quantity, the
// exchange will fail.
virtual bool ExchangeItems( SteamInventoryResult_t *pResultHandle,
STEAM_ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, STEAM_ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength,
STEAM_ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, STEAM_ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength ) = 0;
// TransferItemQuantity() is intended for use with items which are "stackable" (can have
// quantity greater than one). It can be used to split a stack into two, or to transfer
// quantity from one stack into another stack of identical items. To split one stack into
// two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.
virtual bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest ) = 0;
// TIMED DROPS AND PLAYTIME CREDIT
//
// Deprecated. Calling this method is not required for proper playtime accounting.
virtual void SendItemDropHeartbeat() = 0;
// Playtime credit must be consumed and turned into item drops by your game. Only item
// definitions which are marked as "playtime item generators" can be spawned. The call
// will return an empty result set if there is not enough playtime credit for a drop.
// Your game should call TriggerItemDrop at an appropriate time for the user to receive
// new items, such as between rounds or while the player is dead. Note that players who
// hack their clients could modify the value of "dropListDefinition", so do not use it
// to directly control rarity.
// See your Steamworks configuration to set playtime drop rates for individual itemdefs.
// The client library will suppress too-frequent calls to this method.
virtual bool TriggerItemDrop( SteamInventoryResult_t *pResultHandle, SteamItemDef_t dropListDefinition ) = 0;
// Deprecated. This method is not supported.
virtual bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePartner,
STEAM_ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, STEAM_ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength,
STEAM_ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, STEAM_ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength ) = 0;
// ITEM DEFINITIONS
//
// Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000)
// to a set of string properties. Some of these properties are required to display items
// on the Steam community web site. Other properties can be defined by applications.
// Use of these functions is optional; there is no reason to call LoadItemDefinitions
// if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue
// weapon mod = 55) and does not allow for adding new item types without a client patch.
//
// LoadItemDefinitions triggers the automatic load and refresh of item definitions.
// Every time new item definitions are available (eg, from the dynamic addition of new
// item types while players are still in-game), a SteamInventoryDefinitionUpdate_t
// callback will be fired.
virtual bool LoadItemDefinitions() = 0;
// GetItemDefinitionIDs returns the set of all defined item definition IDs (which are
// defined via Steamworks configuration, and not necessarily contiguous integers).
// If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will
// contain the total size necessary for a subsequent call. Otherwise, the call will
// return false if and only if there is not enough space in the output array.
virtual bool GetItemDefinitionIDs(
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
// GetItemDefinitionProperty returns a string property from a given item definition.
// Note that some properties (for example, "name") may be localized and will depend
// on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage).
// Property names are always composed of ASCII letters, numbers, and/or underscores.
// Pass a NULL pointer for pchPropertyName to get a comma - separated list of available
// property names. If pchValueBuffer is NULL, *punValueBufferSize will contain the
// suggested buffer size. Otherwise it will be the number of bytes actually copied
// to pchValueBuffer. If the results do not fit in the given buffer, partial
// results may be copied.
virtual bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName,
STEAM_OUT_STRING_COUNT(punValueBufferSizeOut) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
// Request the list of "eligible" promo items that can be manually granted to the given
// user. These are promo items of type "manual" that won't be granted automatically.
// An example usage of this is an item that becomes available every week.
STEAM_CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t )
virtual SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID ) = 0;
// After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this
// function to pull out the list of item definition ids that the user can be
// manually granted via the AddPromoItems() call.
virtual bool GetEligiblePromoItemDefinitionIDs(
CSteamID steamID,
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
// Starts the purchase process for the given item definitions. The callback SteamInventoryStartPurchaseResult_t
// will be posted if Steam was able to initialize the transaction.
//
// Once the purchase has been authorized and completed by the user, the callback SteamInventoryResultReady_t
// will be posted.
STEAM_CALL_RESULT( SteamInventoryStartPurchaseResult_t )
virtual SteamAPICall_t StartPurchase( STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
// Request current prices for all applicable item definitions
STEAM_CALL_RESULT( SteamInventoryRequestPricesResult_t )
virtual SteamAPICall_t RequestPrices() = 0;
// Returns the number of items with prices. Need to call RequestPrices() first.
virtual uint32 GetNumItemsWithPrices() = 0;
// Returns item definition ids and their prices in the user's local currency.
// Need to call RequestPrices() first.
virtual bool GetItemsWithPrices( STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pArrayItemDefs, Items with prices) SteamItemDef_t *pArrayItemDefs,
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pCurrentPrices,
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pBasePrices,
uint32 unArrayLength ) = 0;
// Retrieves the price for the item definition id
// Returns false if there is no price stored for the item definition.
virtual bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pCurrentPrice, uint64 *pBasePrice ) = 0;
// Create a request to update properties on items
virtual SteamInventoryUpdateHandle_t StartUpdateProperties() = 0;
// Remove the property on the item
virtual bool RemoveProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName ) = 0;
// Accessor methods to set properties on items
STEAM_FLAT_NAME( SetPropertyString )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, const char *pchPropertyValue ) = 0;
STEAM_FLAT_NAME( SetPropertyBool )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, bool bValue ) = 0;
STEAM_FLAT_NAME( SetPropertyInt64 )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, int64 nValue ) = 0;
STEAM_FLAT_NAME( SetPropertyFloat )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, float flValue ) = 0;
// Submit the update request by handle
virtual bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t * pResultHandle ) = 0;
virtual bool InspectItem( SteamInventoryResult_t *pResultHandle, const char *pchItemToken ) = 0;
};
#define STEAMINVENTORY_INTERFACE_VERSION "STEAMINVENTORY_INTERFACE_V003"
// Global interface accessor
inline ISteamInventory *SteamInventory();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamInventory *, SteamInventory, STEAMINVENTORY_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamInventory *SteamGameServerInventory();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamInventory *, SteamGameServerInventory, STEAMINVENTORY_INTERFACE_VERSION );
// SteamInventoryResultReady_t callbacks are fired whenever asynchronous
// results transition from "Pending" to "OK" or an error state. There will
// always be exactly one callback per handle.
struct SteamInventoryResultReady_t
{
enum { k_iCallback = k_iSteamInventoryCallbacks + 0 };
SteamInventoryResult_t m_handle;
EResult m_result;
};
// SteamInventoryFullUpdate_t callbacks are triggered when GetAllItems
// successfully returns a result which is newer / fresher than the last
// known result. (It will not trigger if the inventory hasn't changed,
// or if results from two overlapping calls are reversed in flight and
// the earlier result is already known to be stale/out-of-date.)
// The normal ResultReady callback will still be triggered immediately
// afterwards; this is an additional notification for your convenience.
struct SteamInventoryFullUpdate_t
{
enum { k_iCallback = k_iSteamInventoryCallbacks + 1 };
SteamInventoryResult_t m_handle;
};
// A SteamInventoryDefinitionUpdate_t callback is triggered whenever
// item definitions have been updated, which could be in response to
// LoadItemDefinitions() or any other async request which required
// a definition update in order to process results from the server.
struct SteamInventoryDefinitionUpdate_t
{
enum { k_iCallback = k_iSteamInventoryCallbacks + 2 };
};
// Returned
struct SteamInventoryEligiblePromoItemDefIDs_t
{
enum { k_iCallback = k_iSteamInventoryCallbacks + 3 };
EResult m_result;
CSteamID m_steamID;
int m_numEligiblePromoItemDefs;
bool m_bCachedData; // indicates that the data was retrieved from the cache and not the server
};
// Triggered from StartPurchase call
struct SteamInventoryStartPurchaseResult_t
{
enum { k_iCallback = k_iSteamInventoryCallbacks + 4 };
EResult m_result;
uint64 m_ulOrderID;
uint64 m_ulTransID;
};
// Triggered from RequestPrices
struct SteamInventoryRequestPricesResult_t
{
enum { k_iCallback = k_iSteamInventoryCallbacks + 5 };
EResult m_result;
char m_rgchCurrency[4];
};
#pragma pack( pop )
#endif // ISTEAMCONTROLLER_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
#ifndef ISTEAMMUSIC_H
#define ISTEAMMUSIC_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
enum AudioPlayback_Status
{
AudioPlayback_Undefined = 0,
AudioPlayback_Playing = 1,
AudioPlayback_Paused = 2,
AudioPlayback_Idle = 3
};
//-----------------------------------------------------------------------------
// Purpose: Functions to control music playback in the steam client
//-----------------------------------------------------------------------------
class ISteamMusic
{
public:
virtual bool BIsEnabled() = 0;
virtual bool BIsPlaying() = 0;
virtual AudioPlayback_Status GetPlaybackStatus() = 0;
virtual void Play() = 0;
virtual void Pause() = 0;
virtual void PlayPrevious() = 0;
virtual void PlayNext() = 0;
// volume is between 0.0 and 1.0
virtual void SetVolume( float flVolume ) = 0;
virtual float GetVolume() = 0;
};
#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamMusic *SteamMusic();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusic *, SteamMusic, STEAMMUSIC_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
STEAM_CALLBACK_BEGIN( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, float, m_flNewVolume )
STEAM_CALLBACK_END(1)
#pragma pack( pop )
#endif // #define ISTEAMMUSIC_H

View File

@ -0,0 +1,133 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
#ifndef ISTEAMMUSICREMOTE_H
#define ISTEAMMUSICREMOTE_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
#include "isteammusic.h"
#define k_SteamMusicNameMaxLength 255
#define k_SteamMusicPNGMaxLength 65535
class ISteamMusicRemote
{
public:
// Service Definition
virtual bool RegisterSteamMusicRemote( const char *pchName ) = 0;
virtual bool DeregisterSteamMusicRemote() = 0;
virtual bool BIsCurrentMusicRemote() = 0;
virtual bool BActivationSuccess( bool bValue ) = 0;
virtual bool SetDisplayName( const char *pchDisplayName ) = 0;
virtual bool SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength ) = 0;
// Abilities for the user interface
virtual bool EnablePlayPrevious(bool bValue) = 0;
virtual bool EnablePlayNext( bool bValue ) = 0;
virtual bool EnableShuffled( bool bValue ) = 0;
virtual bool EnableLooped( bool bValue ) = 0;
virtual bool EnableQueue( bool bValue ) = 0;
virtual bool EnablePlaylists( bool bValue ) = 0;
// Status
virtual bool UpdatePlaybackStatus( AudioPlayback_Status nStatus ) = 0;
virtual bool UpdateShuffled( bool bValue ) = 0;
virtual bool UpdateLooped( bool bValue ) = 0;
virtual bool UpdateVolume( float flValue ) = 0; // volume is between 0.0 and 1.0
// Current Entry
virtual bool CurrentEntryWillChange() = 0;
virtual bool CurrentEntryIsAvailable( bool bAvailable ) = 0;
virtual bool UpdateCurrentEntryText( const char *pchText ) = 0;
virtual bool UpdateCurrentEntryElapsedSeconds( int nValue ) = 0;
virtual bool UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength ) = 0;
virtual bool CurrentEntryDidChange() = 0;
// Queue
virtual bool QueueWillChange() = 0;
virtual bool ResetQueueEntries() = 0;
virtual bool SetQueueEntry( int nID, int nPosition, const char *pchEntryText ) = 0;
virtual bool SetCurrentQueueEntry( int nID ) = 0;
virtual bool QueueDidChange() = 0;
// Playlist
virtual bool PlaylistWillChange() = 0;
virtual bool ResetPlaylistEntries() = 0;
virtual bool SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText ) = 0;
virtual bool SetCurrentPlaylistEntry( int nID ) = 0;
virtual bool PlaylistDidChange() = 0;
};
#define STEAMMUSICREMOTE_INTERFACE_VERSION "STEAMMUSICREMOTE_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamMusicRemote *SteamMusicRemote();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusicRemote *, SteamMusicRemote, STEAMMUSICREMOTE_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8 )
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9 )
STEAM_CALLBACK_MEMBER( 0, bool, m_bShuffled )
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10 )
STEAM_CALLBACK_MEMBER(0, bool, m_bLooped )
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11 )
STEAM_CALLBACK_MEMBER(0, float, m_flNewVolume)
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12 )
STEAM_CALLBACK_MEMBER(0, int, nID )
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13 )
STEAM_CALLBACK_MEMBER(0, int, nID )
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14 )
STEAM_CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus )
STEAM_CALLBACK_END(1)
#pragma pack( pop )
#endif // #define ISTEAMMUSICREMOTE_H

View File

@ -0,0 +1,343 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to steam managing network connections between game clients & servers
//
//=============================================================================
#ifndef ISTEAMNETWORKING
#define ISTEAMNETWORKING
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
// list of possible errors returned by SendP2PPacket() API
// these will be posted in the P2PSessionConnectFail_t callback
enum EP2PSessionError
{
k_EP2PSessionErrorNone = 0,
k_EP2PSessionErrorNoRightsToApp = 2, // local user doesn't own the app that is running
k_EP2PSessionErrorTimeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser()
// corporate firewalls can also block this (NAT traversal is not firewall traversal)
// make sure that UDP ports 3478, 4379, and 4380 are open in an outbound direction
// The following error codes were removed and will never be sent.
// For privacy reasons, there is no reply if the user is offline or playing another game.
k_EP2PSessionErrorNotRunningApp_DELETED = 1,
k_EP2PSessionErrorDestinationNotLoggedIn_DELETED = 3,
k_EP2PSessionErrorMax = 5
};
// SendP2PPacket() send types
// Typically k_EP2PSendUnreliable is what you want for UDP-like packets, k_EP2PSendReliable for TCP-like packets
enum EP2PSend
{
// Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare).
// The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or
// there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again.
k_EP2PSendUnreliable = 0,
// As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first
// packet sent to a remote host almost guarantees the packet will be dropped.
// This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets
k_EP2PSendUnreliableNoDelay = 1,
// Reliable message send. Can send up to 1MB of data in a single message.
// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for efficient sends of large chunks of data.
k_EP2PSendReliable = 2,
// As above, but applies the Nagle algorithm to the send - sends will accumulate
// until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm).
// Useful if you want to send a set of smaller messages but have the coalesced into a single packet
// Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then
// do a normal k_EP2PSendReliable to force all the buffered data to be sent.
k_EP2PSendReliableWithBuffering = 3,
};
// connection state to a specified user, returned by GetP2PSessionState()
// this is under-the-hood info about what's going on with a SendP2PPacket(), shouldn't be needed except for debuggin
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct P2PSessionState_t
{
uint8 m_bConnectionActive; // true if we've got an active open connection
uint8 m_bConnecting; // true if we're currently trying to establish a connection
uint8 m_eP2PSessionError; // last error recorded (see enum above)
uint8 m_bUsingRelay; // true if it's going through a relay server (TURN)
int32 m_nBytesQueuedForSend;
int32 m_nPacketsQueuedForSend;
uint32 m_nRemoteIP; // potential IP:Port of remote host. Could be TURN server.
uint16 m_nRemotePort; // Only exists for compatibility with older authentication api's
};
#pragma pack( pop )
// handle to a socket
typedef uint32 SNetSocket_t; // CreateP2PConnectionSocket()
typedef uint32 SNetListenSocket_t; // CreateListenSocket()
// connection progress indicators, used by CreateP2PConnectionSocket()
enum ESNetSocketState
{
k_ESNetSocketStateInvalid = 0,
// communication is valid
k_ESNetSocketStateConnected = 1,
// states while establishing a connection
k_ESNetSocketStateInitiated = 10, // the connection state machine has started
// p2p connections
k_ESNetSocketStateLocalCandidatesFound = 11, // we've found our local IP info
k_ESNetSocketStateReceivedRemoteCandidates = 12,// we've received information from the remote machine, via the Steam back-end, about their IP info
// direct connections
k_ESNetSocketStateChallengeHandshake = 15, // we've received a challenge packet from the server
// failure states
k_ESNetSocketStateDisconnecting = 21, // the API shut it down, and we're in the process of telling the other end
k_ESNetSocketStateLocalDisconnect = 22, // the API shut it down, and we've completed shutdown
k_ESNetSocketStateTimeoutDuringConnect = 23, // we timed out while trying to creating the connection
k_ESNetSocketStateRemoteEndDisconnected = 24, // the remote end has disconnected from us
k_ESNetSocketStateConnectionBroken = 25, // connection has been broken; either the other end has disappeared or our local network connection has broke
};
// describes how the socket is currently connected
enum ESNetSocketConnectionType
{
k_ESNetSocketConnectionTypeNotConnected = 0,
k_ESNetSocketConnectionTypeUDP = 1,
k_ESNetSocketConnectionTypeUDPRelay = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Functions for making connections and sending data between clients,
// traversing NAT's where possible
//
// NOTE: This interface is deprecated and may be removed in a future release of
/// the Steamworks SDK. Please see ISteamNetworkingSockets and
/// ISteamNetworkingMessages
//-----------------------------------------------------------------------------
class ISteamNetworking
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
//
// UDP-style (connectionless) networking interface. These functions send messages using
// an API organized around the destination. Reliable and unreliable messages are supported.
//
// For a more TCP-style interface (meaning you have a connection handle), see the functions below.
// Both interface styles can send both reliable and unreliable messages.
//
// Automatically establishes NAT-traversing or Relay server connections
//
// These APIs are deprecated, and may be removed in a future version of the Steamworks
// SDK. See ISteamNetworkingMessages.
// Sends a P2P packet to the specified user
// UDP-like, unreliable and a max packet size of 1200 bytes
// the first packet send may be delayed as the NAT-traversal code runs
// if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t
// see EP2PSend enum above for the descriptions of the different ways of sending packets
//
// nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()
// with the same channel number in order to retrieve the data on the other end
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0;
// returns true if any data is available for read, and the amount of data that will need to be read
virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0;
// reads in a packet that has been sent from another user via SendP2PPacket()
// returns the size of the message and the steamID of the user who sent it in the last two parameters
// if the buffer passed in is too small, the message will be truncated
// this call is not blocking, and will return false if no data is available
virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0;
// AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback
// P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet
// if you don't want to talk to the user, just ignore the request
// if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically
// this may be called multiple times for a single user
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
// call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
// call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels
// open channels to a user have been closed, the open session to the user will be closed and new data from this
// user will trigger a P2PSessionRequest_t callback
virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0;
// fills out P2PSessionState_t structure with details about the underlying connection to the user
// should only needed for debugging purposes
// returns false if no connection exists to the specified user
virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0;
// Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection
// or NAT-traversal cannot be established. Only applies to connections created after setting this value,
// or to existing connections that need to automatically reconnect after this value is set.
//
// P2P packet relay is allowed by default
//
// NOTE: This function is deprecated and may be removed in a future version of the SDK. For
// security purposes, we may decide to relay the traffic to certain peers, even if you pass false
// to this function, to prevent revealing the client's IP address top another peer.
virtual bool AllowP2PPacketRelay( bool bAllow ) = 0;
////////////////////////////////////////////////////////////////////////////////////////////
//
// LISTEN / CONNECT connection-oriented interface functions
//
// These functions are more like a client-server TCP API. One side is the "server"
// and "listens" for incoming connections, which then must be "accepted." The "client"
// initiates a connection by "connecting." Sending and receiving is done through a
// connection handle.
//
// For a more UDP-style interface, where you do not track connection handles but
// simply send messages to a SteamID, use the UDP-style functions above.
//
// Both methods can send both reliable and unreliable methods.
//
// These APIs are deprecated, and may be removed in a future version of the Steamworks
// SDK. See ISteamNetworkingSockets.
//
////////////////////////////////////////////////////////////////////////////////////////////
// creates a socket and listens others to connect
// will trigger a SocketStatusCallback_t callback on another client connecting
// nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports
// this can usually just be 0 unless you want multiple sets of connections
// unIP is the local IP address to bind to
// pass in 0 if you just want the default local IP
// unPort is the port to use
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0;
// creates a socket and begin connection to a remote destination
// can connect via a known steamID (client or game server), or directly to an IP
// on success will trigger a SocketStatusCallback_t callback
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0;
virtual SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec ) = 0;
// disconnects the connection to the socket, if any, and invalidates the handle
// any unread data on the socket will be thrown away
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
// destroying a listen socket will automatically kill all the regular sockets generated from it
virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
// sending data
// must be a handle to a connected socket
// data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets
// use the reliable flag with caution; although the resend rate is pretty aggressive,
// it can still cause stalls in receiving data (like TCP)
virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0;
// receiving data
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0;
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
// checks for data from any socket that has been connected off this listen socket
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
// fills out *phSocket with the socket that data is available on
virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// retrieves data from any socket that has been connected off this listen socket
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
// fills out *phSocket with the socket that data is available on
virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// returns information about the specified socket, filling out the contents of the pointers
virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, SteamIPAddress_t *punIPRemote, uint16 *punPortRemote ) = 0;
// returns which local port the listen socket is bound to
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pnIP, uint16 *pnPort ) = 0;
// returns true to describe how the socket ended up connecting
virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0;
// max packet size, in bytes
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
};
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking006"
// Global interface accessor
inline ISteamNetworking *SteamNetworking();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworking *, SteamNetworking, STEAMNETWORKING_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamNetworking *SteamGameServerNetworking();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworking *, SteamGameServerNetworking, STEAMNETWORKING_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// callback notification - a user wants to talk to us over the P2P channel via the SendP2PPacket() API
// in response, a call to AcceptP2PPacketsFromUser() needs to be made, if you want to talk with them
struct P2PSessionRequest_t
{
enum { k_iCallback = k_iSteamNetworkingCallbacks + 2 };
CSteamID m_steamIDRemote; // user who wants to talk to us
};
// callback notification - packets can't get through to the specified user via the SendP2PPacket() API
// all packets queued packets unsent at this point will be dropped
// further attempts to send will retry making the connection (but will be dropped if we fail again)
struct P2PSessionConnectFail_t
{
enum { k_iCallback = k_iSteamNetworkingCallbacks + 3 };
CSteamID m_steamIDRemote; // user we were sending packets to
uint8 m_eP2PSessionError; // EP2PSessionError indicating why we're having trouble
};
// callback notification - status of a socket has changed
// used as part of the CreateListenSocket() / CreateP2PConnectionSocket()
struct SocketStatusCallback_t
{
enum { k_iCallback = k_iSteamNetworkingCallbacks + 1 };
SNetSocket_t m_hSocket; // the socket used to send/receive data to the remote host
SNetListenSocket_t m_hListenSocket; // this is the server socket that we were listening on; NULL if this was an outgoing connection
CSteamID m_steamIDRemote; // remote steamID we have connected to, if it has one
int m_eSNetSocketState; // socket state, ESNetSocketState
};
#pragma pack( pop )
#endif // ISTEAMNETWORKING

View File

@ -0,0 +1,198 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
#ifndef ISTEAMNETWORKINGMESSAGES
#define ISTEAMNETWORKINGMESSAGES
#pragma once
#include "steamnetworkingtypes.h"
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
/// The non-connection-oriented interface to send and receive messages
/// (whether they be "clients" or "servers").
///
/// ISteamNetworkingSockets is connection-oriented (like TCP), meaning you
/// need to listen and connect, and then you send messages using a connection
/// handle. ISteamNetworkingMessages is more like UDP, in that you can just send
/// messages to arbitrary peers at any time. The underlying connections are
/// established implicitly.
///
/// Under the hood ISteamNetworkingMessages works on top of the ISteamNetworkingSockets
/// code, so you get the same routing and messaging efficiency. The difference is
/// mainly in your responsibility to explicitly establish a connection and
/// the type of feedback you get about the state of the connection. Both
/// interfaces can do "P2P" communications, and both support both unreliable
/// and reliable messages, fragmentation and reassembly.
///
/// The primary purpose of this interface is to be "like UDP", so that UDP-based code
/// can be ported easily to take advantage of relayed connections. If you find
/// yourself needing more low level information or control, or to be able to better
/// handle failure, then you probably need to use ISteamNetworkingSockets directly.
/// Also, note that if your main goal is to obtain a connection between two peers
/// without concerning yourself with assigning roles of "client" and "server",
/// you may find the symmetric connection mode of ISteamNetworkingSockets useful.
/// (See k_ESteamNetworkingConfig_SymmetricConnect.)
///
class ISteamNetworkingMessages
{
public:
/// Sends a message to the specified host. If we don't already have a session with that user,
/// a session is implicitly created. There might be some handshaking that needs to happen
/// before we can actually begin sending message data. If this handshaking fails and we can't
/// get through, an error will be posted via the callback SteamNetworkingMessagesSessionFailed_t.
/// There is no notification when the operation succeeds. (You should have the peer send a reply
/// for this purpose.)
///
/// Sending a message to a host will also implicitly accept any incoming connection from that host.
///
/// nSendFlags is a bitmask of k_nSteamNetworkingSend_xxx options
///
/// nRemoteChannel is a routing number you can use to help route message to different systems.
/// You'll have to call ReceiveMessagesOnChannel() with the same channel number in order to retrieve
/// the data on the other end.
///
/// Using different channels to talk to the same user will still use the same underlying
/// connection, saving on resources. If you don't need this feature, use 0.
/// Otherwise, small integers are the most efficient.
///
/// It is guaranteed that reliable messages to the same host on the same channel
/// will be be received by the remote host (if they are received at all) exactly once,
/// and in the same order that they were sent.
///
/// NO other order guarantees exist! In particular, unreliable messages may be dropped,
/// received out of order with respect to each other and with respect to reliable data,
/// or may be received multiple times. Messages on different channels are *not* guaranteed
/// to be received in the order they were sent.
///
/// A note for those familiar with TCP/IP ports, or converting an existing codebase that
/// opened multiple sockets: You might notice that there is only one channel, and with
/// TCP/IP each endpoint has a port number. You can think of the channel number as the
/// *destination* port. If you need each message to also include a "source port" (so the
/// recipient can route the reply), then just put that in your message. That is essentially
/// how UDP works!
///
/// Returns:
/// - k_EREsultOK on success.
/// - k_EResultNoConnection, if the session has failed or was closed by the peer and
/// k_nSteamNetworkingSend_AutoRestartBrokenSession was not specified. (You can
/// use GetSessionConnectionInfo to get the details.) In order to acknowledge the
/// broken session and start a new one, you must call CloseSessionWithUser, or you may
/// repeat the call with k_nSteamNetworkingSend_AutoRestartBrokenSession. See
/// k_nSteamNetworkingSend_AutoRestartBrokenSession for more details.
/// - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values
virtual EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel ) = 0;
/// Reads the next message that has been sent from another user via SendMessageToUser() on the given channel.
/// Returns number of messages returned into your list. (0 if no message are available on that channel.)
///
/// When you're done with the message object(s), make sure and call SteamNetworkingMessage_t::Release()!
virtual int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
/// Call this in response to a SteamNetworkingMessagesSessionRequest_t callback.
/// SteamNetworkingMessagesSessionRequest_t are posted when a user tries to send you a message,
/// and you haven't tried to talk to them first. If you don't want to talk to them, just ignore
/// the request. If the user continues to send you messages, SteamNetworkingMessagesSessionRequest_t
/// callbacks will continue to be posted periodically.
///
/// Returns false if there is no session with the user pending or otherwise. If there is an
/// existing active session, this function will return true, even if it is not pending.
///
/// Calling SendMessageToUser() will implicitly accepts any pending session request to that user.
virtual bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0;
/// Call this when you're done talking to a user to immediately free up resources under-the-hood.
/// If the remote user tries to send data to you again, another SteamNetworkingMessagesSessionRequest_t
/// callback will be posted.
///
/// Note that sessions that go unused for a few minutes are automatically timed out.
virtual bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0;
/// Call this when you're done talking to a user on a specific channel. Once all
/// open channels to a user have been closed, the open session to the user will be
/// closed, and any new data from this user will trigger a
/// SteamSteamNetworkingMessagesSessionRequest_t callback
virtual bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel ) = 0;
/// Returns information about the latest state of a connection, if any, with the given peer.
/// Primarily intended for debugging purposes, but can also be used to get more detailed
/// failure information. (See SendMessageToUser and k_nSteamNetworkingSend_AutoRestartBrokenSession.)
///
/// Returns the value of SteamNetConnectionInfo_t::m_eState, or k_ESteamNetworkingConnectionState_None
/// if no connection exists with specified peer. You may pass nullptr for either parameter if
/// you do not need the corresponding details. Note that sessions time out after a while,
/// so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait
/// indefinitely to obtain the reason for failure.
virtual ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetConnectionRealTimeStatus_t *pQuickStatus ) = 0;
};
#define STEAMNETWORKINGMESSAGES_INTERFACE_VERSION "SteamNetworkingMessages002"
//
// Callbacks
//
#pragma pack( push, 1 )
/// Posted when a remote host is sending us a message, and we do not already have a session with them
struct SteamNetworkingMessagesSessionRequest_t
{
enum { k_iCallback = k_iSteamNetworkingMessagesCallbacks + 1 };
SteamNetworkingIdentity m_identityRemote; // user who wants to talk to us
};
/// Posted when we fail to establish a connection, or we detect that communications
/// have been disrupted it an unusual way. There is no notification when a peer proactively
/// closes the session. ("Closed by peer" is not a concept of UDP-style communications, and
/// SteamNetworkingMessages is primarily intended to make porting UDP code easy.)
///
/// Remember: callbacks are asynchronous. See notes on SendMessageToUser,
/// and k_nSteamNetworkingSend_AutoRestartBrokenSession in particular.
///
/// Also, if a session times out due to inactivity, no callbacks will be posted. The only
/// way to detect that this is happening is that querying the session state may return
/// none, connecting, and findingroute again.
struct SteamNetworkingMessagesSessionFailed_t
{
enum { k_iCallback = k_iSteamNetworkingMessagesCallbacks + 2 };
/// Detailed info about the session that failed.
/// SteamNetConnectionInfo_t::m_identityRemote indicates who this session
/// was with.
SteamNetConnectionInfo_t m_info;
};
#pragma pack(pop)
// Global accessors
// Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
static_assert( STEAMNETWORKINGMESSAGES_INTERFACE_VERSION[25] == '2', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamNetworkingMessages_LibV2();
inline ISteamNetworkingMessages *SteamNetworkingMessages_Lib() { return SteamNetworkingMessages_LibV2(); }
// If running in context of steam, we also define a gameserver instance.
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamGameServerNetworkingMessages_LibV2();
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages_Lib() { return SteamGameServerNetworkingMessages_LibV2(); }
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_LibV2(); }
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_LibV2(); }
#endif
#endif
// Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
// Steamworks SDK
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingMessages *, SteamNetworkingMessages_SteamAPI, STEAMNETWORKINGMESSAGES_INTERFACE_VERSION );
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingMessages *, SteamGameServerNetworkingMessages_SteamAPI, STEAMNETWORKINGMESSAGES_INTERFACE_VERSION );
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_SteamAPI(); }
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_SteamAPI(); }
#endif
#endif
#endif // ISTEAMNETWORKINGMESSAGES

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,500 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: misc networking utilities
//
//=============================================================================
#ifndef ISTEAMNETWORKINGUTILS
#define ISTEAMNETWORKINGUTILS
#pragma once
#include "steamnetworkingtypes.h"
#include "steam_api_common.h"
struct SteamDatagramRelayAuthTicket;
struct SteamRelayNetworkStatus_t;
//-----------------------------------------------------------------------------
/// Misc networking utilities for checking the local networking environment
/// and estimating pings.
class ISteamNetworkingUtils
{
public:
//
// Efficient message sending
//
/// Allocate and initialize a message object. Usually the reason
/// you call this is to pass it to ISteamNetworkingSockets::SendMessages.
/// The returned object will have all of the relevant fields cleared to zero.
///
/// Optionally you can also request that this system allocate space to
/// hold the payload itself. If cbAllocateBuffer is nonzero, the system
/// will allocate memory to hold a payload of at least cbAllocateBuffer bytes.
/// m_pData will point to the allocated buffer, m_cbSize will be set to the
/// size, and m_pfnFreeData will be set to the proper function to free up
/// the buffer.
///
/// If cbAllocateBuffer=0, then no buffer is allocated. m_pData will be NULL,
/// m_cbSize will be zero, and m_pfnFreeData will be NULL. You will need to
/// set each of these.
virtual SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer ) = 0;
//
// Access to Steam Datagram Relay (SDR) network
//
//
// Initialization and status check
//
/// If you know that you are going to be using the relay network (for example,
/// because you anticipate making P2P connections), call this to initialize the
/// relay network. If you do not call this, the initialization will
/// be delayed until the first time you use a feature that requires access
/// to the relay network, which will delay that first access.
///
/// You can also call this to force a retry if the previous attempt has failed.
/// Performing any action that requires access to the relay network will also
/// trigger a retry, and so calling this function is never strictly necessary,
/// but it can be useful to call it a program launch time, if access to the
/// relay network is anticipated.
///
/// Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
/// callbacks to know when initialization has completed.
/// Typically initialization completes in a few seconds.
///
/// Note: dedicated servers hosted in known data centers do *not* need
/// to call this, since they do not make routing decisions. However, if
/// the dedicated server will be using P2P functionality, it will act as
/// a "client" and this should be called.
inline void InitRelayNetworkAccess();
/// Fetch current status of the relay network.
///
/// SteamRelayNetworkStatus_t is also a callback. It will be triggered on
/// both the user and gameserver interfaces any time the status changes, or
/// ping measurement starts or stops.
///
/// SteamRelayNetworkStatus_t::m_eAvail is returned. If you want
/// more details, you can pass a non-NULL value.
virtual ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails ) = 0;
//
// "Ping location" functions
//
// We use the ping times to the valve relays deployed worldwide to
// generate a "marker" that describes the location of an Internet host.
// Given two such markers, we can estimate the network latency between
// two hosts, without sending any packets. The estimate is based on the
// optimal route that is found through the Valve network. If you are
// using the Valve network to carry the traffic, then this is precisely
// the ping you want. If you are not, then the ping time will probably
// still be a reasonable estimate.
//
// This is extremely useful to select peers for matchmaking!
//
// The markers can also be converted to a string, so they can be transmitted.
// We have a separate library you can use on your app's matchmaking/coordinating
// server to manipulate these objects. (See steamdatagram_gamecoordinator.h)
/// Return location info for the current host. Returns the approximate
/// age of the data, in seconds, or -1 if no data is available.
///
/// It takes a few seconds to initialize access to the relay network. If
/// you call this very soon after calling InitRelayNetworkAccess,
/// the data may not be available yet.
///
/// This always return the most up-to-date information we have available
/// right now, even if we are in the middle of re-calculating ping times.
virtual float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) = 0;
/// Estimate the round-trip latency between two arbitrary locations, in
/// milliseconds. This is a conservative estimate, based on routing through
/// the relay network. For most basic relayed connections, this ping time
/// will be pretty accurate, since it will be based on the route likely to
/// be actually used.
///
/// If a direct IP route is used (perhaps via NAT traversal), then the route
/// will be different, and the ping time might be better. Or it might actually
/// be a bit worse! Standard IP routing is frequently suboptimal!
///
/// But even in this case, the estimate obtained using this method is a
/// reasonable upper bound on the ping time. (Also it has the advantage
/// of returning immediately and not sending any packets.)
///
/// In a few cases we might not able to estimate the route. In this case
/// a negative value is returned. k_nSteamNetworkingPing_Failed means
/// the reason was because of some networking difficulty. (Failure to
/// ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot
/// currently answer the question for some other reason.
///
/// Do you need to be able to do this from a backend/matchmaking server?
/// You are looking for the "game coordinator" library.
virtual int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 ) = 0;
/// Same as EstimatePingTime, but assumes that one location is the local host.
/// This is a bit faster, especially if you need to calculate a bunch of
/// these in a loop to find the fastest one.
///
/// In rare cases this might return a slightly different estimate than combining
/// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because
/// this function uses a slightly more complete set of information about what
/// route would be taken.
virtual int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation ) = 0;
/// Convert a ping location into a text format suitable for sending over the wire.
/// The format is a compact and human readable. However, it is subject to change
/// so please do not parse it yourself. Your buffer must be at least
/// k_cchMaxSteamNetworkingPingLocationString bytes.
virtual void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize ) = 0;
/// Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand
/// the string.
virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) = 0;
/// Check if the ping data of sufficient recency is available, and if
/// it's too old, start refreshing it.
///
/// Please only call this function when you *really* do need to force an
/// immediate refresh of the data. (For example, in response to a specific
/// user input to refresh this information.) Don't call it "just in case",
/// before every connection, etc. That will cause extra traffic to be sent
/// for no benefit. The library will automatically refresh the information
/// as needed.
///
/// Returns true if sufficiently recent data is already available.
///
/// Returns false if sufficiently recent data is not available. In this
/// case, ping measurement is initiated, if it is not already active.
/// (You cannot restart a measurement already in progress.)
///
/// You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
/// to know when ping measurement completes.
virtual bool CheckPingDataUpToDate( float flMaxAgeSeconds ) = 0;
//
// List of Valve data centers, and ping times to them. This might
// be useful to you if you are use our hosting, or just need to measure
// latency to a cloud data center where we are running relays.
//
/// Fetch ping time of best available relayed route from this host to
/// the specified data center.
virtual int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP ) = 0;
/// Get *direct* ping time to the relays at the data center.
virtual int GetDirectPingToPOP( SteamNetworkingPOPID popID ) = 0;
/// Get number of network points of presence in the config
virtual int GetPOPCount() = 0;
/// Get list of all POP IDs. Returns the number of entries that were filled into
/// your list.
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
//
// Misc
//
/// Fetch current timestamp. This timer has the following properties:
///
/// - Monotonicity is guaranteed.
/// - The initial value will be at least 24*3600*30*1e6, i.e. about
/// 30 days worth of microseconds. In this way, the timestamp value of
/// 0 will always be at least "30 days ago". Also, negative numbers
/// will never be returned.
/// - Wraparound / overflow is not a practical concern.
///
/// If you are running under the debugger and stop the process, the clock
/// might not advance the full wall clock time that has elapsed between
/// calls. If the process is not blocked from normal operation, the
/// timestamp values will track wall clock time, even if you don't call
/// the function frequently.
///
/// The value is only meaningful for this run of the process. Don't compare
/// it to values obtained on another computer, or other runs of the same process.
virtual SteamNetworkingMicroseconds GetLocalTimestamp() = 0;
/// Set a function to receive network-related information that is useful for debugging.
/// This can be very useful during development, but it can also be useful for troubleshooting
/// problems with tech savvy end users. If you have a console or other log that customers
/// can examine, these log messages can often be helpful to troubleshoot network issues.
/// (Especially any warning/error messages.)
///
/// The detail level indicates what message to invoke your callback on. Lower numeric
/// value means more important, and the value you pass is the lowest priority (highest
/// numeric value) you wish to receive callbacks for.
///
/// The value here controls the detail level for most messages. You can control the
/// detail level for various subsystems (perhaps only for certain connections) by
/// adjusting the configuration values k_ESteamNetworkingConfig_LogLevel_Xxxxx.
///
/// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
/// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT
/// request a high detail level and then filter out messages in your callback. This incurs
/// all of the expense of formatting the messages, which are then discarded. Setting a high
/// priority value (low numeric value) here allows the library to avoid doing this work.
///
/// IMPORTANT: This may be called from a service thread, while we own a mutex, etc.
/// Your output function must be threadsafe and fast! Do not make any other
/// Steamworks calls from within the handler.
virtual void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc ) = 0;
//
// Fake IP
//
// Useful for interfacing with code that assumes peers are identified using an IPv4 address
//
/// Return true if an IPv4 address is one that might be used as a "fake" one.
/// This function is fast; it just does some logical tests on the IP and does
/// not need to do any lookup operations.
inline bool IsFakeIPv4( uint32 nIPv4 ) { return GetIPv4FakeIPType( nIPv4 ) > k_ESteamNetworkingFakeIPType_NotFake; }
virtual ESteamNetworkingFakeIPType GetIPv4FakeIPType( uint32 nIPv4 ) = 0;
/// Get the real identity associated with a given FakeIP.
///
/// On failure, returns:
/// - k_EResultInvalidParam: the IP is not a FakeIP.
/// - k_EResultNoMatch: we don't recognize that FakeIP and don't know the corresponding identity.
///
/// FakeIP's used by active connections, or the FakeIPs assigned to local identities,
/// will always work. FakeIPs for recently destroyed connections will continue to
/// return results for a little while, but not forever. At some point, we will forget
/// FakeIPs to save space. It's reasonably safe to assume that you can read back the
/// real identity of a connection very soon after it is destroyed. But do not wait
/// indefinitely.
virtual EResult GetRealIdentityForFakeIP( const SteamNetworkingIPAddr &fakeIP, SteamNetworkingIdentity *pOutRealIdentity ) = 0;
//
// Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.
//
// Shortcuts for common cases. (Implemented as inline functions below)
bool SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val );
bool SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val );
bool SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val );
bool SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *val );
bool SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val );
bool SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val );
bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val );
//
// Set global callbacks. If you do not want to use Steam's callback dispatch mechanism and you
// want to use the same callback on all (or most) listen sockets and connections, then
// simply install these callbacks first thing, and you are good to go.
// See ISteamNetworkingSockets::RunCallbacks
//
bool SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback );
bool SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback );
bool SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback );
bool SetGlobalCallback_FakeIPResult( FnSteamNetworkingFakeIPResult fnCallback );
bool SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback );
bool SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback );
/// Set a configuration value.
/// - eValue: which value is being set
/// - eScope: Onto what type of object are you applying the setting?
/// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.
/// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!
/// - pArg: Value to set it to. You can pass NULL to remove a non-global setting at this scope,
/// causing the value for that object to use global defaults. Or at global scope, passing NULL
/// will reset any custom value and restore it to the system default.
/// NOTE: When setting pointers (e.g. callback functions), do not pass the function pointer directly.
/// Your argument should be a pointer to a function pointer.
virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0;
/// Set a configuration value, using a struct to pass the value.
/// (This is just a convenience shortcut; see below for the implementation and
/// a little insight into how SteamNetworkingConfigValue_t is used when
/// setting config options during listen socket and connection creation.)
bool SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj );
/// Get a configuration value.
/// - eValue: which value to fetch
/// - eScopeType: query setting on what type of object
/// - eScopeArg: the object to query the setting for
/// - pOutDataType: If non-NULL, the data type of the value is returned.
/// - pResult: Where to put the result. Pass NULL to query the required buffer size. (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)
/// - cbResult: IN: the size of your buffer. OUT: the number of bytes filled in or required.
virtual ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult ) = 0;
/// Get info about a configuration value. Returns the name of the value,
/// or NULL if the value doesn't exist. Other output parameters can be NULL
/// if you do not need them.
virtual const char *GetConfigValueInfo( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigDataType *pOutDataType,
ESteamNetworkingConfigScope *pOutScope ) = 0;
/// Iterate the list of all configuration values in the current environment that it might
/// be possible to display or edit using a generic UI. To get the first iterable value,
/// pass k_ESteamNetworkingConfig_Invalid. Returns k_ESteamNetworkingConfig_Invalid
/// to signal end of list.
///
/// The bEnumerateDevVars argument can be used to include "dev" vars. These are vars that
/// are recommended to only be editable in "debug" or "dev" mode and typically should not be
/// shown in a retail environment where a malicious local user might use this to cheat.
virtual ESteamNetworkingConfigValue IterateGenericEditableConfigValues( ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars ) = 0;
//
// String conversions. You'll usually access these using the respective
// inline methods.
//
virtual void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort ) = 0;
virtual bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ) = 0;
virtual ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( const SteamNetworkingIPAddr &addr ) = 0;
virtual void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ) = 0;
virtual bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) = 0;
protected:
~ISteamNetworkingUtils(); // Silence some warnings
};
#define STEAMNETWORKINGUTILS_INTERFACE_VERSION "SteamNetworkingUtils004"
// Global accessors
// Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib
static_assert( STEAMNETWORKINGUTILS_INTERFACE_VERSION[22] == '4', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingUtils *SteamNetworkingUtils_LibV4();
inline ISteamNetworkingUtils *SteamNetworkingUtils_Lib() { return SteamNetworkingUtils_LibV4(); }
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingUtils *SteamNetworkingUtils() { return SteamNetworkingUtils_LibV4(); }
#endif
#endif
// Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils_SteamAPI,
/* Prefer user version of the interface. But if it isn't found, then use
gameserver one. Yes, this is a completely terrible hack */
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) ?
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) :
SteamInternal_FindOrCreateGameServerInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ),
"global",
STEAMNETWORKINGUTILS_INTERFACE_VERSION
)
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingUtils *SteamNetworkingUtils() { return SteamNetworkingUtils_SteamAPI(); }
#endif
#endif
/// A struct used to describe our readiness to use the relay network.
/// To do this we first need to fetch the network configuration,
/// which describes what POPs are available.
struct SteamRelayNetworkStatus_t
{
enum { k_iCallback = k_iSteamNetworkingUtilsCallbacks + 1 };
/// Summary status. When this is "current", initialization has
/// completed. Anything else means you are not ready yet, or
/// there is a significant problem.
ESteamNetworkingAvailability m_eAvail;
/// Nonzero if latency measurement is in progress (or pending,
/// awaiting a prerequisite).
int m_bPingMeasurementInProgress;
/// Status obtaining the network config. This is a prerequisite
/// for relay network access.
///
/// Failure to obtain the network config almost always indicates
/// a problem with the local internet connection.
ESteamNetworkingAvailability m_eAvailNetworkConfig;
/// Current ability to communicate with ANY relay. Note that
/// the complete failure to communicate with any relays almost
/// always indicates a problem with the local Internet connection.
/// (However, just because you can reach a single relay doesn't
/// mean that the local connection is in perfect health.)
ESteamNetworkingAvailability m_eAvailAnyRelay;
/// Non-localized English language status. For diagnostic/debugging
/// purposes only.
char m_debugMsg[ 256 ];
};
#ifndef API_GEN
/// Utility class for printing a SteamNetworkingIdentity.
/// E.g. printf( "Identity is '%s'\n", SteamNetworkingIdentityRender( identity ).c_str() );
struct SteamNetworkingIdentityRender
{
SteamNetworkingIdentityRender( const SteamNetworkingIdentity &x ) { x.ToString( buf, sizeof(buf) ); }
inline const char *c_str() const { return buf; }
private:
char buf[ SteamNetworkingIdentity::k_cchMaxString ];
};
/// Utility class for printing a SteamNetworkingIPAddrRender.
struct SteamNetworkingIPAddrRender
{
SteamNetworkingIPAddrRender( const SteamNetworkingIPAddr &x, bool bWithPort = true ) { x.ToString( buf, sizeof(buf), bWithPort ); }
inline const char *c_str() const { return buf; }
private:
char buf[ SteamNetworkingIPAddr::k_cchMaxString ];
};
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Internal stuff
inline void ISteamNetworkingUtils::InitRelayNetworkAccess() { CheckPingDataUpToDate( 1e10f ); }
inline bool ISteamNetworkingUtils::SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Int32, &val ); }
inline bool ISteamNetworkingUtils::SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Float, &val ); }
inline bool ISteamNetworkingUtils::SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_String, val ); }
inline bool ISteamNetworkingUtils::SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Ptr, &val ); } // Note: passing pointer to pointer.
inline bool ISteamNetworkingUtils::SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Int32, &val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Float, &val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_String, val ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_AuthStatusChanged, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_FakeIPResult( FnSteamNetworkingFakeIPResult fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_FakeIPResult, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj )
{
// Locate the argument. Strings are a special case, since the
// "value" (the whole string buffer) doesn't fit in the struct
// NOTE: for pointer values, we pass a pointer to the pointer,
// we do not pass the pointer directly.
const void *pVal = ( opt.m_eDataType == k_ESteamNetworkingConfig_String ) ? (const void *)opt.m_val.m_string : (const void *)&opt.m_val;
return SetConfigValue( opt.m_eValue, eScopeType, scopeObj, opt.m_eDataType, pVal );
}
// How to get helper functions.
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || defined(STEAMNETWORKINGSOCKETS_FOREXPORT) || defined( STEAMNETWORKINGSOCKETS_STANDALONELIB )
// Call direct to static functions
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *pAddr, char *buf, size_t cbBuf, bool bWithPort );
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr );
STEAMNETWORKINGSOCKETS_INTERFACE ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( const SteamNetworkingIPAddr *pAddr );
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity *pIdentity, char *buf, size_t cbBuf );
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, size_t sizeofIdentity, const char *pszStr );
inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingIPAddr_ToString( this, buf, cbBuf, bWithPort ); }
inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamNetworkingIPAddr_ParseString( this, pszStr ); }
inline ESteamNetworkingFakeIPType SteamNetworkingIPAddr::GetFakeIPType() const { return SteamNetworkingIPAddr_GetFakeIPType( this ); }
inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamNetworkingIdentity_ToString( this, buf, cbBuf ); }
inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamNetworkingIdentity_ParseString( this, sizeof(*this), pszStr ); }
#elif defined( STEAMNETWORKINGSOCKETS_STEAMAPI )
// Using steamworks SDK - go through SteamNetworkingUtils()
inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingUtils()->SteamNetworkingIPAddr_ToString( *this, buf, cbBuf, bWithPort ); }
inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamNetworkingUtils()->SteamNetworkingIPAddr_ParseString( this, pszStr ); }
inline ESteamNetworkingFakeIPType SteamNetworkingIPAddr::GetFakeIPType() const { return SteamNetworkingUtils()->SteamNetworkingIPAddr_GetFakeIPType( *this ); }
inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamNetworkingUtils()->SteamNetworkingIdentity_ToString( *this, buf, cbBuf ); }
inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamNetworkingUtils()->SteamNetworkingIdentity_ParseString( this, pszStr ); }
#else
#error "Invalid config"
#endif
#endif // ISTEAMNETWORKINGUTILS

View File

@ -0,0 +1,65 @@
//====== Copyright <20> 2013-, Valve Corporation, All rights reserved. =======
//
// Purpose: Interface to Steam parental settings (Family View)
//
//=============================================================================
#ifndef ISTEAMPARENTALSETTINGS_H
#define ISTEAMPARENTALSETTINGS_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
// Feature types for parental settings
enum EParentalFeature
{
k_EFeatureInvalid = 0,
k_EFeatureStore = 1,
k_EFeatureCommunity = 2,
k_EFeatureProfile = 3,
k_EFeatureFriends = 4,
k_EFeatureNews = 5,
k_EFeatureTrading = 6,
k_EFeatureSettings = 7,
k_EFeatureConsole = 8,
k_EFeatureBrowser = 9,
k_EFeatureParentalSetup = 10,
k_EFeatureLibrary = 11,
k_EFeatureTest = 12,
k_EFeatureSiteLicense = 13,
k_EFeatureKioskMode_Deprecated = 14,
k_EFeatureBlockAlways = 15,
k_EFeatureMax
};
class ISteamParentalSettings
{
public:
virtual bool BIsParentalLockEnabled() = 0;
virtual bool BIsParentalLockLocked() = 0;
virtual bool BIsAppBlocked( AppId_t nAppID ) = 0;
virtual bool BIsAppInBlockList( AppId_t nAppID ) = 0;
virtual bool BIsFeatureBlocked( EParentalFeature eFeature ) = 0;
virtual bool BIsFeatureInBlockList( EParentalFeature eFeature ) = 0;
};
#define STEAMPARENTALSETTINGS_INTERFACE_VERSION "STEAMPARENTALSETTINGS_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamParentalSettings *SteamParentalSettings();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamParentalSettings *, SteamParentalSettings, STEAMPARENTALSETTINGS_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamParentalSettingsChanged_t
{
enum { k_iCallback = k_ISteamParentalSettingsCallbacks + 1 };
};
#endif // ISTEAMPARENTALSETTINGS_H

View File

@ -0,0 +1,91 @@
//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. =======
//
// Purpose: interface the game must provide Steam with on PS3 in order for the
// Steam overlay to render.
//
//=============================================================================
#ifndef ISTEAMPS3OVERLAYRENDERER_H
#define ISTEAMPS3OVERLAYRENDERER_H
#ifdef _WIN32
#pragma once
#endif
#include "cell/pad.h"
//-----------------------------------------------------------------------------
// Purpose: Enum for supported gradient directions
//-----------------------------------------------------------------------------
enum EOverlayGradientDirection
{
k_EOverlayGradientHorizontal = 1,
k_EOverlayGradientVertical = 2,
k_EOverlayGradientNone = 3,
};
// Helpers for fetching individual color components from ARGB packed DWORD colors Steam PS3 overlay renderer uses.
#define STEAM_COLOR_RED( color ) \
(int)(((color)>>16)&0xff)
#define STEAM_COLOR_GREEN( color ) \
(int)(((color)>>8)&0xff)
#define STEAM_COLOR_BLUE( color ) \
(int)((color)&0xff)
#define STEAM_COLOR_ALPHA( color ) \
(int)(((color)>>24)&0xff)
//-----------------------------------------------------------------------------
// Purpose: Interface the game must expose to Steam for rendering
//-----------------------------------------------------------------------------
class ISteamPS3OverlayRenderHost
{
public:
// Interface for game engine to implement which Steam requires to render.
// Draw a textured rect. This may use only part of the texture and will pass texture coords, it will also possibly request a gradient and will specify colors for vertexes.
virtual void DrawTexturedRect( int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection ) = 0;
// Load a RGBA texture for Steam, or update a previously loaded one. Updates may be partial. You must not evict or remove this texture once Steam has uploaded it.
virtual void LoadOrUpdateTexture( int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char *pData ) = 0;
// Delete a texture Steam previously uploaded
virtual void DeleteTexture( int32 iTextureID ) = 0;
// Delete all previously uploaded textures
virtual void DeleteAllTextures() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Interface Steam exposes for the game to tell it when to render, etc.
//-----------------------------------------------------------------------------
class ISteamPS3OverlayRender
{
public:
// Call once at startup to initialize the Steam overlay and pass it your host interface ptr
virtual bool BHostInitialize( uint32 unScreenWidth, uint32 unScreenHeight, uint32 unRefreshRate, ISteamPS3OverlayRenderHost *pRenderHost, void *CellFontLib ) = 0;
// Call this once a frame when you are ready for the Steam overlay to render (ie, right before flipping buffers, after all your rendering)
virtual void Render() = 0;
// Call this everytime you read input on PS3.
//
// If this returns true, then the overlay is active and has consumed the input, your game
// should then ignore all the input until BHandleCellPadData once again returns false, which
// will mean the overlay is deactivated.
virtual bool BHandleCellPadData( const CellPadData &padData ) = 0;
// Call this if you detect no controllers connected or that the XMB is intercepting input
//
// This is important to clear input state for the overlay, so keys left down during XMB activation
// are not continued to be processed.
virtual bool BResetInputState() = 0;
};
#endif // ISTEAMPS3OVERLAYRENDERER_H

View File

@ -0,0 +1,369 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
#ifndef ISTEAMREMOTEPLAY_H
#define ISTEAMREMOTEPLAY_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: The form factor of a device
//-----------------------------------------------------------------------------
enum ESteamDeviceFormFactor
{
k_ESteamDeviceFormFactorUnknown = 0,
k_ESteamDeviceFormFactorPhone = 1,
k_ESteamDeviceFormFactorTablet = 2,
k_ESteamDeviceFormFactorComputer = 3,
k_ESteamDeviceFormFactorTV = 4,
k_ESteamDeviceFormFactorVRHeadset = 5,
};
// Steam Remote Play session ID
typedef uint32 RemotePlaySessionID_t;
// Steam Remote Play mouse cursor ID
typedef uint32 RemotePlayCursorID_t;
//-----------------------------------------------------------------------------
// Purpose: The type of input in ERemotePlayInput_t
//-----------------------------------------------------------------------------
enum ERemotePlayInputType
{
k_ERemotePlayInputUnknown,
k_ERemotePlayInputMouseMotion,
k_ERemotePlayInputMouseButtonDown,
k_ERemotePlayInputMouseButtonUp,
k_ERemotePlayInputMouseWheel,
k_ERemotePlayInputKeyDown,
k_ERemotePlayInputKeyUp
};
//-----------------------------------------------------------------------------
// Purpose: Mouse buttons in ERemotePlayInput_t
//-----------------------------------------------------------------------------
enum ERemotePlayMouseButton
{
k_ERemotePlayMouseButtonLeft = 0x0001,
k_ERemotePlayMouseButtonRight = 0x0002,
k_ERemotePlayMouseButtonMiddle = 0x0010,
k_ERemotePlayMouseButtonX1 = 0x0020,
k_ERemotePlayMouseButtonX2 = 0x0040,
};
//-----------------------------------------------------------------------------
// Purpose: Mouse wheel direction in ERemotePlayInput_t
//-----------------------------------------------------------------------------
enum ERemotePlayMouseWheelDirection
{
k_ERemotePlayMouseWheelUp = 1,
k_ERemotePlayMouseWheelDown = 2,
k_ERemotePlayMouseWheelLeft = 3,
k_ERemotePlayMouseWheelRight = 4,
};
//-----------------------------------------------------------------------------
// Purpose: Key scancode in ERemotePlayInput_t
//
// This is a USB scancode value as defined for the Keyboard/Keypad Page (0x07)
// This enumeration isn't a complete list, just the most commonly used keys.
//-----------------------------------------------------------------------------
enum ERemotePlayScancode
{
k_ERemotePlayScancodeUnknown = 0,
k_ERemotePlayScancodeA = 4,
k_ERemotePlayScancodeB = 5,
k_ERemotePlayScancodeC = 6,
k_ERemotePlayScancodeD = 7,
k_ERemotePlayScancodeE = 8,
k_ERemotePlayScancodeF = 9,
k_ERemotePlayScancodeG = 10,
k_ERemotePlayScancodeH = 11,
k_ERemotePlayScancodeI = 12,
k_ERemotePlayScancodeJ = 13,
k_ERemotePlayScancodeK = 14,
k_ERemotePlayScancodeL = 15,
k_ERemotePlayScancodeM = 16,
k_ERemotePlayScancodeN = 17,
k_ERemotePlayScancodeO = 18,
k_ERemotePlayScancodeP = 19,
k_ERemotePlayScancodeQ = 20,
k_ERemotePlayScancodeR = 21,
k_ERemotePlayScancodeS = 22,
k_ERemotePlayScancodeT = 23,
k_ERemotePlayScancodeU = 24,
k_ERemotePlayScancodeV = 25,
k_ERemotePlayScancodeW = 26,
k_ERemotePlayScancodeX = 27,
k_ERemotePlayScancodeY = 28,
k_ERemotePlayScancodeZ = 29,
k_ERemotePlayScancode1 = 30,
k_ERemotePlayScancode2 = 31,
k_ERemotePlayScancode3 = 32,
k_ERemotePlayScancode4 = 33,
k_ERemotePlayScancode5 = 34,
k_ERemotePlayScancode6 = 35,
k_ERemotePlayScancode7 = 36,
k_ERemotePlayScancode8 = 37,
k_ERemotePlayScancode9 = 38,
k_ERemotePlayScancode0 = 39,
k_ERemotePlayScancodeReturn = 40,
k_ERemotePlayScancodeEscape = 41,
k_ERemotePlayScancodeBackspace = 42,
k_ERemotePlayScancodeTab = 43,
k_ERemotePlayScancodeSpace = 44,
k_ERemotePlayScancodeMinus = 45,
k_ERemotePlayScancodeEquals = 46,
k_ERemotePlayScancodeLeftBracket = 47,
k_ERemotePlayScancodeRightBracket = 48,
k_ERemotePlayScancodeBackslash = 49,
k_ERemotePlayScancodeSemicolon = 51,
k_ERemotePlayScancodeApostrophe = 52,
k_ERemotePlayScancodeGrave = 53,
k_ERemotePlayScancodeComma = 54,
k_ERemotePlayScancodePeriod = 55,
k_ERemotePlayScancodeSlash = 56,
k_ERemotePlayScancodeCapsLock = 57,
k_ERemotePlayScancodeF1 = 58,
k_ERemotePlayScancodeF2 = 59,
k_ERemotePlayScancodeF3 = 60,
k_ERemotePlayScancodeF4 = 61,
k_ERemotePlayScancodeF5 = 62,
k_ERemotePlayScancodeF6 = 63,
k_ERemotePlayScancodeF7 = 64,
k_ERemotePlayScancodeF8 = 65,
k_ERemotePlayScancodeF9 = 66,
k_ERemotePlayScancodeF10 = 67,
k_ERemotePlayScancodeF11 = 68,
k_ERemotePlayScancodeF12 = 69,
k_ERemotePlayScancodeInsert = 73,
k_ERemotePlayScancodeHome = 74,
k_ERemotePlayScancodePageUp = 75,
k_ERemotePlayScancodeDelete = 76,
k_ERemotePlayScancodeEnd = 77,
k_ERemotePlayScancodePageDown = 78,
k_ERemotePlayScancodeRight = 79,
k_ERemotePlayScancodeLeft = 80,
k_ERemotePlayScancodeDown = 81,
k_ERemotePlayScancodeUp = 82,
k_ERemotePlayScancodeLeftControl = 224,
k_ERemotePlayScancodeLeftShift = 225,
k_ERemotePlayScancodeLeftAlt = 226,
k_ERemotePlayScancodeLeftGUI = 227, // windows, command (apple), meta
k_ERemotePlayScancodeRightControl = 228,
k_ERemotePlayScancodeRightShift = 229,
k_ERemotePlayScancodeRightALT = 230,
k_ERemotePlayScancodeRightGUI = 231, // windows, command (apple), meta
};
//-----------------------------------------------------------------------------
// Purpose: Key modifier in ERemotePlayInput_t
//-----------------------------------------------------------------------------
enum ERemotePlayKeyModifier
{
k_ERemotePlayKeyModifierNone = 0x0000,
k_ERemotePlayKeyModifierLeftShift = 0x0001,
k_ERemotePlayKeyModifierRightShift = 0x0002,
k_ERemotePlayKeyModifierLeftControl = 0x0040,
k_ERemotePlayKeyModifierRightControl = 0x0080,
k_ERemotePlayKeyModifierLeftAlt = 0x0100,
k_ERemotePlayKeyModifierRightAlt = 0x0200,
k_ERemotePlayKeyModifierLeftGUI = 0x0400,
k_ERemotePlayKeyModifierRightGUI = 0x0800,
k_ERemotePlayKeyModifierNumLock = 0x1000,
k_ERemotePlayKeyModifierCapsLock = 0x2000,
k_ERemotePlayKeyModifierMask = 0xFFFF,
};
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// Mouse motion event data, valid when m_eType is k_ERemotePlayInputMouseMotion
struct RemotePlayInputMouseMotion_t
{
bool m_bAbsolute; // True if this is absolute mouse motion and m_flNormalizedX and m_flNormalizedY are valid
float m_flNormalizedX; // The absolute X position of the mouse, normalized to the display, if m_bAbsolute is true
float m_flNormalizedY; // The absolute Y position of the mouse, normalized to the display, if m_bAbsolute is true
int m_nDeltaX; // Relative mouse motion in the X direction
int m_nDeltaY; // Relative mouse motion in the Y direction
};
// Mouse wheel event data, valid when m_eType is k_ERemotePlayInputMouseWheel
struct RemotePlayInputMouseWheel_t
{
ERemotePlayMouseWheelDirection m_eDirection;
float m_flAmount; // 1.0f is a single click of the wheel, 120 units on Windows
};
// Key event data, valid when m_eType is k_ERemotePlayInputKeyDown or k_ERemotePlayInputKeyUp
struct RemotePlayInputKey_t
{
int m_eScancode; // Keyboard scancode, common values are defined in ERemotePlayScancode
uint32 m_unModifiers; // Mask of ERemotePlayKeyModifier active for this key event
uint32 m_unKeycode; // UCS-4 character generated by the keypress, or 0 if it wasn't a character key, e.g. Delete or Left Arrow
};
struct RemotePlayInput_t
{
RemotePlaySessionID_t m_unSessionID;
ERemotePlayInputType m_eType;
union
{
// Mouse motion event data, valid when m_eType is k_ERemotePlayInputMouseMotion
RemotePlayInputMouseMotion_t m_MouseMotion;
// Mouse button event data, valid when m_eType is k_ERemotePlayInputMouseButtonDown or k_ERemotePlayInputMouseButtonUp
ERemotePlayMouseButton m_eMouseButton;
// Mouse wheel event data, valid when m_eType is k_ERemotePlayInputMouseWheel
RemotePlayInputMouseWheel_t m_MouseWheel;
// Key event data, valid when m_eType is k_ERemotePlayInputKeyDown or k_ERemotePlayInputKeyUp
RemotePlayInputKey_t m_Key;
// Unused space for future use
char padding[ 64 - ( sizeof( m_unSessionID ) + sizeof( m_eType ) ) ];
};
};
//COMPILE_TIME_ASSERT( sizeof( RemotePlayInput_t ) == 64 );
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Functions to provide information about Steam Remote Play sessions
//-----------------------------------------------------------------------------
class ISteamRemotePlay
{
public:
// Get the number of currently connected Steam Remote Play sessions
virtual uint32 GetSessionCount() = 0;
// Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds.
virtual RemotePlaySessionID_t GetSessionID( int iSessionIndex ) = 0;
// Get the SteamID of the connected user
virtual CSteamID GetSessionSteamID( RemotePlaySessionID_t unSessionID ) = 0;
// Get the name of the session client device
// This returns NULL if the sessionID is not valid
virtual const char *GetSessionClientName( RemotePlaySessionID_t unSessionID ) = 0;
// Get the form factor of the session client device
virtual ESteamDeviceFormFactor GetSessionClientFormFactor( RemotePlaySessionID_t unSessionID ) = 0;
// Get the resolution, in pixels, of the session client device
// This is set to 0x0 if the resolution is not available
virtual bool BGetSessionClientResolution( RemotePlaySessionID_t unSessionID, int *pnResolutionX, int *pnResolutionY ) = 0;
// Show the Remote Play Together UI in the game overlay
// This returns false if your game is not configured for Remote Play Together
virtual bool ShowRemotePlayTogetherUI() = 0;
// Invite a friend to Remote Play Together, or create a guest invite if steamIDFriend is empty
// This will automatically start Remote Play Together if it hasn't already been started
// This returns false if the invite can't be sent or your game is not configured for Remote Play Together
virtual bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend ) = 0;
// Make mouse and keyboard input for Remote Play Together sessions available via GetInput() instead of being merged with local input
virtual bool BEnableRemotePlayTogetherDirectInput() = 0;
// Merge Remote Play Together mouse and keyboard input with local input
virtual void DisableRemotePlayTogetherDirectInput() = 0;
// Get input events from Remote Play Together sessions
// This is available after calling BEnableRemotePlayTogetherDirectInput()
//
// pInput is an array of input events that will be filled in by this function, up to unMaxEvents.
// This returns the number of events copied to pInput, or the number of events available if pInput is nullptr.
virtual uint32 GetInput( RemotePlayInput_t *pInput, uint32 unMaxEvents ) = 0;
// Set the mouse cursor visibility for a remote player
// This is available after calling BEnableRemotePlayTogetherDirectInput()
virtual void SetMouseVisibility( RemotePlaySessionID_t unSessionID, bool bVisible ) = 0;
// Set the mouse cursor position for a remote player
// This is available after calling BEnableRemotePlayTogetherDirectInput()
//
// This is used to warp the cursor to a specific location and isn't needed during normal event processing.
//
// The position is normalized relative to the window, where 0,0 is the upper left, and 1,1 is the lower right.
virtual void SetMousePosition( RemotePlaySessionID_t unSessionID, float flNormalizedX, float flNormalizedY ) = 0;
// Create a cursor that can be used with SetMouseCursor()
// This is available after calling BEnableRemotePlayTogetherDirectInput()
//
// Parameters:
// nWidth - The width of the cursor, in pixels
// nHeight - The height of the cursor, in pixels
// nHotX - The X coordinate of the cursor hot spot in pixels, offset from the left of the cursor
// nHotY - The Y coordinate of the cursor hot spot in pixels, offset from the top of the cursor
// pBGRA - A pointer to the cursor pixels, with the color channels in red, green, blue, alpha order
// nPitch - The distance between pixel rows in bytes, defaults to nWidth * 4
virtual RemotePlayCursorID_t CreateMouseCursor( int nWidth, int nHeight, int nHotX, int nHotY, const void *pBGRA, int nPitch = 0 ) = 0;
// Set the mouse cursor for a remote player
// This is available after calling BEnableRemotePlayTogetherDirectInput()
//
// The cursor ID is a value returned by CreateMouseCursor()
virtual void SetMouseCursor( RemotePlaySessionID_t unSessionID, RemotePlayCursorID_t unCursorID ) = 0;
};
#define STEAMREMOTEPLAY_INTERFACE_VERSION "STEAMREMOTEPLAY_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamRemotePlay *SteamRemotePlay();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemotePlay *, SteamRemotePlay, STEAMREMOTEPLAY_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionConnected_t, k_iSteamRemotePlayCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
STEAM_CALLBACK_END( 0 )
STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionDisconnected_t, k_iSteamRemotePlayCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
STEAM_CALLBACK_END( 0 )
STEAM_CALLBACK_BEGIN( SteamRemotePlayTogetherGuestInvite_t, k_iSteamRemotePlayCallbacks + 3 )
STEAM_CALLBACK_MEMBER_ARRAY( 0, char, m_szConnectURL, 1024 )
STEAM_CALLBACK_END( 0 )
#pragma pack( pop )
#endif // #define ISTEAMREMOTEPLAY_H

View File

@ -0,0 +1,661 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: public interface to user remote file storage in Steam
//
//=============================================================================
#ifndef ISTEAMREMOTESTORAGE_H
#define ISTEAMREMOTESTORAGE_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Defines the largest allowed file size. Cloud files cannot be written
// in a single chunk over 100MB (and cannot be over 200MB total.)
//-----------------------------------------------------------------------------
const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
//-----------------------------------------------------------------------------
// Purpose: Structure that contains an array of const char * strings and the number of those strings
//-----------------------------------------------------------------------------
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct SteamParamStringArray_t
{
const char ** m_ppStrings;
int32 m_nNumStrings;
};
#pragma pack( pop )
// A handle to a piece of user generated content
typedef uint64 UGCHandle_t;
typedef uint64 PublishedFileUpdateHandle_t;
typedef uint64 PublishedFileId_t;
const PublishedFileId_t k_PublishedFileIdInvalid = 0;
const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull;
const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull;
// Handle for writing to Steam Cloud
typedef uint64 UGCFileWriteStreamHandle_t;
const UGCFileWriteStreamHandle_t k_UGCFileStreamHandleInvalid = 0xffffffffffffffffull;
const uint32 k_cchPublishedDocumentTitleMax = 128 + 1;
const uint32 k_cchPublishedDocumentDescriptionMax = 8000;
const uint32 k_cchPublishedDocumentChangeDescriptionMax = 8000;
const uint32 k_unEnumeratePublishedFilesMaxResults = 50;
const uint32 k_cchTagListMax = 1024 + 1;
const uint32 k_cchFilenameMax = 260;
const uint32 k_cchPublishedFileURLMax = 256;
enum ERemoteStoragePlatform
{
k_ERemoteStoragePlatformNone = 0,
k_ERemoteStoragePlatformWindows = (1 << 0),
k_ERemoteStoragePlatformOSX = (1 << 1),
k_ERemoteStoragePlatformPS3 = (1 << 2),
k_ERemoteStoragePlatformLinux = (1 << 3),
k_ERemoteStoragePlatformSwitch = (1 << 4),
k_ERemoteStoragePlatformAndroid = (1 << 5),
k_ERemoteStoragePlatformIOS = (1 << 6),
// NB we get one more before we need to widen some things
k_ERemoteStoragePlatformAll = 0xffffffff
};
enum ERemoteStoragePublishedFileVisibility
{
k_ERemoteStoragePublishedFileVisibilityPublic = 0,
k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1,
k_ERemoteStoragePublishedFileVisibilityPrivate = 2,
k_ERemoteStoragePublishedFileVisibilityUnlisted = 3,
};
enum EWorkshopFileType
{
k_EWorkshopFileTypeFirst = 0,
k_EWorkshopFileTypeCommunity = 0, // normal Workshop item that can be subscribed to
k_EWorkshopFileTypeMicrotransaction = 1, // Workshop item that is meant to be voted on for the purpose of selling in-game
k_EWorkshopFileTypeCollection = 2, // a collection of Workshop or Greenlight items
k_EWorkshopFileTypeArt = 3, // artwork
k_EWorkshopFileTypeVideo = 4, // external video
k_EWorkshopFileTypeScreenshot = 5, // screenshot
k_EWorkshopFileTypeGame = 6, // Greenlight game entry
k_EWorkshopFileTypeSoftware = 7, // Greenlight software entry
k_EWorkshopFileTypeConcept = 8, // Greenlight concept
k_EWorkshopFileTypeWebGuide = 9, // Steam web guide
k_EWorkshopFileTypeIntegratedGuide = 10, // application integrated guide
k_EWorkshopFileTypeMerch = 11, // Workshop merchandise meant to be voted on for the purpose of being sold
k_EWorkshopFileTypeControllerBinding = 12, // Steam Controller bindings
k_EWorkshopFileTypeSteamworksAccessInvite = 13, // internal
k_EWorkshopFileTypeSteamVideo = 14, // Steam video
k_EWorkshopFileTypeGameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web
k_EWorkshopFileTypeClip = 16, // internal
// Update k_EWorkshopFileTypeMax if you add values.
k_EWorkshopFileTypeMax = 17
};
enum EWorkshopVote
{
k_EWorkshopVoteUnvoted = 0,
k_EWorkshopVoteFor = 1,
k_EWorkshopVoteAgainst = 2,
k_EWorkshopVoteLater = 3,
};
enum EWorkshopFileAction
{
k_EWorkshopFileActionPlayed = 0,
k_EWorkshopFileActionCompleted = 1,
};
enum EWorkshopEnumerationType
{
k_EWorkshopEnumerationTypeRankedByVote = 0,
k_EWorkshopEnumerationTypeRecent = 1,
k_EWorkshopEnumerationTypeTrending = 2,
k_EWorkshopEnumerationTypeFavoritesOfFriends = 3,
k_EWorkshopEnumerationTypeVotedByFriends = 4,
k_EWorkshopEnumerationTypeContentByFriends = 5,
k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6,
};
enum EWorkshopVideoProvider
{
k_EWorkshopVideoProviderNone = 0,
k_EWorkshopVideoProviderYoutube = 1
};
enum EUGCReadAction
{
// Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks.
// If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading.
// This value maintains the same behavior as before the EUGCReadAction parameter was introduced.
k_EUGCRead_ContinueReadingUntilFinished = 0,
// Keeps the file handle open. Use this when using UGCRead to seek to different parts of the file.
// When you are done seeking around the file, make a final call with k_EUGCRead_Close to close it.
k_EUGCRead_ContinueReading = 1,
// Frees the file handle. Use this when you're done reading the content.
// To read the file from Steam again you will need to call UGCDownload again.
k_EUGCRead_Close = 2,
};
enum ERemoteStorageLocalFileChange
{
k_ERemoteStorageLocalFileChange_Invalid = 0,
// The file was updated from another device
k_ERemoteStorageLocalFileChange_FileUpdated = 1,
// The file was deleted by another device
k_ERemoteStorageLocalFileChange_FileDeleted = 2,
};
enum ERemoteStorageFilePathType
{
k_ERemoteStorageFilePathType_Invalid = 0,
// The file is directly accessed by the game and this is the full path
k_ERemoteStorageFilePathType_Absolute = 1,
// The file is accessed via the ISteamRemoteStorage API and this is the filename
k_ERemoteStorageFilePathType_APIFilename = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing, reading and writing files stored remotely
// and cached locally
//-----------------------------------------------------------------------------
class ISteamRemoteStorage
{
public:
// NOTE
//
// Filenames are case-insensitive, and will be converted to lowercase automatically.
// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
// iterate the files, the filename returned will be "foo.bar".
//
// file operations
virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0;
virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0;
STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0;
STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0;
virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0;
virtual bool FileForget( const char *pchFile ) = 0;
virtual bool FileDelete( const char *pchFile ) = 0;
STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
virtual SteamAPICall_t FileShare( const char *pchFile ) = 0;
virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0;
// file operations that cause network IO
virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0;
virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0;
virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0;
virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0;
// file information
virtual bool FileExists( const char *pchFile ) = 0;
virtual bool FilePersisted( const char *pchFile ) = 0;
virtual int32 GetFileSize( const char *pchFile ) = 0;
virtual int64 GetFileTimestamp( const char *pchFile ) = 0;
virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0;
// iteration
virtual int32 GetFileCount() = 0;
virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0;
// configuration management
virtual bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes ) = 0;
virtual bool IsCloudEnabledForAccount() = 0;
virtual bool IsCloudEnabledForApp() = 0;
virtual void SetCloudEnabledForApp( bool bEnabled ) = 0;
// user generated content
// Downloads a UGC file. A priority value of 0 will download the file immediately,
// otherwise it will wait to download the file until all downloads with a lower priority
// value are completed. Downloads with equal priority will occur simultaneously.
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0;
// Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0;
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0;
// After download, gets the content of the file.
// Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file.
// Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate
// enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail
// unless UGCDownload is called again.
// For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0;
// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
virtual int32 GetCachedUGCCount() = 0;
virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0;
// publishing UGC
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0;
virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0;
virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0;
virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0;
virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0;
virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0;
virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0;
STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0;
// Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0,
// cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh.
// A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is.
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0;
STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
// enumerate the files that the current user published with this app
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0;
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0;
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0;
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t )
virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0;
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0;
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0;
STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0;
STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0;
// this method enumerates the public view of workshop files
STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0;
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
// Cloud dynamic state change notification
virtual int32 GetLocalFileChangeCount() = 0;
virtual const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType ) = 0;
// Indicate to Steam the beginning / end of a set of local file
// operations - for example, writing a game save that requires updating two files.
virtual bool BeginFileWriteBatch() = 0;
virtual bool EndFileWriteBatch() = 0;
};
#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION016"
// Global interface accessor
inline ISteamRemoteStorage *SteamRemoteStorage();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemoteStorage *, SteamRemoteStorage, STEAMREMOTESTORAGE_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: The result of a call to FileShare()
//-----------------------------------------------------------------------------
struct RemoteStorageFileShareResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 7 };
EResult m_eResult; // The result of the operation
UGCHandle_t m_hFile; // The handle that can be shared with users and features
char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared
};
// k_iSteamRemoteStorageCallbacks + 8 is deprecated! Do not reuse
//-----------------------------------------------------------------------------
// Purpose: The result of a call to PublishFile()
//-----------------------------------------------------------------------------
struct RemoteStoragePublishFileResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 9 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
// k_iSteamRemoteStorageCallbacks + 10 is deprecated! Do not reuse
//-----------------------------------------------------------------------------
// Purpose: The result of a call to DeletePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageDeletePublishedFileResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 11 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to EnumerateUserPublishedFiles()
//-----------------------------------------------------------------------------
struct RemoteStorageEnumerateUserPublishedFilesResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 12 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to SubscribePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageSubscribePublishedFileResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 13 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to EnumerateSubscribePublishedFiles()
//-----------------------------------------------------------------------------
struct RemoteStorageEnumerateUserSubscribedFilesResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 14 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
uint32 m_rgRTimeSubscribed[ k_unEnumeratePublishedFilesMaxResults ];
};
#if defined(VALVE_CALLBACK_PACK_SMALL)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 );
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 );
#else
#warning You must first include steam_api_common.h
#endif
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UnsubscribePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageUnsubscribePublishedFileResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 15 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to CommitPublishedFileUpdate()
//-----------------------------------------------------------------------------
struct RemoteStorageUpdatePublishedFileResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 16 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UGCDownload()
//-----------------------------------------------------------------------------
struct RemoteStorageDownloadUGCResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 17 };
EResult m_eResult; // The result of the operation.
UGCHandle_t m_hFile; // The handle to the file that was attempted to be downloaded.
AppId_t m_nAppID; // ID of the app that created this file.
int32 m_nSizeInBytes; // The size of the file that was downloaded, in bytes.
char m_pchFileName[k_cchFilenameMax]; // The name of the file that was downloaded.
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetPublishedFileDetails()
//-----------------------------------------------------------------------------
struct RemoteStorageGetPublishedFileDetailsResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 18 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
AppId_t m_nCreatorAppID; // ID of the app that created this file.
AppId_t m_nConsumerAppID; // ID of the app that will consume this file.
char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document
char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document
UGCHandle_t m_hFile; // The handle of the primary file
UGCHandle_t m_hPreviewFile; // The handle of the preview file
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
uint32 m_rtimeCreated; // time when the published file was created
uint32 m_rtimeUpdated; // time when the published file was last updated
ERemoteStoragePublishedFileVisibility m_eVisibility;
bool m_bBanned;
char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file
bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer
char m_pchFileName[k_cchFilenameMax]; // The name of the primary file
int32 m_nFileSize; // Size of the primary file
int32 m_nPreviewFileSize; // Size of the preview file
char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website)
EWorkshopFileType m_eFileType; // Type of the file
bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
};
struct RemoteStorageEnumerateWorkshopFilesResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 19 };
EResult m_eResult;
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ];
AppId_t m_nAppId;
uint32 m_unStartIndex;
};
//-----------------------------------------------------------------------------
// Purpose: The result of GetPublishedItemVoteDetails
//-----------------------------------------------------------------------------
struct RemoteStorageGetPublishedItemVoteDetailsResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 20 };
EResult m_eResult;
PublishedFileId_t m_unPublishedFileId;
int32 m_nVotesFor;
int32 m_nVotesAgainst;
int32 m_nReports;
float m_fScore;
};
//-----------------------------------------------------------------------------
// Purpose: User subscribed to a file for the app (from within the app or on the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileSubscribed_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 21 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: User unsubscribed from a file for the app (from within the app or on the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileUnsubscribed_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 22 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: Published file that a user owns was deleted (from within the app or the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileDeleted_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 23 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UpdateUserPublishedItemVote()
//-----------------------------------------------------------------------------
struct RemoteStorageUpdateUserPublishedItemVoteResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 24 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetUserPublishedItemVoteDetails()
//-----------------------------------------------------------------------------
struct RemoteStorageUserVoteDetails_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 25 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
EWorkshopVote m_eVote; // what the user voted
};
struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 26 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
};
struct RemoteStorageSetUserPublishedFileActionResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 27 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
EWorkshopFileAction m_eAction; // the action that was attempted
};
struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 28 };
EResult m_eResult; // The result of the operation.
EWorkshopFileAction m_eAction; // the action that was filtered on
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
uint32 m_rgRTimeUpdated[ k_unEnumeratePublishedFilesMaxResults ];
};
//-----------------------------------------------------------------------------
// Purpose: Called periodically while a PublishWorkshopFile is in progress
//-----------------------------------------------------------------------------
struct RemoteStoragePublishFileProgress_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 29 };
double m_dPercentFile;
bool m_bPreview;
};
//-----------------------------------------------------------------------------
// Purpose: Called when the content for a published file is updated
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileUpdated_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 30 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
uint64 m_ulUnused; // not used anymore
};
//-----------------------------------------------------------------------------
// Purpose: Called when a FileWriteAsync completes
//-----------------------------------------------------------------------------
struct RemoteStorageFileWriteAsyncComplete_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 31 };
EResult m_eResult; // result
};
//-----------------------------------------------------------------------------
// Purpose: Called when a FileReadAsync completes
//-----------------------------------------------------------------------------
struct RemoteStorageFileReadAsyncComplete_t
{
enum { k_iCallback = k_iSteamRemoteStorageCallbacks + 32 };
SteamAPICall_t m_hFileReadAsync; // call handle of the async read which was made
EResult m_eResult; // result
uint32 m_nOffset; // offset in the file this read was at
uint32 m_cubRead; // amount read - will the <= the amount requested
};
//-----------------------------------------------------------------------------
// Purpose: one or more files for this app have changed locally after syncing
// to remote session changes
// Note: only posted if this happens DURING the local app session
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( RemoteStorageLocalFileChange_t, k_iSteamRemoteStorageCallbacks + 33 )
STEAM_CALLBACK_END( 0 )
#pragma pack( pop )
#endif // ISTEAMREMOTESTORAGE_H

View File

@ -0,0 +1,120 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: public interface to user remote file storage in Steam
//
//=============================================================================
#ifndef ISTEAMSCREENSHOTS_H
#define ISTEAMSCREENSHOTS_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
const uint32 k_nScreenshotMaxTaggedUsers = 32;
const uint32 k_nScreenshotMaxTaggedPublishedFiles = 32;
const int k_cubUFSTagTypeMax = 255;
const int k_cubUFSTagValueMax = 255;
// Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail
// one will be generated.
const int k_ScreenshotThumbWidth = 200;
// Handle is valid for the lifetime of your process and no longer
typedef uint32 ScreenshotHandle;
#define INVALID_SCREENSHOT_HANDLE 0
enum EVRScreenshotType
{
k_EVRScreenshotType_None = 0,
k_EVRScreenshotType_Mono = 1,
k_EVRScreenshotType_Stereo = 2,
k_EVRScreenshotType_MonoCubemap = 3,
k_EVRScreenshotType_MonoPanorama = 4,
k_EVRScreenshotType_StereoPanorama = 5
};
//-----------------------------------------------------------------------------
// Purpose: Functions for adding screenshots to the user's screenshot library
//-----------------------------------------------------------------------------
class ISteamScreenshots
{
public:
// Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0;
// Adds a screenshot to the user's screenshot library from disk. If a thumbnail is provided, it must be 200 pixels wide and the same aspect ratio
// as the screenshot, otherwise a thumbnail will be generated if the user uploads the screenshot. The screenshots must be in either JPEG or TGA format.
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
// JPEG, TGA, and PNG formats are supported.
virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0;
// Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead.
virtual void TriggerScreenshot() = 0;
// Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots,
// then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary
// in response.
virtual void HookScreenshots( bool bHook ) = 0;
// Sets metadata about a screenshot's location (for example, the name of the map)
virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0;
// Tags a user as being visible in the screenshot
virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0;
// Tags a published file as being visible in the screenshot
virtual bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) = 0;
// Returns true if the app has hooked the screenshot
virtual bool IsScreenshotsHooked() = 0;
// Adds a VR screenshot to the user's screenshot library from disk in the supported type.
// pchFilename should be the normal 2D image used in the library view
// pchVRFilename should contain the image that matches the correct type
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
// JPEG, TGA, and PNG formats are supported.
virtual ScreenshotHandle AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename ) = 0;
};
#define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamScreenshots *SteamScreenshots();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamScreenshots *, SteamScreenshots, STEAMSCREENSHOTS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: Screenshot successfully written or otherwise added to the library
// and can now be tagged
//-----------------------------------------------------------------------------
struct ScreenshotReady_t
{
enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 };
ScreenshotHandle m_hLocal;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Screenshot has been requested by the user. Only sent if
// HookScreenshots() has been called, in which case Steam will not take
// the screenshot itself.
//-----------------------------------------------------------------------------
struct ScreenshotRequested_t
{
enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 };
};
#pragma pack( pop )
#endif // ISTEAMSCREENSHOTS_H

View File

@ -0,0 +1,261 @@
//====== Copyright <20> Valve Corporation, All rights reserved. =======
//
// Purpose: interface to Steam Timeline
//
//=============================================================================
#ifndef ISTEAMTIMELINE_H
#define ISTEAMTIMELINE_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// Controls the color of the timeline bar segments. The value names listed here map to a multiplayer game, where
// the user starts a game (in menus), then joins a multiplayer session that first has a character selection lobby
// then finally the multiplayer session starts. However, you can also map these values to any type of game. In a single
// player game where you visit towns & dungeons, you could set k_ETimelineGameMode_Menus when the player is in a town
// buying items, k_ETimelineGameMode_Staging for when a dungeon is loading and k_ETimelineGameMode_Playing for when
// inside the dungeon fighting monsters.
enum ETimelineGameMode
{
k_ETimelineGameMode_Invalid = 0,
k_ETimelineGameMode_Playing = 1,
k_ETimelineGameMode_Staging = 2,
k_ETimelineGameMode_Menus = 3,
k_ETimelineGameMode_LoadingScreen = 4,
k_ETimelineGameMode_Max, // one past the last valid value
};
// Used in AddTimelineEvent, where Featured events will be offered before Standard events
enum ETimelineEventClipPriority
{
k_ETimelineEventClipPriority_Invalid = 0,
k_ETimelineEventClipPriority_None = 1,
k_ETimelineEventClipPriority_Standard = 2,
k_ETimelineEventClipPriority_Featured = 3,
};
const uint32 k_unMaxTimelinePriority = 1000;
const uint32 k_unTimelinePriority_KeepCurrentValue = 1000000; // Use with UpdateRangeTimelineEvent to not change the priority
const float k_flMaxTimelineEventDuration = 600.f;
const uint32 k_cchMaxPhaseIDLength = 64;
typedef uint64 TimelineEventHandle_t;
//-----------------------------------------------------------------------------
// Purpose: Steam Timeline API
//-----------------------------------------------------------------------------
class ISteamTimeline
{
public:
// Sets a description for the current game state in the timeline. These help the user to find specific
// moments in the timeline when saving clips. Setting a new state description replaces any previous
// description.
//
// Examples could include:
// * Where the user is in the world in a single player game
// * Which round is happening in a multiplayer game
// * The current score for a sports game
//
// Parameters:
// - pchDescription: provide a localized string in the language returned by SteamUtils()->GetSteamUILanguage()
// - flTimeDelta: The time offset in seconds to apply to this event. Negative times indicate an
// event that happened in the past.
virtual void SetTimelineTooltip( const char *pchDescription, float flTimeDelta ) = 0;
virtual void ClearTimelineTooltip( float flTimeDelta ) = 0;
// Changes the color of the timeline bar. See ETimelineGameMode comments for how to use each value
virtual void SetTimelineGameMode( ETimelineGameMode eMode ) = 0;
/******************* Timeline Events *******************/
// The following functions add events and/or tags to the timeline. There are helpers to add simple events or tags in a single call.
// or you can use StartEvent and CloseEvent to customize what gets added.
//
// Examples of events to add could include:
// * a boss battle
// * a cut scene
// * a large team fight
// * picking up a new weapon or ammunition
// * scoring a goal
//
// Adding an event and a time range with the simple API:
// SteamTimeline()->AddSimpleTimelineEvent( "steam_heart", Localize( "#user healed" ), Localize( "#health_amount", 27 ), 15, 0, 0, k_ETimelineEventClipPriority_None );
// SteamTimeline()->AddTaggedTimeRange( Localize( "#player_resting" ), "steam_flag", /* don't show filter */nullptr, 15, /* start now */0, 10 );
// SteamTimeline()->AddTaggedTimeRange( Localize( "#player_cast_light" ), "steam_starburst", Localize( "#player_spells" ), 10, /* start 10 sec ago */ -10, 5 );
//
// Adding a marker and time range in one event:
// TimelineEventHandle_t event = SteamTimeline()->StartEvent( /* start now */ 0 );
// SteamTimeline()->ShowEventOnTimeline( event, "steam_heart", Localize( "#player_healed" ), Localize( "#player_healed_amount", 27 ), 15 );
// SteamTimeline()->AddEventTag( event, Localize( "#player_cast_heal" ), "steam_heart", Localize( "#player_, 15, /* start now */0, 10 );
// ... // time passes
// SteamTimeline()->CloseEvent( event );
//
// Parameters used by the event functions:
//
// - ulOpenEvent: An event returned by StartEvent that has not yet had CancelEvent or CloseEvent called on it
// - ulEvent: An event that has had CloseEvent called on it, or an event returned from AddSimpleTimelineEvent or AddTaggedTimeRange (which
// are closed automatically.)
// - pchIcon: specify the name of the icon uploaded through the Steamworks Partner Site for your title
// or one of the provided icons that start with steam_
// - pchTitle & pchDescription: provide a localized string in the language returned by
// SteamUtils()->GetSteamUILanguage()
// - unIconPriority: specify how important this range is compared to other markers provided by the game.
// Ranges with larger priority values will be displayed more prominently in the UI. This value
// may be between 0 and k_unMaxTimelinePriority.
// - flStartOffsetSeconds: The time that this range started relative to now. Negative times
// indicate an event that happened in the past.
// - flDurationSeconds: How long the time range should be in seconds. For instantaneous events, this
// should be 0
// - ePossibleClip: By setting this parameter to Featured or Standard, the game indicates to Steam that it
// would be appropriate to offer this range as a clip to the user. For instantaneous events, the
// suggested clip will be for a short time before and after the event itself.
// - pchTagIcon: specify an icon name that will be used next to the tag name in the UI
// - pchTagName: The localized name of the tag to show in the UI.
// - pchTagGroup: The localized name of the tag group to show in the UI. If this is not specified, users will not be able to filter by this tag
// - unTagPriority: specify how important this tag is compared to other tags provided by the game.
// Returns:
// A TimelineEventHandle_t that can be used to make subsequent calls to refer to the timeline event. This event handle is invalid
// after the game exits.
// quick helpers that add to the timeline in one call
virtual TimelineEventHandle_t AddInstantaneousTimelineEvent( const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unIconPriority, float flStartOffsetSeconds = 0.f, ETimelineEventClipPriority ePossibleClip = k_ETimelineEventClipPriority_None ) = 0;
virtual TimelineEventHandle_t AddRangeTimelineEvent( const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unIconPriority, float flStartOffsetSeconds = 0.f, float flDuration = 0.f, ETimelineEventClipPriority ePossibleClip = k_ETimelineEventClipPriority_None ) = 0;
// Starts a timeline event at a the current time, plus an offset in seconds. This event must be ended with EndRangeTimelineEvent.
// Any timeline events that have not been ended when the game exits will be discarded.
virtual TimelineEventHandle_t StartRangeTimelineEvent( const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unPriority, float flStartOffsetSeconds, ETimelineEventClipPriority ePossibleClip ) = 0;
// Updates fields on a range timeline event that was started with StartRangeTimelineEvent, and which has not been ended.
virtual void UpdateRangeTimelineEvent( TimelineEventHandle_t ulEvent, const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unPriority, ETimelineEventClipPriority ePossibleClip ) = 0;
// Ends a range timeline event and shows it in the UI.
virtual void EndRangeTimelineEvent( TimelineEventHandle_t ulEvent, float flEndOffsetSeconds ) = 0;
// delete the event from the timeline. This can be called on a timeline event from AddInstantaneousTimelineEvent,
// AddRangeTimelineEvent, or StartRangeTimelineEvent/EndRangeTimelineEvent. The timeline event handle must be from the
// current game process.
virtual void RemoveTimelineEvent( TimelineEventHandle_t ulEvent ) = 0;
// add a tag to whatever time range is represented by the event
STEAM_CALL_RESULT( SteamTimelineEventRecordingExists_t )
virtual SteamAPICall_t DoesEventRecordingExist( TimelineEventHandle_t ulEvent ) = 0;
/******************* Game Phases *******************/
// Game phases allow the user to navigate their background recordings and clips. Exactly what a game phase means will vary game to game, but
// the game phase should be a section of gameplay that is usually between 10 minutes and a few hours in length, and should be the
// main way a user would think to divide up the game. These are presented to the user in a UI that shows the date the game was played,
// with one row per game slice. Game phases should be used to mark sections of gameplay that the user might be interested in watching.
//
// Examples could include:
// * A single match in a multiplayer PvP game
// * A chapter of a story-based singleplayer game
// * A single run in a roguelike
//
// Game phases are started with StartGamePhase, and while a phase is still happening, they can have tags and attributes added to them.
//
// Phase attributes represent generic text fields that can be updated throughout the duration of the phase. They are meant
// to be used for phase metadata that is not part of a well defined set of options. For example, a KDA attribute that starts
// with the value "0/0/0" and updates as the phase progresses, or something like a played-entered character name. Attributes
// can be set as many times as the game likes with SetGamePhaseAttribute, and only the last value will be shown to the user.
//
// Phase tags represent data with a well defined set of options, which could be data such as match resolution, hero played,
// game mode, etc. Tags can have an icon in addition to a text name. Multiple tags within the same group may be added per phase
// and all will be remembered. For example, AddGamePhaseTag may be called multiple times for a "Bosses Defeated" group, with
// different names and icons for each boss defeated during the phase, all of which will be shown to the user.
//
// The phase will continue until the game exits, until the game calls EndGamePhase, or until the game calls
// StartGamePhase to start a new phase.
//
// The game phase functions take these parameters:
// - pchTagIcon: The name of a game provided timeline icon or builtin "steam_" icon.
// - pchPhaseID: A game-provided persistent ID for a game phase. This could be a the match ID in a multiplayer game, a chapter name in a
// single player game, the ID of a character, etc.
// - pchTagName: The localized name of the tag in the language returned by SteamUtils()->GetSteamUILanguage().
// - pchTagGroup: The localized name of the tag group.
// - pchAttributeValue: The localized name of the attribute.
// - pchAttributeGroup: The localized name of the attribute group.
// - unPriority: Used to order tags and attributes in the UI displayed to the user, with higher priority values leading
// to more prominent positioning. In contexts where there is limited space, lower priority items may be hidden.
virtual void StartGamePhase() = 0;
virtual void EndGamePhase() = 0;
// Games can set a phase ID so they can refer back to a phase in OpenOverlayToPhase
virtual void SetGamePhaseID( const char *pchPhaseID ) = 0;
STEAM_CALL_RESULT( SteamTimelineGamePhaseRecordingExists_t )
virtual SteamAPICall_t DoesGamePhaseRecordingExist( const char *pchPhaseID ) = 0;
// Add a tag that applies to the entire phase
virtual void AddGamePhaseTag( const char *pchTagName, const char *pchTagIcon, const char *pchTagGroup, uint32 unPriority ) = 0;
// Add a text attribute that applies to the entire phase
virtual void SetGamePhaseAttribute( const char *pchAttributeGroup, const char *pchAttributeValue, uint32 unPriority ) = 0;
/******************* Opening the overlay *******************/
// Opens the Steam overlay to a game phase.
//
// Parameters:
// - pchPhaseID: The ID of a phase that was previously provided by the game in SetGamePhaseID.
virtual void OpenOverlayToGamePhase( const char *pchPhaseID ) = 0;
// Opens the Steam overlay to a timeline event.
//
// Parameters:
// - ulEventID: The ID of a timeline event returned by StartEvent or AddSimpleTimelineEvent
virtual void OpenOverlayToTimelineEvent( const TimelineEventHandle_t ulEvent ) = 0;
};
#define STEAMTIMELINE_INTERFACE_VERSION "STEAMTIMELINE_INTERFACE_V004"
// Global interface accessor
inline ISteamTimeline *SteamTimeline();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamTimeline *, SteamTimeline, STEAMTIMELINE_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamTimelineGamePhaseRecordingExists_t
{
enum { k_iCallback = k_iSteamTimelineCallbacks + 1 };
char m_rgchPhaseID[ k_cchMaxPhaseIDLength ];
uint64 m_ulRecordingMS;
uint64 m_ulLongestClipMS;
uint32 m_unClipCount;
uint32 m_unScreenshotCount;
};
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamTimelineEventRecordingExists_t
{
enum { k_iCallback = k_iSteamTimelineCallbacks + 2 };
uint64 m_ulEventID;
bool m_bRecordingExists;
};
#pragma pack( pop )
#endif // ISTEAMTIMELINE_H

View File

@ -0,0 +1,638 @@
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to steam ugc
//
//=============================================================================
#ifndef ISTEAMUGC_H
#define ISTEAMUGC_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
#include "isteamremotestorage.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
typedef uint64 UGCQueryHandle_t;
typedef uint64 UGCUpdateHandle_t;
const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull;
const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull;
// Matching UGC types for queries
enum EUGCMatchingUGCType
{
k_EUGCMatchingUGCType_Items = 0, // both mtx items and ready-to-use items
k_EUGCMatchingUGCType_Items_Mtx = 1,
k_EUGCMatchingUGCType_Items_ReadyToUse = 2,
k_EUGCMatchingUGCType_Collections = 3,
k_EUGCMatchingUGCType_Artwork = 4,
k_EUGCMatchingUGCType_Videos = 5,
k_EUGCMatchingUGCType_Screenshots = 6,
k_EUGCMatchingUGCType_AllGuides = 7, // both web guides and integrated guides
k_EUGCMatchingUGCType_WebGuides = 8,
k_EUGCMatchingUGCType_IntegratedGuides = 9,
k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides
k_EUGCMatchingUGCType_ControllerBindings = 11,
k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users)
k_EUGCMatchingUGCType_All = ~0, // @note: will only be valid for CreateQueryUserUGCRequest requests
};
// Different lists of published UGC for a user.
// If the current logged in user is different than the specified user, then some options may not be allowed.
enum EUserUGCList
{
k_EUserUGCList_Published,
k_EUserUGCList_VotedOn,
k_EUserUGCList_VotedUp,
k_EUserUGCList_VotedDown,
k_EUserUGCList_WillVoteLater,
k_EUserUGCList_Favorited,
k_EUserUGCList_Subscribed,
k_EUserUGCList_UsedOrPlayed,
k_EUserUGCList_Followed,
};
// Sort order for user published UGC lists (defaults to creation order descending)
enum EUserUGCListSortOrder
{
k_EUserUGCListSortOrder_CreationOrderDesc,
k_EUserUGCListSortOrder_CreationOrderAsc,
k_EUserUGCListSortOrder_TitleAsc,
k_EUserUGCListSortOrder_LastUpdatedDesc,
k_EUserUGCListSortOrder_SubscriptionDateDesc,
k_EUserUGCListSortOrder_VoteScoreDesc,
k_EUserUGCListSortOrder_ForModeration,
};
// Combination of sorting and filtering for queries across all UGC
enum EUGCQuery
{
k_EUGCQuery_RankedByVote = 0,
k_EUGCQuery_RankedByPublicationDate = 1,
k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2,
k_EUGCQuery_RankedByTrend = 3,
k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate = 4,
k_EUGCQuery_CreatedByFriendsRankedByPublicationDate = 5,
k_EUGCQuery_RankedByNumTimesReported = 6,
k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate = 7,
k_EUGCQuery_NotYetRated = 8,
k_EUGCQuery_RankedByTotalVotesAsc = 9,
k_EUGCQuery_RankedByVotesUp = 10,
k_EUGCQuery_RankedByTextSearch = 11,
k_EUGCQuery_RankedByTotalUniqueSubscriptions = 12,
k_EUGCQuery_RankedByPlaytimeTrend = 13,
k_EUGCQuery_RankedByTotalPlaytime = 14,
k_EUGCQuery_RankedByAveragePlaytimeTrend = 15,
k_EUGCQuery_RankedByLifetimeAveragePlaytime = 16,
k_EUGCQuery_RankedByPlaytimeSessionsTrend = 17,
k_EUGCQuery_RankedByLifetimePlaytimeSessions = 18,
k_EUGCQuery_RankedByLastUpdatedDate = 19,
};
enum EItemUpdateStatus
{
k_EItemUpdateStatusInvalid = 0, // The item update handle was invalid, job might be finished, listen too SubmitItemUpdateResult_t
k_EItemUpdateStatusPreparingConfig = 1, // The item update is processing configuration data
k_EItemUpdateStatusPreparingContent = 2, // The item update is reading and processing content files
k_EItemUpdateStatusUploadingContent = 3, // The item update is uploading content changes to Steam
k_EItemUpdateStatusUploadingPreviewFile = 4, // The item update is uploading new preview file image
k_EItemUpdateStatusCommittingChanges = 5 // The item update is committing all changes
};
enum EItemState
{
k_EItemStateNone = 0, // item not tracked on client
k_EItemStateSubscribed = 1, // current user is subscribed to this item. Not just cached.
k_EItemStateLegacyItem = 2, // item was created with ISteamRemoteStorage
k_EItemStateInstalled = 4, // item is installed and usable (but maybe out of date)
k_EItemStateNeedsUpdate = 8, // items needs an update. Either because it's not installed yet or creator updated content
k_EItemStateDownloading = 16, // item update is currently downloading
k_EItemStateDownloadPending = 32, // DownloadItem() was called for this item, content isn't available until DownloadItemResult_t is fired
k_EItemStateDisabledLocally = 64, // Item is disabled locally, so it shouldn't be considered subscribed
};
enum EItemStatistic
{
k_EItemStatistic_NumSubscriptions = 0,
k_EItemStatistic_NumFavorites = 1,
k_EItemStatistic_NumFollowers = 2,
k_EItemStatistic_NumUniqueSubscriptions = 3,
k_EItemStatistic_NumUniqueFavorites = 4,
k_EItemStatistic_NumUniqueFollowers = 5,
k_EItemStatistic_NumUniqueWebsiteViews = 6,
k_EItemStatistic_ReportScore = 7,
k_EItemStatistic_NumSecondsPlayed = 8,
k_EItemStatistic_NumPlaytimeSessions = 9,
k_EItemStatistic_NumComments = 10,
k_EItemStatistic_NumSecondsPlayedDuringTimePeriod = 11,
k_EItemStatistic_NumPlaytimeSessionsDuringTimePeriod = 12,
};
enum EItemPreviewType
{
k_EItemPreviewType_Image = 0, // standard image file expected (e.g. jpg, png, gif, etc.)
k_EItemPreviewType_YouTubeVideo = 1, // video id is stored
k_EItemPreviewType_Sketchfab = 2, // model id is stored
k_EItemPreviewType_EnvironmentMap_HorizontalCross = 3, // standard image file expected - cube map in the layout
// +---+---+-------+
// | |Up | |
// +---+---+---+---+
// | L | F | R | B |
// +---+---+---+---+
// | |Dn | |
// +---+---+---+---+
k_EItemPreviewType_EnvironmentMap_LatLong = 4, // standard image file expected
k_EItemPreviewType_Clip = 5, // clip id is stored
k_EItemPreviewType_ReservedMax = 255, // you can specify your own types above this value
};
enum EUGCContentDescriptorID
{
k_EUGCContentDescriptor_NudityOrSexualContent = 1,
k_EUGCContentDescriptor_FrequentViolenceOrGore = 2,
k_EUGCContentDescriptor_AdultOnlySexualContent = 3,
k_EUGCContentDescriptor_GratuitousSexualContent = 4,
k_EUGCContentDescriptor_AnyMatureContent = 5,
};
const uint32 kNumUGCResultsPerPage = 50;
const uint32 k_cchDeveloperMetadataMax = 5000;
// Details for a single published file/UGC
struct SteamUGCDetails_t
{
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult; // The result of the operation.
EWorkshopFileType m_eFileType; // Type of the file
AppId_t m_nCreatorAppID; // ID of the app that created this file.
AppId_t m_nConsumerAppID; // ID of the app that will consume this file.
char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document
char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
uint32 m_rtimeCreated; // time when the published file was created
uint32 m_rtimeUpdated; // time when the published file was last updated
uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable)
ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility
bool m_bBanned; // whether the file was banned
bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer
char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file
// file/url information
UGCHandle_t m_hFile; // The handle of the primary file
UGCHandle_t m_hPreviewFile; // The handle of the preview file
char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file
int32 m_nFileSize; // Size of the primary file (for legacy items which only support one file). This may not be accurate for non-legacy items which can be greater than 4gb in size.
int32 m_nPreviewFileSize; // Size of the preview file
char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website)
// voting information
uint32 m_unVotesUp; // number of votes up
uint32 m_unVotesDown; // number of votes down
float m_flScore; // calculated score
// collection details
uint32 m_unNumChildren;
uint64 m_ulTotalFilesSize; // Total size of all files (non-legacy), excluding the preview file
};
//-----------------------------------------------------------------------------
// Purpose: Steam UGC support API
//-----------------------------------------------------------------------------
class ISteamUGC
{
public:
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
STEAM_FLAT_NAME( CreateQueryAllUGCRequestPage )
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
STEAM_FLAT_NAME( CreateQueryAllUGCRequestCursor )
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL ) = 0;
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
// Send the query to Steam
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Retrieve an individual result after receiving the callback for querying UGC
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
virtual uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0;
virtual bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0;
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue ) = 0;
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchOriginalFileNameSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
// Return the first value matching the pchKey. Note that a key may map to multiple values. Returns false if there was an error or no matching value was found.
STEAM_FLAT_NAME( GetQueryFirstUGCKeyValueTag )
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
// Some items can specify that they have a version that is valid for a range of game versions (Steam branch)
virtual uint32 GetNumSupportedGameVersions( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetSupportedGameVersionData( UGCQueryHandle_t handle, uint32 index, uint32 versionIndex, STEAM_OUT_STRING_COUNT( cchGameBranchSize ) char *pchGameBranchMin, STEAM_OUT_STRING_COUNT( cchGameBranchSize ) char *pchGameBranchMax, uint32 cchGameBranchSize ) = 0;
virtual uint32 GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries ) = 0;
// Release the request to free up memory, after retrieving results
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Options to set for querying UGC
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t *pTagGroups ) = 0; // match any of the tags in this group
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0;
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
virtual bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0;
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
virtual bool SetAdminQuery( UGCUpdateHandle_t handle, bool bAdminQuery ) = 0; // admin queries return hidden items
// Options only for querying user UGC
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
// Options only for querying all UGC
virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0;
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool SetTimeCreatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd ) = 0;
virtual bool SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd ) = 0;
virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0;
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t )
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
// Steam Workshop Creator API
STEAM_CALL_RESULT( CreateItemResult_t )
virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet
virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags, bool bAllowAdminTags = false ) = 0; // change the tags of an UGC item
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
virtual bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) = 0; // use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.
virtual bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle ) = 0; // remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)
virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag.
virtual bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) = 0; // add preview video for this item
virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
virtual bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) = 0;
virtual bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) = 0;
virtual bool SetRequiredGameVersions( UGCUpdateHandle_t handle, const char *pszGameBranchMin, const char *pszGameBranchMax ) = 0; // an empty string for either parameter means that it will match any version on that end of the range. This will only be applied if the actual content has been changed.
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
// Steam Workshop Consumer API
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
virtual uint32 GetNumSubscribedItems( bool bIncludeLocallyDisabled = false ) = 0; // number of subscribed items
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries, bool bIncludeLocallyDisabled = false ) = 0; // all subscribed item PublishFileIDs
// get EItemState flags about item on this client
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
// game servers can set a specific workshop folder before issuing any UGC commands.
// This is helpful if you want to support multiple game servers running out of the same install folder
virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0;
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
virtual void SuspendDownloads( bool bSuspend ) = 0;
// usage tracking
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
virtual SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTrackingForAllItems() = 0;
// parent-child relationship or dependency management
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
virtual SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
virtual SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
// add/remove app dependence/requirements (usually DLC)
STEAM_CALL_RESULT( AddAppDependencyResult_t )
virtual SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
virtual SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
// request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times
// until all app dependencies have been returned
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
virtual SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) = 0;
// delete the item without prompting the user
STEAM_CALL_RESULT( DeleteItemResult_t )
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
// Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not
virtual bool ShowWorkshopEULA() = 0;
// Retrieve information related to the user's acceptance or not of the app's specific Workshop EULA
STEAM_CALL_RESULT( WorkshopEULAStatus_t )
virtual SteamAPICall_t GetWorkshopEULAStatus() = 0;
// Return the user's community content descriptor preferences
virtual uint32 GetUserContentDescriptorPreferences( EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries ) = 0;
// Sets whether the item should be disabled locally or not. This means that it will not be returned in GetSubscribedItems() by default.
virtual bool SetItemsDisabledLocally( PublishedFileId_t *pvecPublishedFileIDs, uint32 unNumPublishedFileIDs, bool bDisabledLocally ) = 0;
// Set the local load order for these items. If there are any items not in the given list, they will sort by the time subscribed.
virtual bool SetSubscriptionsLoadOrder( PublishedFileId_t *pvecPublishedFileIDs, uint32 unNumPublishedFileIDs ) = 0;
};
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION021"
// Global interface accessor
inline ISteamUGC *SteamUGC();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUGC *, SteamUGC, STEAMUGC_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamUGC *SteamGameServerUGC();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamUGC *, SteamGameServerUGC, STEAMUGC_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamUGCQueryCompleted_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 1 };
UGCQueryHandle_t m_handle;
EResult m_eResult;
uint32 m_unNumResultsReturned;
uint32 m_unTotalMatchingResults;
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
char m_rgchNextCursor[k_cchPublishedFileURLMax]; // If a paging cursor was used, then this will be the next cursor to get the next result set.
};
//-----------------------------------------------------------------------------
// Purpose: Callback for requesting details on one piece of UGC
//-----------------------------------------------------------------------------
struct SteamUGCRequestUGCDetailsResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 2 };
SteamUGCDetails_t m_details;
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
};
//-----------------------------------------------------------------------------
// Purpose: result for ISteamUGC::CreateItem()
//-----------------------------------------------------------------------------
struct CreateItemResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 3 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId; // new item got this UGC PublishFileID
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: result for ISteamUGC::SubmitItemUpdate()
//-----------------------------------------------------------------------------
struct SubmitItemUpdateResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 4 };
EResult m_eResult;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: a Workshop item has been installed or updated
//-----------------------------------------------------------------------------
struct ItemInstalled_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 5 };
AppId_t m_unAppID;
PublishedFileId_t m_nPublishedFileId;
UGCHandle_t m_hLegacyContent;
uint64 m_unManifestID;
};
//-----------------------------------------------------------------------------
// Purpose: result of DownloadItem(), existing item files can be accessed again
//-----------------------------------------------------------------------------
struct DownloadItemResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 6 };
AppId_t m_unAppID;
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: result of AddItemToFavorites() or RemoveItemFromFavorites()
//-----------------------------------------------------------------------------
struct UserFavoriteItemsListChanged_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 7 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
bool m_bWasAddRequest;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to SetUserItemVote()
//-----------------------------------------------------------------------------
struct SetUserItemVoteResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 8 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
bool m_bVoteUp;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetUserItemVote()
//-----------------------------------------------------------------------------
struct GetUserItemVoteResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 9 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
bool m_bVotedUp;
bool m_bVotedDown;
bool m_bVoteSkipped;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to StartPlaytimeTracking()
//-----------------------------------------------------------------------------
struct StartPlaytimeTrackingResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 10 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to StopPlaytimeTracking()
//-----------------------------------------------------------------------------
struct StopPlaytimeTrackingResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 11 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to AddDependency
//-----------------------------------------------------------------------------
struct AddUGCDependencyResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 12 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
PublishedFileId_t m_nChildPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to RemoveDependency
//-----------------------------------------------------------------------------
struct RemoveUGCDependencyResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 13 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
PublishedFileId_t m_nChildPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to AddAppDependency
//-----------------------------------------------------------------------------
struct AddAppDependencyResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 14 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
AppId_t m_nAppID;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to RemoveAppDependency
//-----------------------------------------------------------------------------
struct RemoveAppDependencyResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 15 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
AppId_t m_nAppID;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetAppDependencies. Callback may be called
// multiple times until all app dependencies have been returned.
//-----------------------------------------------------------------------------
struct GetAppDependenciesResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 16 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
AppId_t m_rgAppIDs[32];
uint32 m_nNumAppDependencies; // number returned in this struct
uint32 m_nTotalNumAppDependencies; // total found
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to DeleteItem
//-----------------------------------------------------------------------------
struct DeleteItemResult_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 17 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: signal that the list of subscribed items changed
//-----------------------------------------------------------------------------
struct UserSubscribedItemsListChanged_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 18 };
AppId_t m_nAppID;
};
//-----------------------------------------------------------------------------
// Purpose: Status of the user's acceptable/rejection of the app's specific Workshop EULA
//-----------------------------------------------------------------------------
struct WorkshopEULAStatus_t
{
enum { k_iCallback = k_iSteamUGCCallbacks + 20 };
EResult m_eResult;
AppId_t m_nAppID;
uint32 m_unVersion;
RTime32 m_rtAction;
bool m_bAccepted;
bool m_bNeedsAction;
};
#pragma pack( pop )
#endif // ISTEAMUGC_H

View File

@ -0,0 +1,439 @@
//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to user account information in Steam
//
//=============================================================================
#ifndef ISTEAMUSER_H
#define ISTEAMUSER_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing and manipulating a steam account
// associated with one client instance
//-----------------------------------------------------------------------------
class ISteamUser
{
public:
// returns the HSteamUser this interface represents
// this is only used internally by the API, and by a few select interfaces that support multi-user
virtual HSteamUser GetHSteamUser() = 0;
// returns true if the Steam client current has a live connection to the Steam servers.
// If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.
// The Steam client will automatically be trying to recreate the connection as often as possible.
virtual bool BLoggedOn() = 0;
// returns the CSteamID of the account currently logged into the Steam client
// a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API
virtual CSteamID GetSteamID() = 0;
// Multiplayer Authentication functions
// InitiateGameConnection() starts the state machine for authenticating the game client with the game server
// It is the client portion of a three-way handshake between the client, the game server, and the steam servers
//
// Parameters:
// void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token.
// int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( <appID> )
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
// bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running)
//
// return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed
// The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.
//
// DEPRECATED! This function will be removed from the SDK in an upcoming version.
// Please migrate to BeginAuthSession and related functions.
virtual int InitiateGameConnection_DEPRECATED( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0;
// notify of disconnect
// needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
//
// DEPRECATED! This function will be removed from the SDK in an upcoming version.
// Please migrate to BeginAuthSession and related functions.
virtual void TerminateGameConnection_DEPRECATED( uint32 unIPServer, uint16 usPortServer ) = 0;
// Legacy functions
// used by only a few games to track usage events
virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0;
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0;
// Starts voice recording. Once started, use GetVoice() to get the data
virtual void StartVoiceRecording( ) = 0;
// Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
// a little bit after this function is called. GetVoice() should continue to be called until it returns
// k_eVoiceResultNotRecording
virtual void StopVoiceRecording( ) = 0;
// Determine the size of captured audio data that is available from GetVoice.
// Most applications will only use compressed data and should ignore the other
// parameters, which exist primarily for backwards compatibility. See comments
// below for further explanation of "uncompressed" data.
virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0 ) = 0;
// ---------------------------------------------------------------------------
// NOTE: "uncompressed" audio is a deprecated feature and should not be used
// by most applications. It is raw single-channel 16-bit PCM wave data which
// may have been run through preprocessing filters and/or had silence removed,
// so the uncompressed audio could have a shorter duration than you expect.
// There may be no data at all during long periods of silence. Also, fetching
// uncompressed audio will cause GetVoice to discard any leftover compressed
// audio, so you must fetch both types at once. Finally, GetAvailableVoice is
// not precisely accurate when the uncompressed size is requested. So if you
// really need to use uncompressed audio, you should call GetVoice frequently
// with two very large (20kb+) output buffers instead of trying to allocate
// perfectly-sized buffers. But most applications should ignore all of these
// details and simply leave the "uncompressed" parameters as NULL/zero.
// ---------------------------------------------------------------------------
// Read captured audio data from the microphone buffer. This should be called
// at least once per frame, and preferably every few milliseconds, to keep the
// microphone input delay as low as possible. Most applications will only use
// compressed data and should pass NULL/zero for the "uncompressed" parameters.
// Compressed data can be transmitted by your application and decoded into raw
// using the DecompressVoice function below.
virtual EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed_Deprecated = false, void *pUncompressedDestBuffer_Deprecated = 0, uint32 cbUncompressedDestBufferSize_Deprecated = 0, uint32 *nUncompressBytesWritten_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0 ) = 0;
// Decodes the compressed voice data returned by GetVoice. The output data is
// raw single-channel 16-bit PCM audio. The decoder supports any sample rate
// from 11025 to 48000; see GetVoiceOptimalSampleRate() below for details.
// If the output buffer is not large enough, then *nBytesWritten will be set
// to the required buffer size, and k_EVoiceResultBufferTooSmall is returned.
// It is suggested to start with a 20kb buffer and reallocate as necessary.
virtual EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate ) = 0;
// This returns the native sample rate of the Steam voice decompressor; using
// this sample rate for DecompressVoice will perform the least CPU processing.
// However, the final audio quality will depend on how well the audio device
// (and/or your application's audio output SDK) deals with lower sample rates.
// You may find that you get the best audio output quality when you ignore
// this function and use the native sample rate of your audio output device,
// which is usually 48000 or 44100.
virtual uint32 GetVoiceOptimalSampleRate() = 0;
// Retrieve ticket to be sent to the entity who wishes to authenticate you.
// pcbTicket retrieves the length of the actual ticket.
// SteamNetworkingIdentity is an optional input parameter to hold the public IP address or SteamID of the entity you are connecting to
// if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
// if a Steam ID is passed Steam will only allow the ticket to be used by that Steam ID
// not to be used for "ISteamUserAuth\AuthenticateUserTicket" - it will fail
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSteamNetworkingIdentity ) = 0;
// Request a ticket which will be used for webapi "ISteamUserAuth\AuthenticateUserTicket"
// pchIdentity is an optional input parameter to identify the service the ticket will be sent to
// the ticket will be returned in callback GetTicketForWebApiResponse_t
virtual HAuthTicket GetAuthTicketForWebApi( const char *pchIdentity ) = 0;
// Authenticate ticket from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
// After receiving a user's authentication data, and passing it to BeginAuthSession, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
// returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam
// (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
virtual bool BIsBehindNAT() = 0;
// set data to be replicated to friends so that they can join your game
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
virtual void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) = 0;
// Requests a ticket encrypted with an app specific shared key
// pDataToInclude, cbDataToInclude will be encrypted into the ticket
// ( This is asynchronous, you must wait for the ticket to be completed by the server )
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
// Retrieves a finished ticket.
// If no ticket is available, or your buffer is too small, returns false.
// Upon exit, *pcbTicket will be either the size of the ticket copied into your buffer
// (if true was returned), or the size needed (if false was returned). To determine the
// proper size of the ticket, you can pass pTicket=NULL and cbMaxTicket=0; if a ticket
// is available, *pcbTicket will contain the size needed, otherwise it will be zero.
virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Trading Card badges data access
// if you only have one set of cards, the series will be 1
// the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0;
// gets the Steam Level of the user, as shown on their profile
virtual int GetPlayerSteamLevel() = 0;
// Requests a URL which authenticates an in-game browser for store check-out,
// and then redirects to the specified URL. As long as the in-game browser
// accepts and handles session cookies, Steam microtransaction checkout pages
// will automatically recognize the user instead of presenting a login page.
// The result of this API call will be a StoreAuthURLResponse_t callback.
// NOTE: The URL has a very short lifetime to prevent history-snooping attacks,
// so you should only call this API when you are about to launch the browser,
// or else immediately navigate to the result URL using a hidden browser window.
// NOTE 2: The resulting authorization cookie has an expiration time of one day,
// so it would be a good idea to request and visit a new auth URL every 12 hours.
STEAM_CALL_RESULT( StoreAuthURLResponse_t )
virtual SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) = 0;
// gets whether the users phone number is verified
virtual bool BIsPhoneVerified() = 0;
// gets whether the user has two factor enabled on their account
virtual bool BIsTwoFactorEnabled() = 0;
// gets whether the users phone number is identifying
virtual bool BIsPhoneIdentifying() = 0;
// gets whether the users phone number is awaiting (re)verification
virtual bool BIsPhoneRequiringVerification() = 0;
STEAM_CALL_RESULT( MarketEligibilityResponse_t )
virtual SteamAPICall_t GetMarketEligibility() = 0;
// Retrieves anti indulgence / duration control for current user
STEAM_CALL_RESULT( DurationControl_t )
virtual SteamAPICall_t GetDurationControl() = 0;
// Advise steam china duration control system about the online state of the game.
// This will prevent offline gameplay time from counting against a user's
// playtime limits.
virtual bool BSetDurationControlOnlineState( EDurationControlOnlineState eNewState ) = 0;
};
#define STEAMUSER_INTERFACE_VERSION "SteamUser023"
// Global interface accessor
inline ISteamUser *SteamUser();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUser *, SteamUser, STEAMUSER_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: Called when an authenticated connection to the Steam back-end has been established.
// This means the Steam client now has a working connection to the Steam servers.
// Usually this will have occurred before the game has launched, and should
// only be seen if the user has dropped connection due to a networking issue
// or a Steam server update.
//-----------------------------------------------------------------------------
struct SteamServersConnected_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 1 };
};
//-----------------------------------------------------------------------------
// Purpose: called when a connection attempt has failed
// this will occur periodically if the Steam client is not connected,
// and has failed in it's retry to establish a connection
//-----------------------------------------------------------------------------
struct SteamServerConnectFailure_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 2 };
EResult m_eResult;
bool m_bStillRetrying;
};
//-----------------------------------------------------------------------------
// Purpose: called if the client has lost connection to the Steam servers
// real-time services will be disabled until a matching SteamServersConnected_t has been posted
//-----------------------------------------------------------------------------
struct SteamServersDisconnected_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 3 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Sent by the Steam server to the client telling it to disconnect from the specified game server,
// which it may be in the process of or already connected to.
// The game client should immediately disconnect upon receiving this message.
// This can usually occur if the user doesn't have rights to play on the game server.
//-----------------------------------------------------------------------------
struct ClientGameServerDeny_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 13 };
uint32 m_uAppID;
uint32 m_unGameServerIP;
uint16 m_usGameServerPort;
uint16 m_bSecure;
uint32 m_uReason;
};
//-----------------------------------------------------------------------------
// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks)
// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect.
// This usually occurs in the rare event the Steam client has some kind of fatal error.
//-----------------------------------------------------------------------------
struct IPCFailure_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 17 };
enum EFailureType
{
k_EFailureFlushedCallbackQueue,
k_EFailurePipeFail,
};
uint8 m_eFailureType;
};
//-----------------------------------------------------------------------------
// Purpose: Signaled whenever licenses change
//-----------------------------------------------------------------------------
struct LicensesUpdated_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 25 };
};
//-----------------------------------------------------------------------------
// callback for BeginAuthSession
//-----------------------------------------------------------------------------
struct ValidateAuthTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 43 };
CSteamID m_SteamID;
EAuthSessionResponse m_eAuthSessionResponse;
CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed
};
//-----------------------------------------------------------------------------
// Purpose: called when a user has responded to a microtransaction authorization request
//-----------------------------------------------------------------------------
struct MicroTxnAuthorizationResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 52 };
uint32 m_unAppID; // AppID for this microtransaction
uint64 m_ulOrderID; // OrderID provided for the microtransaction
uint8 m_bAuthorized; // if user authorized transaction
};
//-----------------------------------------------------------------------------
// Purpose: Result from RequestEncryptedAppTicket
//-----------------------------------------------------------------------------
struct EncryptedAppTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 54 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// callback for GetAuthSessionTicket
//-----------------------------------------------------------------------------
struct GetAuthSessionTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 63 };
HAuthTicket m_hAuthTicket;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to a steam://gamewebcallback/ command
//-----------------------------------------------------------------------------
struct GameWebCallback_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 64 };
char m_szURL[256];
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to ISteamUser::RequestStoreAuthURL
//-----------------------------------------------------------------------------
struct StoreAuthURLResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 65 };
char m_szURL[512];
};
//-----------------------------------------------------------------------------
// Purpose: sent in response to ISteamUser::GetMarketEligibility
//-----------------------------------------------------------------------------
struct MarketEligibilityResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 66 };
bool m_bAllowed;
EMarketNotAllowedReasonFlags m_eNotAllowedReason;
RTime32 m_rtAllowedAtTime;
int m_cdaySteamGuardRequiredDays; // The number of days any user is required to have had Steam Guard before they can use the market
int m_cdayNewDeviceCooldown; // The number of days after initial device authorization a user must wait before using the market on that device
};
//-----------------------------------------------------------------------------
// Purpose: sent for games with enabled anti indulgence / duration control, for
// enabled users. Lets the game know whether the user can keep playing or
// whether the game should exit, and returns info about remaining gameplay time.
//
// This callback is fired asynchronously in response to timers triggering.
// It is also fired in response to calls to GetDurationControl().
//-----------------------------------------------------------------------------
struct DurationControl_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 67 };
EResult m_eResult; // result of call (always k_EResultOK for asynchronous timer-based notifications)
AppId_t m_appid; // appid generating playtime
bool m_bApplicable; // is duration control applicable to user + game combination
int32 m_csecsLast5h; // playtime since most recent 5 hour gap in playtime, only counting up to regulatory limit of playtime, in seconds
EDurationControlProgress m_progress; // recommended progress (either everything is fine, or please exit game)
EDurationControlNotification m_notification; // notification to show, if any (always k_EDurationControlNotification_None for API calls)
int32 m_csecsToday; // playtime on current calendar day
int32 m_csecsRemaining; // playtime remaining until the user hits a regulatory limit
};
//-----------------------------------------------------------------------------
// callback for GetTicketForWebApi
//-----------------------------------------------------------------------------
struct GetTicketForWebApiResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 68 };
HAuthTicket m_hAuthTicket;
EResult m_eResult;
int m_cubTicket;
static const int k_nCubTicketMaxLength = 2560;
uint8 m_rgubTicket[k_nCubTicketMaxLength];
};
#pragma pack( pop )
#endif // ISTEAMUSER_H

View File

@ -0,0 +1,476 @@
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to stats, achievements, and leaderboards
//
//=============================================================================
#ifndef ISTEAMUSERSTATS_H
#define ISTEAMUSERSTATS_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
#include "isteamremotestorage.h"
// size limit on stat or achievement name (UTF-8 encoded)
enum { k_cchStatNameMax = 128 };
// maximum number of bytes for a leaderboard name (UTF-8 encoded)
enum { k_cchLeaderboardNameMax = 128 };
// maximum number of details int32's storable for a single leaderboard entry
enum { k_cLeaderboardDetailsMax = 64 };
// handle to a single leaderboard
typedef uint64 SteamLeaderboard_t;
// handle to a set of downloaded entries in a leaderboard
typedef uint64 SteamLeaderboardEntries_t;
// type of data request, when downloading leaderboard entries
enum ELeaderboardDataRequest
{
k_ELeaderboardDataRequestGlobal = 0,
k_ELeaderboardDataRequestGlobalAroundUser = 1,
k_ELeaderboardDataRequestFriends = 2,
k_ELeaderboardDataRequestUsers = 3
};
// the sort order of a leaderboard
enum ELeaderboardSortMethod
{
k_ELeaderboardSortMethodNone = 0,
k_ELeaderboardSortMethodAscending = 1, // top-score is lowest number
k_ELeaderboardSortMethodDescending = 2, // top-score is highest number
};
// the display type (used by the Steam Community web site) for a leaderboard
enum ELeaderboardDisplayType
{
k_ELeaderboardDisplayTypeNone = 0,
k_ELeaderboardDisplayTypeNumeric = 1, // simple numerical score
k_ELeaderboardDisplayTypeTimeSeconds = 2, // the score represents a time, in seconds
k_ELeaderboardDisplayTypeTimeMilliSeconds = 3, // the score represents a time, in milliseconds
};
enum ELeaderboardUploadScoreMethod
{
k_ELeaderboardUploadScoreMethodNone = 0,
k_ELeaderboardUploadScoreMethodKeepBest = 1, // Leaderboard will keep user's best score
k_ELeaderboardUploadScoreMethodForceUpdate = 2, // Leaderboard will always replace score with specified
};
// a single entry in a leaderboard, as returned by GetDownloadedLeaderboardEntry()
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct LeaderboardEntry_t
{
CSteamID m_steamIDUser; // user with the entry - use SteamFriends()->GetFriendPersonaName() & SteamFriends()->GetFriendAvatar() to get more info
int32 m_nGlobalRank; // [1..N], where N is the number of users with an entry in the leaderboard
int32 m_nScore; // score as set in the leaderboard
int32 m_cDetails; // number of int32 details available for this entry
UGCHandle_t m_hUGC; // handle for UGC attached to the entry
};
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing stats, achievements, and leaderboard information
//-----------------------------------------------------------------------------
class ISteamUserStats
{
public:
// Note: this call is no longer required as it is managed by the Steam client
// The game stats and achievements will be synchronized with Steam before
// the game process begins.
// virtual bool RequestCurrentStats() = 0;
// Data accessors
STEAM_FLAT_NAME( GetStatInt32 )
virtual bool GetStat( const char *pchName, int32 *pData ) = 0;
STEAM_FLAT_NAME( GetStatFloat )
virtual bool GetStat( const char *pchName, float *pData ) = 0;
// Set / update data
STEAM_FLAT_NAME( SetStatInt32 )
virtual bool SetStat( const char *pchName, int32 nData ) = 0;
STEAM_FLAT_NAME( SetStatFloat )
virtual bool SetStat( const char *pchName, float fData ) = 0;
virtual bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) = 0;
// Achievement flag accessors
virtual bool GetAchievement( const char *pchName, bool *pbAchieved ) = 0;
virtual bool SetAchievement( const char *pchName ) = 0;
virtual bool ClearAchievement( const char *pchName ) = 0;
// Get the achievement status, and the time it was unlocked if unlocked.
// If the return value is true, but the unlock time is zero, that means it was unlocked before Steam
// began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970.
virtual bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0;
// Store the current data on the server, will get a callback when set
// And one callback for every new achievement
//
// If the callback has a result of k_EResultInvalidParam, one or more stats
// uploaded has been rejected, either because they broke constraints
// or were out of date. In this case the server sends back updated values.
// The stats should be re-iterated to keep in sync.
virtual bool StoreStats() = 0;
// Achievement / GroupAchievement metadata
// Gets the icon of the achievement, which is a handle to be used in ISteamUtils::GetImageRGBA(), or 0 if none set.
// A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback
// which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the
// specified achievement.
virtual int GetAchievementIcon( const char *pchName ) = 0;
// Get general attributes for an achievement. Accepts the following keys:
// - "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8)
// - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
virtual const char *GetAchievementDisplayAttribute( const char *pchName, const char *pchKey ) = 0;
// Achievement progress - triggers an AchievementProgress callback, that is all.
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
virtual bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress ) = 0;
// Used for iterating achievements. In general games should not need these functions because they should have a
// list of existing achievements compiled into them
virtual uint32 GetNumAchievements() = 0;
// Get achievement name iAchievement in [0,GetNumAchievements)
virtual const char *GetAchievementName( uint32 iAchievement ) = 0;
// Friends stats & achievements
// downloads stats for the user
// returns a UserStatsReceived_t received when completed
// if the other user has no stats, UserStatsReceived_t.m_eResult will be set to k_EResultFail
// these stats won't be auto-updated; you'll need to call RequestUserStats() again to refresh any data
STEAM_CALL_RESULT( UserStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
// requests stat information for a user, usable after a successful call to RequestUserStats()
STEAM_FLAT_NAME( GetUserStatInt32 )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0;
STEAM_FLAT_NAME( GetUserStatFloat )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0;
virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0;
// See notes for GetAchievementAndUnlockTime above
virtual bool GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0;
// Reset stats
virtual bool ResetAllStats( bool bAchievementsToo ) = 0;
// Leaderboard functions
// asks the Steam back-end for a leaderboard by name, and will create it if it's not yet
// This call is asynchronous, with the result returned in LeaderboardFindResult_t
STEAM_CALL_RESULT(LeaderboardFindResult_t)
virtual SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType ) = 0;
// as above, but won't create the leaderboard if it's not found
// This call is asynchronous, with the result returned in LeaderboardFindResult_t
STEAM_CALL_RESULT( LeaderboardFindResult_t )
virtual SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) = 0;
// returns the name of a leaderboard
virtual const char *GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// returns the total number of entries in a leaderboard, as of the last request
virtual int GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// returns the sort method of the leaderboard
virtual ELeaderboardSortMethod GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// returns the display type of the leaderboard
virtual ELeaderboardDisplayType GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// Asks the Steam back-end for a set of rows in the leaderboard.
// This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t
// LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries() (below)
// You can ask for more entries than exist, and it will return as many as do exist.
// k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries]
// k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate
// e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after
// k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) = 0;
// as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers
// if a user doesn't have a leaderboard entry, they won't be included in the result
// a max of 100 users can be downloaded at a time, with only one outstanding call at a time
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard,
STEAM_ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers ) = 0;
// Returns data about a single leaderboard entry
// use a for loop from 0 to LeaderboardScoresDownloaded_t::m_cEntryCount to get all the downloaded entries
// e.g.
// void OnLeaderboardScoresDownloaded( LeaderboardScoresDownloaded_t *pLeaderboardScoresDownloaded )
// {
// for ( int index = 0; index < pLeaderboardScoresDownloaded->m_cEntryCount; index++ )
// {
// LeaderboardEntry_t leaderboardEntry;
// int32 details[3]; // we know this is how many we've stored previously
// GetDownloadedLeaderboardEntry( pLeaderboardScoresDownloaded->m_hSteamLeaderboardEntries, index, &leaderboardEntry, details, 3 );
// assert( leaderboardEntry.m_cDetails == 3 );
// ...
// }
// once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid
virtual bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax ) = 0;
// Uploads a user score to the Steam back-end.
// This call is asynchronous, with the result returned in LeaderboardScoreUploaded_t
// Details are extra game-defined information regarding how the user got that score
// pScoreDetails points to an array of int32's, cScoreDetailsCount is the number of int32's in the list
STEAM_CALL_RESULT( LeaderboardScoreUploaded_t )
virtual SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount ) = 0;
// Attaches a piece of user generated content the user's entry on a leaderboard.
// hContent is a handle to a piece of user generated content that was shared using ISteamUserRemoteStorage::FileShare().
// This call is asynchronous, with the result returned in LeaderboardUGCSet_t.
STEAM_CALL_RESULT( LeaderboardUGCSet_t )
virtual SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) = 0;
// Retrieves the number of players currently playing your game (online + offline)
// This call is asynchronous, with the result returned in NumberOfCurrentPlayers_t
STEAM_CALL_RESULT( NumberOfCurrentPlayers_t )
virtual SteamAPICall_t GetNumberOfCurrentPlayers() = 0;
// Requests that Steam fetch data on the percentage of players who have received each achievement
// for the game globally.
// This call is asynchronous, with the result returned in GlobalAchievementPercentagesReady_t.
STEAM_CALL_RESULT( GlobalAchievementPercentagesReady_t )
virtual SteamAPICall_t RequestGlobalAchievementPercentages() = 0;
// Get the info on the most achieved achievement for the game, returns an iterator index you can use to fetch
// the next most achieved afterwards. Will return -1 if there is no data on achievement
// percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback).
virtual int GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0;
// Get the info on the next most achieved achievement for the game. Call this after GetMostAchievedAchievementInfo or another
// GetNextMostAchievedAchievementInfo call passing the iterator from the previous call. Returns -1 after the last
// achievement has been iterated.
virtual int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0;
// Returns the percentage of users who have achieved the specified achievement.
virtual bool GetAchievementAchievedPercent( const char *pchName, float *pflPercent ) = 0;
// Requests global stats data, which is available for stats marked as "aggregated".
// This call is asynchronous, with the results returned in GlobalStatsReceived_t.
// nHistoryDays specifies how many days of day-by-day history to retrieve in addition
// to the overall totals. The limit is 60.
STEAM_CALL_RESULT( GlobalStatsReceived_t )
virtual SteamAPICall_t RequestGlobalStats( int nHistoryDays ) = 0;
// Gets the lifetime totals for an aggregated stat
STEAM_FLAT_NAME( GetGlobalStatInt64 )
virtual bool GetGlobalStat( const char *pchStatName, int64 *pData ) = 0;
STEAM_FLAT_NAME( GetGlobalStatDouble )
virtual bool GetGlobalStat( const char *pchStatName, double *pData ) = 0;
// Gets history for an aggregated stat. pData will be filled with daily values, starting with today.
// So when called, pData[0] will be today, pData[1] will be yesterday, and pData[2] will be two days ago,
// etc. cubData is the size in bytes of the pubData buffer. Returns the number of
// elements actually set.
STEAM_FLAT_NAME( GetGlobalStatHistoryInt64 )
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) int64 *pData, uint32 cubData ) = 0;
STEAM_FLAT_NAME( GetGlobalStatHistoryDouble )
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0;
// For achievements that have related Progress stats, use this to query what the bounds of that progress are.
// You may want this info to selectively call IndicateAchievementProgress when appropriate milestones of progress
// have been made, to show a progress notification to the user.
STEAM_FLAT_NAME( GetAchievementProgressLimitsInt32 )
virtual bool GetAchievementProgressLimits( const char *pchName, int32 *pnMinProgress, int32 *pnMaxProgress ) = 0;
STEAM_FLAT_NAME( GetAchievementProgressLimitsFloat )
virtual bool GetAchievementProgressLimits( const char *pchName, float *pfMinProgress, float *pfMaxProgress ) = 0;
};
#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION013"
// Global interface accessor
inline ISteamUserStats *SteamUserStats();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUserStats *, SteamUserStats, STEAMUSERSTATS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: called when the latests stats and achievements have been received
// from the server
//-----------------------------------------------------------------------------
struct UserStatsReceived_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 1 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // Success / error fetching the stats
CSteamID m_steamIDUser; // The user for whom the stats are retrieved for
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the user stats for a game
//-----------------------------------------------------------------------------
struct UserStatsStored_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 2 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // success / error
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the achievements for a game, or an
// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress
// are zero, that means the achievement has been fully unlocked.
//-----------------------------------------------------------------------------
struct UserAchievementStored_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 3 };
uint64 m_nGameID; // Game this is for
bool m_bGroupAchievement; // if this is a "group" achievement
char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement
uint32 m_nCurProgress; // current progress towards the achievement
uint32 m_nMaxProgress; // "out of" this many
};
//-----------------------------------------------------------------------------
// Purpose: call result for finding a leaderboard, returned as a result of FindOrCreateLeaderboard() or FindLeaderboard()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardFindResult_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 4 };
SteamLeaderboard_t m_hSteamLeaderboard; // handle to the leaderboard serarched for, 0 if no leaderboard found
uint8 m_bLeaderboardFound; // 0 if no leaderboard found
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating scores for a leaderboard have been downloaded and are ready to be retrieved, returned as a result of DownloadLeaderboardEntries()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardScoresDownloaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 5 };
SteamLeaderboard_t m_hSteamLeaderboard;
SteamLeaderboardEntries_t m_hSteamLeaderboardEntries; // the handle to pass into GetDownloadedLeaderboardEntries()
int m_cEntryCount; // the number of entries downloaded
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating scores has been uploaded, returned as a result of UploadLeaderboardScore()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardScoreUploaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 6 };
uint8 m_bSuccess; // 1 if the call was successful
SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was
int32 m_nScore; // the score that was attempted to set
uint8 m_bScoreChanged; // true if the score in the leaderboard change, false if the existing score was better
int m_nGlobalRankNew; // the new global rank of the user in this leaderboard
int m_nGlobalRankPrevious; // the previous global rank of the user in this leaderboard; 0 if the user had no existing entry in the leaderboard
};
struct NumberOfCurrentPlayers_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 7 };
uint8 m_bSuccess; // 1 if the call was successful
int32 m_cPlayers; // Number of players currently playing
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that a user's stats have been unloaded.
// Call RequestUserStats again to access stats for this user
//-----------------------------------------------------------------------------
struct UserStatsUnloaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 };
CSteamID m_steamIDUser; // User whose stats have been unloaded
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that an achievement icon has been fetched
//-----------------------------------------------------------------------------
struct UserAchievementIconFetched_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 9 };
CGameID m_nGameID; // Game this is for
char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement
bool m_bAchieved; // Is the icon for the achieved or not achieved version?
int m_nIconHandle; // Handle to the image, which can be used in SteamUtils()->GetImageRGBA(), 0 means no image is set for the achievement
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that global achievement percentages are fetched
//-----------------------------------------------------------------------------
struct GlobalAchievementPercentagesReady_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 10 };
uint64 m_nGameID; // Game this is for
EResult m_eResult; // Result of the operation
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating UGC has been uploaded, returned as a result of SetLeaderboardUGC()
//-----------------------------------------------------------------------------
struct LeaderboardUGCSet_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 11 };
EResult m_eResult; // The result of the operation
SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating global stats have been received.
// Returned as a result of RequestGlobalStats()
//-----------------------------------------------------------------------------
struct GlobalStatsReceived_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 };
uint64 m_nGameID; // Game global stats were requested for
EResult m_eResult; // The result of the request
};
#pragma pack( pop )
#endif // ISTEAMUSER_H

View File

@ -0,0 +1,343 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to utility functions in Steam
//
//=============================================================================
#ifndef ISTEAMUTILS_H
#define ISTEAMUTILS_H
#include "steam_api_common.h"
// Steam API call failure results
enum ESteamAPICallFailure
{
k_ESteamAPICallFailureNone = -1, // no failure
k_ESteamAPICallFailureSteamGone = 0, // the local Steam process has gone away
k_ESteamAPICallFailureNetworkFailure = 1, // the network connection to Steam has been broken, or was already broken
// SteamServersDisconnected_t callback will be sent around the same time
// SteamServersConnected_t will be sent when the client is able to talk to the Steam servers again
k_ESteamAPICallFailureInvalidHandle = 2, // the SteamAPICall_t handle passed in no longer exists
k_ESteamAPICallFailureMismatchedCallback = 3,// GetAPICallResult() was called with the wrong callback type for this API call
};
// Input modes for the Big Picture gamepad text entry
enum EGamepadTextInputMode
{
k_EGamepadTextInputModeNormal = 0,
k_EGamepadTextInputModePassword = 1
};
// Controls number of allowed lines for the Big Picture gamepad text entry
enum EGamepadTextInputLineMode
{
k_EGamepadTextInputLineModeSingleLine = 0,
k_EGamepadTextInputLineModeMultipleLines = 1
};
enum EFloatingGamepadTextInputMode
{
k_EFloatingGamepadTextInputModeModeSingleLine = 0, // Enter dismisses the keyboard
k_EFloatingGamepadTextInputModeModeMultipleLines = 1, // User needs to explictly close the keyboard
k_EFloatingGamepadTextInputModeModeEmail = 2, // Keyboard layout is email, enter dismisses the keyboard
k_EFloatingGamepadTextInputModeModeNumeric = 3, // Keyboard layout is numeric, enter dismisses the keyboard
};
// The context where text filtering is being done
enum ETextFilteringContext
{
k_ETextFilteringContextUnknown = 0, // Unknown context
k_ETextFilteringContextGameContent = 1, // Game content, only legally required filtering is performed
k_ETextFilteringContextChat = 2, // Chat from another player
k_ETextFilteringContextName = 3, // Character or item name
};
//-----------------------------------------------------------------------------
// Purpose: interface to user independent utility functions
//-----------------------------------------------------------------------------
class ISteamUtils
{
public:
// return the number of seconds since the user
virtual uint32 GetSecondsSinceAppActive() = 0;
virtual uint32 GetSecondsSinceComputerActive() = 0;
// the universe this client is connecting to
virtual EUniverse GetConnectedUniverse() = 0;
// Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
virtual uint32 GetServerRealTime() = 0;
// returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database)
// e.g "US" or "UK".
virtual const char *GetIPCountry() = 0;
// returns true if the image exists, and valid sizes were filled out
virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0;
// returns true if the image exists, and the buffer was successfully filled out
// results are returned in RGBA format
// the destination buffer size should be 4 * height * width * sizeof(char)
virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0;
// Deprecated. Do not call this.
STEAM_PRIVATE_API( virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; )
// return the amount of battery power left in the current system in % [0..100], 255 for being on AC power
virtual uint8 GetCurrentBatteryPower() = 0;
// returns the appID of the current process
virtual uint32 GetAppID() = 0;
// Sets the position where the overlay instance for the currently calling game should show notifications.
// This position is per-game and if this function is called from outside of a game context it will do nothing.
virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0;
// API asynchronous call results
// can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
virtual bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) = 0;
virtual ESteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall ) = 0;
virtual bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() instead. Game servers do not need to call this function.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
// control how often you do them.
virtual uint32 GetIPCCallCount() = 0;
// API warning handling
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
// Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to
// start & hook the game process, so this function will initially return false while the overlay is loading.
virtual bool IsOverlayEnabled() = 0;
// Normally this call is unneeded if your game has a constantly running frame loop that calls the
// D3D Present API, or OGL SwapBuffers API every frame.
//
// However, if you have a game that only refreshes the screen on an event driven basis then that can break
// the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also
// need to Present() to the screen any time an even needing a notification happens or when the overlay is
// brought up over the game by a user. You can use this API to ask the overlay if it currently need a present
// in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you
// refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.
virtual bool BOverlayNeedsPresent() = 0;
// Asynchronous call to check if an executable file has been signed using the public key set on the signing tab
// of the partner site, for example to refuse to load modified executable files.
// The result is returned in CheckFileSignature_t.
// k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function.
// k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site.
// k_ECheckFileSignatureFileNotFound - The file does not exist on disk.
// k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match.
// k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid.
STEAM_CALL_RESULT( CheckFileSignature_t )
virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0;
// Activates the full-screen text input dialog which takes a initial text string and returns the text the user has typed
virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0;
// Returns previously entered text & length
virtual uint32 GetEnteredGamepadTextLength() = 0;
virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0;
// returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases
virtual const char *GetSteamUILanguage() = 0;
// returns true if Steam itself is running in VR mode
virtual bool IsSteamRunningInVR() = 0;
// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
virtual void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset ) = 0;
// returns true if Steam & the Steam Overlay are running in Big Picture mode
// Games much be launched through the Steam client to enable the Big Picture overlay. During development,
// a game can be added as a non-steam game to the developers library to test this feature
virtual bool IsSteamInBigPictureMode() = 0;
// ask SteamUI to create and render its OpenVR dashboard
virtual void StartVRDashboard() = 0;
// Returns true if the HMD content will be streamed via Steam Remote Play
virtual bool IsVRHeadsetStreamingEnabled() = 0;
// Set whether the HMD content will be streamed via Steam Remote Play
// If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed.
// If this is set to false, then the application window will be streamed instead, and remote input will be allowed.
// The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.
// (this is useful for games that have asymmetric multiplayer gameplay)
virtual void SetVRHeadsetStreamingEnabled( bool bEnabled ) = 0;
// Returns whether this steam client is a Steam China specific client, vs the global client.
virtual bool IsSteamChinaLauncher() = 0;
// Initializes text filtering, loading dictionaries for the language the game is running in.
// unFilterOptions are reserved for future use and should be set to 0
// Returns false if filtering is unavailable for the game's language, in which case FilterText() will act as a passthrough.
//
// Users can customize the text filter behavior in their Steam Account preferences:
// https://store.steampowered.com/account/preferences#CommunityContentPreferences
virtual bool InitFilterText( uint32 unFilterOptions = 0 ) = 0;
// Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings
// eContext is the type of content in the input string
// sourceSteamID is the Steam ID that is the source of the input string (e.g. the player with the name, or who said the chat text)
// pchInputText is the input string that should be filtered, which can be ASCII or UTF-8
// pchOutFilteredText is where the output will be placed, even if no filtering is performed
// nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText, should be at least strlen(pchInputText)+1
// Returns the number of characters (not bytes) filtered
virtual int FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText ) = 0;
// Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol.
// This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
virtual ESteamIPv6ConnectivityState GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol ) = 0;
// returns true if currently running on the Steam Deck device
virtual bool IsSteamRunningOnSteamDeck() = 0;
// Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game.
// The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field
virtual bool ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight ) = 0;
// In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher
virtual void SetGameLauncherMode( bool bLauncherMode ) = 0;
// Dismisses the floating keyboard.
virtual bool DismissFloatingGamepadTextInput() = 0;
// Dismisses the full-screen text input dialog.
virtual bool DismissGamepadTextInput() = 0;
};
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils010"
// Global interface accessor
inline ISteamUtils *SteamUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMUTILS_INTERFACE_VERSION ), "user", STEAMUTILS_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamUtils *SteamGameServerUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamGameServerUtils, SteamInternal_FindOrCreateGameServerInterface( 0, STEAMUTILS_INTERFACE_VERSION ), "gameserver", STEAMUTILS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: The country of the user changed
//-----------------------------------------------------------------------------
struct IPCountry_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 1 };
};
//-----------------------------------------------------------------------------
// Purpose: Fired when running on a handheld PC or laptop with less than 10 minutes of battery is left, fires then every minute
//-----------------------------------------------------------------------------
struct LowBatteryPower_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 2 };
uint8 m_nMinutesBatteryLeft;
};
//-----------------------------------------------------------------------------
// Purpose: called when a SteamAsyncCall_t has completed (or failed)
//-----------------------------------------------------------------------------
struct SteamAPICallCompleted_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 3 };
SteamAPICall_t m_hAsyncCall;
int m_iCallback;
uint32 m_cubParam;
};
//-----------------------------------------------------------------------------
// called when Steam wants to shutdown
//-----------------------------------------------------------------------------
struct SteamShutdown_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 4 };
};
//-----------------------------------------------------------------------------
// results for CheckFileSignature
//-----------------------------------------------------------------------------
enum ECheckFileSignature
{
k_ECheckFileSignatureInvalidSignature = 0,
k_ECheckFileSignatureValidSignature = 1,
k_ECheckFileSignatureFileNotFound = 2,
k_ECheckFileSignatureNoSignaturesFoundForThisApp = 3,
k_ECheckFileSignatureNoSignaturesFoundForThisFile = 4,
};
//-----------------------------------------------------------------------------
// callback for CheckFileSignature
//-----------------------------------------------------------------------------
struct CheckFileSignature_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 5 };
ECheckFileSignature m_eCheckFileSignature;
};
// k_iSteamUtilsCallbacks + 13 is taken
//-----------------------------------------------------------------------------
// Full Screen gamepad text input has been closed
//-----------------------------------------------------------------------------
struct GamepadTextInputDismissed_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 14 };
bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input
uint32 m_unSubmittedText;
AppId_t m_unAppID;
};
// k_iSteamUtilsCallbacks + 15 through 35 are taken
STEAM_CALLBACK_BEGIN( AppResumingFromSuspend_t, k_iSteamUtilsCallbacks + 36 )
STEAM_CALLBACK_END(0)
// k_iSteamUtilsCallbacks + 37 is taken
//-----------------------------------------------------------------------------
// The floating on-screen keyboard has been closed
//-----------------------------------------------------------------------------
struct FloatingGamepadTextInputDismissed_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 38 };
};
//-----------------------------------------------------------------------------
// The text filtering dictionary has changed
//-----------------------------------------------------------------------------
struct FilterTextDictionaryChanged_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 39 };
int m_eLanguage; // One of ELanguage, or k_LegallyRequiredFiltering
};
#pragma pack( pop )
#endif // ISTEAMUTILS_H

View File

@ -0,0 +1,74 @@
//====== Copyright © 1996-2014 Valve Corporation, All rights reserved. =======
//
// Purpose: interface to Steam Video
//
//=============================================================================
#ifndef ISTEAMVIDEO_H
#define ISTEAMVIDEO_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: Steam Video API
//-----------------------------------------------------------------------------
class ISteamVideo
{
public:
// Get a URL suitable for streaming the given Video app ID's video
virtual void GetVideoURL( AppId_t unVideoAppID ) = 0;
// returns true if user is uploading a live broadcast
virtual bool IsBroadcasting( int *pnNumViewers ) = 0;
// Get the OPF Details for 360 Video Playback
STEAM_CALL_BACK( GetOPFSettingsResult_t )
virtual void GetOPFSettings( AppId_t unVideoAppID ) = 0;
virtual bool GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize ) = 0;
};
#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V007"
// Global interface accessor
inline ISteamVideo *SteamVideo();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamVideo *, SteamVideo, STEAMVIDEO_INTERFACE_VERSION );
STEAM_CALLBACK_BEGIN( GetVideoURLResult_t, k_iSteamVideoCallbacks + 11 )
STEAM_CALLBACK_MEMBER( 0, EResult, m_eResult )
STEAM_CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
STEAM_CALLBACK_MEMBER( 2, char, m_rgchURL[256] )
STEAM_CALLBACK_END(3)
STEAM_CALLBACK_BEGIN( GetOPFSettingsResult_t, k_iSteamVideoCallbacks + 24 )
STEAM_CALLBACK_MEMBER( 0, EResult, m_eResult )
STEAM_CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
STEAM_CALLBACK_END(2)
STEAM_CALLBACK_BEGIN( BroadcastUploadStart_t, k_iSteamVideoCallbacks + 4 )
STEAM_CALLBACK_MEMBER( 0, bool, m_bIsRTMP )
STEAM_CALLBACK_END( 1 )
STEAM_CALLBACK_BEGIN( BroadcastUploadStop_t, k_iSteamVideoCallbacks + 5 )
STEAM_CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult )
STEAM_CALLBACK_END( 1 )
#pragma pack( pop )
#endif // ISTEAMVIDEO_H

Some files were not shown because too many files have changed in this diff Show More